QuestionId stringlengths 3 8 | QuestionTitle stringlengths 15 149 | QuestionScore int64 1 27.2k | QuestionCreatedUtc stringdate 2008-08-01 18:33:08 2025-06-16 04:59:48 | QuestionBodyHtml stringlengths 40 28.2k | QuestionViewCount int64 78 16.5M | QuestionOwnerUserId float64 4 25.2M ⌀ | QuestionLastActivityUtc stringdate 2008-09-08 19:26:01 2026-01-24 22:40:25 | AcceptedAnswerId int64 266 79.7M | AnswerScore int64 2 30.1k | AnswerCreatedUtc stringdate 2008-08-01 23:40:28 2025-06-16 05:23:39 | AnswerOwnerUserId float64 1 29.5M ⌀ | AnswerLastActivityUtc stringdate 2008-08-01 23:40:28 2026-01-23 17:46:09 | QuestionLink stringlengths 31 36 | AnswerLink stringlengths 31 36 | AnswerBodyHtml stringlengths 35 33k | AnswerBodyPreview stringlengths 35 400 | AllTagIdsCsv stringlengths 2 37 | AllTagNamesCsv stringlengths 2 106 | MergedQuestion stringlengths 74 28.4k | quality_filter stringclasses 10
values | unique_id int64 0 29k | tag_major_lang stringclasses 10
values | MergedQuestion_md stringlengths 60 28.1k | AnswerBodyHtml_md stringlengths 14 29.2k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6462837 | How to find the MD5 fingerprint of my Android App | 13 | 2011-06-24 02:54:38 | <p>I'm trying to sign up for Android Google Maps and which requests MD5 fingerprint. How to get the fingerprint out of my application??</p>
<p>I'm newbie to keystore and couldn't understand a thing i find online. so simple instructions appreciated</p>
<p>Thanks in advance</p>
| 35,088 | 348,301 | 2015-08-04 13:21:24 | 6,463,176 | 25 | 2011-06-24 03:59:53 | 467,592 | 2015-01-22 20:32:31 | https://stackoverflow.com/q/6462837 | https://stackoverflow.com/a/6463176 | <p>You will be needing two keystores.</p>
<p>One for debug purpose and
One for release purpose.</p>
<p>While you are developing your application via eclipse and debugging it on simulator or device. You will be needing debug keystores. Otherwise you will not be able to see the map.
debug keystore is already present in... | <p>You will be needing two keystores.</p> <p>One for debug purpose and One for release purpose.</p> <p>While you are developing your application via eclipse and debugging it on simulator or device. You will be needing debug keystores. Otherwise you will not be able to see the map. debug keystore is already present in... | 1386, 2358, 2631, 8614 | android, cmd, keystore, md5 | <h1>How to find the MD5 fingerprint of my Android App</h1>
<p>I'm trying to sign up for Android Google Maps and which requests MD5 fingerprint. How to get the fingerprint out of my application??</p>
<p>I'm newbie to keystore and couldn't understand a thing i find online. so simple instructions appreciated</p>
<p>Than... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,744 | cmd | # How to find the MD5 fingerprint of my Android App
I'm trying to sign up for Android Google Maps and which requests MD5 fingerprint. How to get the fingerprint out of my application??
I'm newbie to keystore and couldn't understand a thing i find online. so simple instructions appreciated
Thanks in advance | You will be needing two keystores.
One for debug purpose and
One for release purpose.
While you are developing your application via eclipse and debugging it on simulator or device. You will be needing debug keystores. Otherwise you will not be able to see the map.
debug keystore is already present into your system.
... |
51226066 | Invalid bean definition with name 'employeesJob' defined in class path resource: factory-bean reference points back to the same bean definition | 12 | 2018-07-07 18:48:43 | <p>I went through this link : <strong><a href="https://stackoverflow.com/questions/37245376/spring-bean-inheritance-using-annotations-bean-reference-back-issue">Spring Bean Inheritance Using Annotations Bean reference back issue</a></strong> and other links as well, but it did not solved my issue yet.</p>
<p>I am work... | 19,210 | 6,872,018 | 2024-09-01 06:45:03 | 51,226,614 | 25 | 2018-07-07 20:08:21 | 6,872,018 | 2021-11-10 09:50:52 | https://stackoverflow.com/q/51226066 | https://stackoverflow.com/a/51226614 | <p>Finally I was able to solve this issue. You cant give <code>jobName</code> and <code>className</code> exactly same like <code>employeesJob()</code>. I changed the Job Name and its working fine now.</p>
| <p>Finally I was able to solve this issue. You cant give <code>jobName</code> and <code>className</code> exactly same like <code>employeesJob()</code>. I changed the Job Name and its working fine now.</p> | 17, 1211, 41895, 95875 | java, spring, spring-batch, spring-boot | <h1>Invalid bean definition with name 'employeesJob' defined in class path resource: factory-bean reference points back to the same bean definition</h1>
<p>I went through this link : <strong><a href="https://stackoverflow.com/questions/37245376/spring-bean-inheritance-using-annotations-bean-reference-back-issue">Spring... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,745 | cmd | # Invalid bean definition with name 'employeesJob' defined in class path resource: factory-bean reference points back to the same bean definition
I went through this link : **[Spring Bean Inheritance Using Annotations Bean reference back issue](https://stackoverflow.com/questions/37245376/spring-bean-inheritance-using... | Finally I was able to solve this issue. You cant give `jobName` and `className` exactly same like `employeesJob()`. I changed the Job Name and its working fine now. |
38297172 | 7-zip command line - Incorrect wildcard type marker | 12 | 2016-07-10 22:57:58 | <p>I'm using 7-zip 15.14 64-bit on Windows 10. I have a batch file that compiles a game I'm working on, only problem is I get an error about an "Incorrect wildcard type marker". Here is the line of code taken right from the batch file.</p>
<pre><code>"%ProgramFiles%\7-Zip\7z.exe" a "%expt%\Game_Win.exe" "%expt%\Win\*"... | 5,931 | 6,278,636 | 2016-07-11 01:17:41 | 38,297,915 | 25 | 2016-07-11 01:17:41 | 2,378,643 | 2016-07-11 01:17:41 | https://stackoverflow.com/q/38297172 | https://stackoverflow.com/a/38297915 | <p>It sounds like you have enabledelayedexpansion turned on.</p>
<p>With this mode, <code>!</code> symbols have special meaning, and to make matters more interesting, there are two parse passes on each line, meaning you'll need to double escape them to have the symbol pass through to the target application:</p>
<pre>... | <p>It sounds like you have enabledelayedexpansion turned on.</p> <p>With this mode, <code>!</code> symbols have special meaning, and to make matters more interesting, there are two parse passes on each line, meaning you'll need to double escape them to have the symbol pass through to the target application:</p> <pre>... | 7002 | batch-file | <h1>7-zip command line - Incorrect wildcard type marker</h1>
<p>I'm using 7-zip 15.14 64-bit on Windows 10. I have a batch file that compiles a game I'm working on, only problem is I get an error about an "Incorrect wildcard type marker". Here is the line of code taken right from the batch file.</p>
<pre><code>"%Progr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,746 | cmd | # 7-zip command line - Incorrect wildcard type marker
I'm using 7-zip 15.14 64-bit on Windows 10. I have a batch file that compiles a game I'm working on, only problem is I get an error about an "Incorrect wildcard type marker". Here is the line of code taken right from the batch file.
```
"%ProgramFiles%\7-Zip\7z.ex... | It sounds like you have enabledelayedexpansion turned on.
With this mode, `!` symbols have special meaning, and to make matters more interesting, there are two parse passes on each line, meaning you'll need to double escape them to have the symbol pass through to the target application:
```
echo "%ProgramFiles%\7-Zip... |
27412976 | Close chrome from bat file | 12 | 2014-12-10 23:45:43 | <p>I am trying to kill chrome from bat file. Tried</p>
<pre><code>TASKKILL /IM chrome.exe /F
</code></pre>
<p>but it doesnt close the chrome. What is the correct way to do that ?</p>
| 120,727 | 198,989 | 2024-03-18 09:24:17 | 27,413,026 | 25 | 2014-12-10 23:50:14 | 4,338,174 | 2023-01-12 06:06:57 | https://stackoverflow.com/q/27412976 | https://stackoverflow.com/a/27413026 | <p>You'll want to use the same command, but with the /T argument, like so:</p>
<pre><code>taskkill /F /IM chrome.exe /T
</code></pre>
<p>The /T argument kills the process and all of its child processes. Effectively, it should close all processes with the same process name that you provide in the argument list.</p>
<p>I... | <p>You'll want to use the same command, but with the /T argument, like so:</p> <pre><code>taskkill /F /IM chrome.exe /T </code></pre> <p>The /T argument kills the process and all of its child processes. Effectively, it should close all processes with the same process name that you provide in the argument list.</p> <p>I... | 1231, 2631, 7002 | batch-file, cmd, command-line | <h1>Close chrome from bat file</h1>
<p>I am trying to kill chrome from bat file. Tried</p>
<pre><code>TASKKILL /IM chrome.exe /F
</code></pre>
<p>but it doesnt close the chrome. What is the correct way to do that ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,747 | cmd | # Close chrome from bat file
I am trying to kill chrome from bat file. Tried
```
TASKKILL /IM chrome.exe /F
```
but it doesnt close the chrome. What is the correct way to do that ? | You'll want to use the same command, but with the /T argument, like so:
```
taskkill /F /IM chrome.exe /T
```
The /T argument kills the process and all of its child processes. Effectively, it should close all processes with the same process name that you provide in the argument list.
If you'd like to suppress errors... |
27318466 | Spring Batch how to filter duplicated items before send it to ItemWriter | 10 | 2014-12-05 14:48:49 | <p>I read a flat file (for example a .csv file with 1 line per User, Ex: <em>UserId;Data1;Date2</em>).</p>
<p>But how to handle duplicated User item in the reader (where is no list of previus readed users...)</p>
<pre><code>stepBuilderFactory.get("createUserStep1")
.<User, User>chunk(1000)
.reader(flatFileItemR... | 23,893 | 1,121,571 | 2022-11-09 14:29:05 | 27,319,419 | 25 | 2014-12-05 15:35:59 | 618,059 | 2022-11-09 09:09:52 | https://stackoverflow.com/q/27318466 | https://stackoverflow.com/a/27319419 | <p>Filtering is typically done with an <code>ItemProcessor</code>. If the <code>ItemProcessor</code> returns null, the item is filtered and not passed to the <code>ItemWriter</code>. Otherwise, it is. In your case, you could keep a list of previously seen users in the <code>ItemProcessor</code>. If the user hasn't ... | <p>Filtering is typically done with an <code>ItemProcessor</code>. If the <code>ItemProcessor</code> returns null, the item is filtered and not passed to the <code>ItemWriter</code>. Otherwise, it is. In your case, you could keep a list of previously seen users in the <code>ItemProcessor</code>. If the user hasn't ... | 1211, 30645, 41895 | batch-processing, spring, spring-batch | <h1>Spring Batch how to filter duplicated items before send it to ItemWriter</h1>
<p>I read a flat file (for example a .csv file with 1 line per User, Ex: <em>UserId;Data1;Date2</em>).</p>
<p>But how to handle duplicated User item in the reader (where is no list of previus readed users...)</p>
<pre><code>stepBuilderF... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,749 | cmd | # Spring Batch how to filter duplicated items before send it to ItemWriter
I read a flat file (for example a .csv file with 1 line per User, Ex: *UserId;Data1;Date2*).
But how to handle duplicated User item in the reader (where is no list of previus readed users...)
```
stepBuilderFactory.get("createUserStep1")
.<Us... | Filtering is typically done with an `ItemProcessor`. If the `ItemProcessor` returns null, the item is filtered and not passed to the `ItemWriter`. Otherwise, it is. In your case, you could keep a list of previously seen users in the `ItemProcessor`. If the user hasn't been seen before, pass it on. If it has been seen b... |
13880650 | how to call / run multiple python scripts from batch file in window xp / 7 | 10 | 2012-12-14 14:30:46 | <p>I'm trying to schedule run multiple pythons using batch file.</p>
<p>For example there are my python files that I want to schedule run them on the daily basis</p>
<pre><code>D:\py\s1.py
D:\py\s2.py
</code></pre>
<p>now how can I combine these two files into a .bat, so that I can schedule run these two file using ... | 48,555 | 918,460 | 2012-12-14 15:45:03 | 13,880,776 | 25 | 2012-12-14 14:39:10 | 891,976 | 2012-12-14 14:39:10 | https://stackoverflow.com/q/13880650 | https://stackoverflow.com/a/13880776 | <p><strong>Method 1</strong>: Bat file.</p>
<p>If you have python in the PATH Environment variable:</p>
<pre><code>start python D:\py\s1.py
start python D:\py\s2.py
</code></pre>
<p>Else literal path</p>
<pre><code>start C:\python27\python.exe D:\py\s1.py
start C:\python27\python.exe D:\py\s2.py
</code></pre>
<p>N... | <p><strong>Method 1</strong>: Bat file.</p> <p>If you have python in the PATH Environment variable:</p> <pre><code>start python D:\py\s1.py start python D:\py\s2.py </code></pre> <p>Else literal path</p> <pre><code>start C:\python27\python.exe D:\py\s1.py start C:\python27\python.exe D:\py\s2.py </code></pre> <p>N... | 16, 7002, 9299 | batch-file, python, scheduled-tasks | <h1>how to call / run multiple python scripts from batch file in window xp / 7</h1>
<p>I'm trying to schedule run multiple pythons using batch file.</p>
<p>For example there are my python files that I want to schedule run them on the daily basis</p>
<pre><code>D:\py\s1.py
D:\py\s2.py
</code></pre>
<p>now how can I c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,750 | cmd | # how to call / run multiple python scripts from batch file in window xp / 7
I'm trying to schedule run multiple pythons using batch file.
For example there are my python files that I want to schedule run them on the daily basis
```
D:\py\s1.py
D:\py\s2.py
```
now how can I combine these two files into a .bat, so t... | **Method 1**: Bat file.
If you have python in the PATH Environment variable:
```
start python D:\py\s1.py
start python D:\py\s2.py
```
Else literal path
```
start C:\python27\python.exe D:\py\s1.py
start C:\python27\python.exe D:\py\s2.py
```
Note that this will not wait for a return from either execution. Note, d... |
6306918 | batch file to run jar file with parameters | 10 | 2011-06-10 13:20:32 | <p>How can I run a batch file and pass parameters to jar file?</p>
<p>this doesn't work</p>
<p><strong>mybat.bat</strong></p>
<pre><code>java -jar log_parser.jar %1 %2 %3 %4
</code></pre>
<p>running bat file</p>
<pre><code>C:\>log_parser.bat -file=C:\\trace_small.log -str=Storing
</code></pre>
<p>java sees onl... | 46,877 | 272,869 | 2022-10-24 02:23:24 | 6,342,390 | 25 | 2011-06-14 10:52:02 | 456,081 | 2011-06-14 10:52:02 | https://stackoverflow.com/q/6306918 | https://stackoverflow.com/a/6342390 | <p>I just tried with a small java program that only dumps the arguments to the screen:</p>
<pre><code>public static void main(String[] args)
{
for(String s : args)
{
System.out.println(s);
}
}
</code></pre>
<p>and the following batch file :</p>
<pre><code>java -jar test.jar %1 %2 %3 %4
</code>... | <p>I just tried with a small java program that only dumps the arguments to the screen:</p> <pre><code>public static void main(String[] args) { for(String s : args) { System.out.println(s); } } </code></pre> <p>and the following batch file :</p> <pre><code>java -jar test.jar %1 %2 %3 %4 </code>... | 17, 4841, 7002 | batch-file, jar, java | <h1>batch file to run jar file with parameters</h1>
<p>How can I run a batch file and pass parameters to jar file?</p>
<p>this doesn't work</p>
<p><strong>mybat.bat</strong></p>
<pre><code>java -jar log_parser.jar %1 %2 %3 %4
</code></pre>
<p>running bat file</p>
<pre><code>C:\>log_parser.bat -file=C:\\trace_sm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,751 | cmd | # batch file to run jar file with parameters
How can I run a batch file and pass parameters to jar file?
this doesn't work
**mybat.bat**
```
java -jar log_parser.jar %1 %2 %3 %4
```
running bat file
```
C:\>log_parser.bat -file=C:\\trace_small.log -str=Storing
```
java sees only `-file` | I just tried with a small java program that only dumps the arguments to the screen:
```
public static void main(String[] args)
{
for(String s : args)
{
System.out.println(s);
}
}
```
and the following batch file :
```
java -jar test.jar %1 %2 %3 %4
```
and I ended up with the following result
`... |
31737209 | How to get Job parameteres in to item processor using spring Batch annotation | 9 | 2015-07-31 02:34:47 | <p>I am using spring MVC. From my controller, I am calling <code>jobLauncher</code> and in <code>jobLauncher</code> I am passing job parameters like below and I'm using annotations to enable configuration as below:</p>
<pre><code>@Configuration
@EnableBatchProcessing
public class BatchConfiguration {
// read, ... | 32,868 | 5,172,054 | 2022-10-14 06:04:26 | 31,737,765 | 25 | 2015-07-31 03:50:19 | 1,708,647 | 2015-07-31 03:57:04 | https://stackoverflow.com/q/31737209 | https://stackoverflow.com/a/31737765 | <p>1) Put a scope annotation on your data processor i.e. </p>
<pre><code>@Scope(value = "step")
</code></pre>
<p>2) Make a class instance in your data processor and inject the job parameter value by using value annotation :</p>
<pre><code>@Value("#{jobParameters['fileName']}")
private String fileName;
</code></pre>... | <p>1) Put a scope annotation on your data processor i.e. </p> <pre><code>@Scope(value = "step") </code></pre> <p>2) Make a class instance in your data processor and inject the job parameter value by using value annotation :</p> <pre><code>@Value("#{jobParameters['fileName']}") private String fileName; </code></pre>... | 17, 1211, 7027, 41895, 70274 | java, spring, spring-batch, spring-batch-admin, spring-mvc | <h1>How to get Job parameteres in to item processor using spring Batch annotation</h1>
<p>I am using spring MVC. From my controller, I am calling <code>jobLauncher</code> and in <code>jobLauncher</code> I am passing job parameters like below and I'm using annotations to enable configuration as below:</p>
<pre><code>@C... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,752 | cmd | # How to get Job parameteres in to item processor using spring Batch annotation
I am using spring MVC. From my controller, I am calling `jobLauncher` and in `jobLauncher` I am passing job parameters like below and I'm using annotations to enable configuration as below:
```
@Configuration
@EnableBatchProcessing
public... | 1) Put a scope annotation on your data processor i.e.
```
@Scope(value = "step")
```
2) Make a class instance in your data processor and inject the job parameter value by using value annotation :
```
@Value("#{jobParameters['fileName']}")
private String fileName;
```
Your final Data processor class will look like:
... |
41570227 | IF exist for scheduled task | 8 | 2017-01-10 13:38:00 | <p>I have created a batch file to check if scheduled task exists and if they don't create them, however, my if exist rule seem to always hit true even though the jobs are not there.</p>
<p>Any ideas?</p>
<pre><code>::Check Rule
IF EXIST SchTasks /QUERY /TN "Cache Task Morning" (
echo ! Morning rule in place!
... | 21,496 | 7,031,452 | 2017-01-10 17:43:24 | 41,572,561 | 25 | 2017-01-10 15:37:19 | 6,404,553 | 2017-01-10 15:43:39 | https://stackoverflow.com/q/41570227 | https://stackoverflow.com/a/41572561 | <p>You cannot use <code>if exist</code> with <code>schtasks</code>, this is not the purpose of <code>if exist</code>.</p>
<p>use either </p>
<pre><code>schtasks /query /TN "task_name" >NUL 2>&1 || schTasks /Create /SC DAILY /TN "task_name" ...
</code></pre>
<p>or </p>
<pre><code>schtasks /query /TN "task_... | <p>You cannot use <code>if exist</code> with <code>schtasks</code>, this is not the purpose of <code>if exist</code>.</p> <p>use either </p> <pre><code>schtasks /query /TN "task_name" >NUL 2>&1 || schTasks /Create /SC DAILY /TN "task_name" ... </code></pre> <p>or </p> <pre><code>schtasks /query /TN "task_... | 2631, 7002, 25235 | batch-file, cmd, windows-task-scheduler | <h1>IF exist for scheduled task</h1>
<p>I have created a batch file to check if scheduled task exists and if they don't create them, however, my if exist rule seem to always hit true even though the jobs are not there.</p>
<p>Any ideas?</p>
<pre><code>::Check Rule
IF EXIST SchTasks /QUERY /TN "Cache Task Morning" ( ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,753 | cmd | # IF exist for scheduled task
I have created a batch file to check if scheduled task exists and if they don't create them, however, my if exist rule seem to always hit true even though the jobs are not there.
Any ideas?
```
::Check Rule
IF EXIST SchTasks /QUERY /TN "Cache Task Morning" (
echo ! Morning rule in... | You cannot use `if exist` with `schtasks`, this is not the purpose of `if exist`.
use either
```
schtasks /query /TN "task_name" >NUL 2>&1 || schTasks /Create /SC DAILY /TN "task_name" ...
```
or
```
schtasks /query /TN "task_name" >NUL 2>&1
if %errorlevel% NEQ 0 schTasks /Create /SC DAILY /TN "task_name" ...
```
... |
29673524 | How to skip blank lines in CSV using FlatFileItemReader and chunks | 8 | 2015-04-16 11:36:34 | <p>I am processing CSV files using FlatFileItemReader.</p>
<p>Sometimes I am getting blank lines within the input file.</p>
<p>When that happened the whole step stops. I want to skipped those lines and proceed normal.</p>
<p>I tried to add <strong>exception handler</strong> to the step in order to catch the execptio... | 12,174 | 260,511 | 2025-02-11 15:10:59 | 29,697,941 | 25 | 2015-04-17 11:28:07 | 4,617,377 | 2016-10-24 18:15:50 | https://stackoverflow.com/q/29673524 | https://stackoverflow.com/a/29697941 | <p>We created custom <code>SimpleRecordSeparatorPolicy</code> which is telling reader to skip blank lines. That way we read 100 records, i.e. 3 are blank lines and those are ignored without exception and it writes 97 records.</p>
<p>Here is code:</p>
<pre><code>package com.my.package;
import org.springframework.batc... | <p>We created custom <code>SimpleRecordSeparatorPolicy</code> which is telling reader to skip blank lines. That way we read 100 records, i.e. 3 are blank lines and those are ignored without exception and it writes 97 records.</p> <p>Here is code:</p> <pre><code>package com.my.package; import org.springframework.batc... | 73, 1211, 41895, 70274 | csv, spring, spring-batch, spring-batch-admin | <h1>How to skip blank lines in CSV using FlatFileItemReader and chunks</h1>
<p>I am processing CSV files using FlatFileItemReader.</p>
<p>Sometimes I am getting blank lines within the input file.</p>
<p>When that happened the whole step stops. I want to skipped those lines and proceed normal.</p>
<p>I tried to add <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,754 | cmd | # How to skip blank lines in CSV using FlatFileItemReader and chunks
I am processing CSV files using FlatFileItemReader.
Sometimes I am getting blank lines within the input file.
When that happened the whole step stops. I want to skipped those lines and proceed normal.
I tried to add **exception handler** to the st... | We created custom `SimpleRecordSeparatorPolicy` which is telling reader to skip blank lines. That way we read 100 records, i.e. 3 are blank lines and those are ignored without exception and it writes 97 records.
Here is code:
```
package com.my.package;
import org.springframework.batch.item.file.separator.SimpleReco... |
27375153 | Kill a windows service using its Service Name | 8 | 2014-12-09 09:14:42 | <p>I am looking for a way to kill a windows services using its service name rather than the process name, or PID. The two obvious choices are pskill or taskkill, but I cannot seem to find a way of using either of these methods to kill the service by name. </p>
<p>Is it possible to do it by the service name? If so, is ... | 53,142 | 2,317,406 | 2020-03-04 00:30:15 | 27,375,510 | 25 | 2014-12-09 09:32:32 | 4,158,862 | 2014-12-09 09:32:32 | https://stackoverflow.com/q/27375153 | https://stackoverflow.com/a/27375510 | <p>You can use taskkill to filter by service name and kill the service you're looking for.</p>
<pre><code>taskkill /F /FI "SERVICES eq yourservice"
</code></pre>
| <p>You can use taskkill to filter by service name and kill the service you're looking for.</p> <pre><code>taskkill /F /FI "SERVICES eq yourservice" </code></pre> | 64, 7002 | batch-file, windows | <h1>Kill a windows service using its Service Name</h1>
<p>I am looking for a way to kill a windows services using its service name rather than the process name, or PID. The two obvious choices are pskill or taskkill, but I cannot seem to find a way of using either of these methods to kill the service by name. </p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,755 | cmd | # Kill a windows service using its Service Name
I am looking for a way to kill a windows services using its service name rather than the process name, or PID. The two obvious choices are pskill or taskkill, but I cannot seem to find a way of using either of these methods to kill the service by name.
Is it possible to... | You can use taskkill to filter by service name and kill the service you're looking for.
```
taskkill /F /FI "SERVICES eq yourservice"
``` |
1762851 | Batch delayed expansion not working | 6 | 2009-11-19 12:07:30 | <p>Ok, I'm getting crazy and I don't know what else to do, I've tried several things and nothing is working.</p>
<p>Look at this sample code (test.cmd):</p>
<pre><code>setlocal enabledelayedexpansion enableextensions
set VAR=before
if "%VAR%" == "before" (
set VAR=after;
if "%VAR%" == "after" @echo If you see... | 17,384 | 214,543 | 2018-11-08 06:47:40 | 1,762,915 | 25 | 2009-11-19 12:21:27 | 23,252 | 2009-11-19 12:21:27 | https://stackoverflow.com/q/1762851 | https://stackoverflow.com/a/1762915 | <p>You have to use <code>!var!</code> for delayed expansion. <code>%var%</code> is always expanded on parse stage.</p>
<p>I.e., change your code to</p>
<pre><code>setlocal enabledelayedexpansion enableextensions
set VAR=before
if "%VAR%" == "before" (
set VAR=after
if "!VAR!" == "after" @echo If you see this,... | <p>You have to use <code>!var!</code> for delayed expansion. <code>%var%</code> is always expanded on parse stage.</p> <p>I.e., change your code to</p> <pre><code>setlocal enabledelayedexpansion enableextensions set VAR=before if "%VAR%" == "before" ( set VAR=after if "!VAR!" == "after" @echo If you see this,... | 64, 7002, 19675 | batch-file, delayedvariableexpansion, windows | <h1>Batch delayed expansion not working</h1>
<p>Ok, I'm getting crazy and I don't know what else to do, I've tried several things and nothing is working.</p>
<p>Look at this sample code (test.cmd):</p>
<pre><code>setlocal enabledelayedexpansion enableextensions
set VAR=before
if "%VAR%" == "before" (
set VAR=afte... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,756 | cmd | # Batch delayed expansion not working
Ok, I'm getting crazy and I don't know what else to do, I've tried several things and nothing is working.
Look at this sample code (test.cmd):
```
setlocal enabledelayedexpansion enableextensions
set VAR=before
if "%VAR%" == "before" (
set VAR=after;
if "%VAR%" == "after... | You have to use `!var!` for delayed expansion. `%var%` is always expanded on parse stage.
I.e., change your code to
```
setlocal enabledelayedexpansion enableextensions
set VAR=before
if "%VAR%" == "before" (
set VAR=after
if "!VAR!" == "after" @echo If you see this, it worked
)
``` |
17605406 | How can I check if a variable contains another variable within a windows batch file? | 22 | 2013-07-11 23:46:55 | <p>Assuming the following batch file</p>
<pre><code>set variable1=this is variable1
set variable2=is
set variable3=test
if variable1 contains variable2 (
echo YES
) else (
echo NO
)
if variable1 contains variable3 (
echo YES
) else (
echo NO
)
</code></pre>
<p>I want the output to be a YES followed ... | 28,603 | 384,853 | 2022-11-30 21:28:10 | 17,605,407 | 24 | 2013-07-11 23:46:55 | 384,853 | 2015-09-10 08:02:17 | https://stackoverflow.com/q/17605406 | https://stackoverflow.com/a/17605407 | <p>I've resolved this with the following</p>
<pre><code>setLocal EnableDelayedExpansion
set variable1=this is variable1
set variable2=is
set variable3=test
if not "x!variable1:%variable2%=!"=="x%variable1%" (
echo YES
) else (
echo NO
)
if not "x!variable1:%variable3%=!"=="x%variable1%" (
echo YES
) els... | <p>I've resolved this with the following</p> <pre><code>setLocal EnableDelayedExpansion set variable1=this is variable1 set variable2=is set variable3=test if not "x!variable1:%variable2%=!"=="x%variable1%" ( echo YES ) else ( echo NO ) if not "x!variable1:%variable3%=!"=="x%variable1%" ( echo YES ) els... | 64, 7002 | batch-file, windows | <h1>How can I check if a variable contains another variable within a windows batch file?</h1>
<p>Assuming the following batch file</p>
<pre><code>set variable1=this is variable1
set variable2=is
set variable3=test
if variable1 contains variable2 (
echo YES
) else (
echo NO
)
if variable1 contains variable3 (... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,758 | cmd | # How can I check if a variable contains another variable within a windows batch file?
Assuming the following batch file
```
set variable1=this is variable1
set variable2=is
set variable3=test
if variable1 contains variable2 (
echo YES
) else (
echo NO
)
if variable1 contains variable3 (
echo YES
) else... | I've resolved this with the following
```
setLocal EnableDelayedExpansion
set variable1=this is variable1
set variable2=is
set variable3=test
if not "x!variable1:%variable2%=!"=="x%variable1%" (
echo YES
) else (
echo NO
)
if not "x!variable1:%variable3%=!"=="x%variable1%" (
echo YES
) else (
echo N... |
3227796 | Exit batch script from inside a function | 20 | 2010-07-12 10:50:51 | <p>I have a problem with my batch file.
It builds several programs automatically by doing something like this:</p>
<ul>
<li>set some compilation flags</li>
<li>run 'gmake all'</li>
<li>call the "check error level" function and if errorlevel 1, exit</li>
</ul>
<p>So it looks like this:</p>
<pre><code>set FLAG=1
...
g... | 20,218 | 389,405 | 2021-08-26 21:29:12 | 25,474,648 | 24 | 2014-08-24 17:58:22 | 1,012,053 | 2015-07-16 04:38:03 | https://stackoverflow.com/q/3227796 | https://stackoverflow.com/a/25474648 | <p>Using a fatal syntax error, as jeb demonstrates, does kill all batch processing, but it also has a nasty side effect - environment changes after SETLOCAL are preserved, even though they are supposed to be discarded via implicit ENDLOCAL when batch processing ends. See my DosTips post <a href="http://www.dostips.com/... | <p>Using a fatal syntax error, as jeb demonstrates, does kill all batch processing, but it also has a nasty side effect - environment changes after SETLOCAL are preserved, even though they are supposed to be discarded via implicit ENDLOCAL when batch processing ends. See my DosTips post <a href="http://www.dostips.com/... | 64, 5569, 7002, 10871 | batch-file, exit, function, windows | <h1>Exit batch script from inside a function</h1>
<p>I have a problem with my batch file.
It builds several programs automatically by doing something like this:</p>
<ul>
<li>set some compilation flags</li>
<li>run 'gmake all'</li>
<li>call the "check error level" function and if errorlevel 1, exit</li>
</ul>
<p>So it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,759 | cmd | # Exit batch script from inside a function
I have a problem with my batch file.
It builds several programs automatically by doing something like this:
- set some compilation flags
- run 'gmake all'
- call the "check error level" function and if errorlevel 1, exit
So it looks like this:
```
set FLAG=1
...
gmake all
... | Using a fatal syntax error, as jeb demonstrates, does kill all batch processing, but it also has a nasty side effect - environment changes after SETLOCAL are preserved, even though they are supposed to be discarded via implicit ENDLOCAL when batch processing ends. See my DosTips post [SETLOCAL continues after batch ter... |
10124299 | How do I terminate a process tree? | 19 | 2012-04-12 13:12:22 | <p>I am using <code>Runtime.getRuntime().exec()</code> command to start a batch file which in turn starts another process for windows platform.</p>
<pre><code>javaw.exe(Process1)
|___xyz.bat(Process2)
|___javaw.exe(Process3)
</code></pre>
<p><code>Runtime.getRuntime().exec()</code> returns a <code>Process</cod... | 11,744 | 1,278,657 | 2024-07-16 15:58:03 | 10,124,625 | 24 | 2012-04-12 13:30:33 | 441,899 | 2015-12-10 20:05:45 | https://stackoverflow.com/q/10124299 | https://stackoverflow.com/a/10124625 | <p>This is not possible using the standard Java API (see edit at end of the post for an update that changes this). You will need some native code of some variety. Using JNA, I've used code that looks like this:</p>
<pre><code>public class Win32Process
{
WinNT.HANDLE handle;
int pid;
Win32Process (int pi... | <p>This is not possible using the standard Java API (see edit at end of the post for an update that changes this). You will need some native code of some variety. Using JNA, I've used code that looks like this:</p> <pre><code>public class Win32Process { WinNT.HANDLE handle; int pid; Win32Process (int pi... | 17, 64, 2631, 5910, 7002 | batch-file, cmd, java, process, windows | <h1>How do I terminate a process tree?</h1>
<p>I am using <code>Runtime.getRuntime().exec()</code> command to start a batch file which in turn starts another process for windows platform.</p>
<pre><code>javaw.exe(Process1)
|___xyz.bat(Process2)
|___javaw.exe(Process3)
</code></pre>
<p><code>Runtime.getRuntime(... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,760 | cmd | # How do I terminate a process tree?
I am using `Runtime.getRuntime().exec()` command to start a batch file which in turn starts another process for windows platform.
```
javaw.exe(Process1)
|___xyz.bat(Process2)
|___javaw.exe(Process3)
```
`Runtime.getRuntime().exec()` returns a `Process` object which has ... | This is not possible using the standard Java API (see edit at end of the post for an update that changes this). You will need some native code of some variety. Using JNA, I've used code that looks like this:
```
public class Win32Process
{
WinNT.HANDLE handle;
int pid;
Win32Process (int pid) throws IOExce... |
26963444 | Django create superuser from batch file | 18 | 2014-11-16 23:43:39 | <p>I'm trying to make a batch file that runs syncdb to create a database file, and then create a superuser with the username "admin" and the password "admin". </p>
<p>My code so far:</p>
<pre><code>python manage.py syncdb --noinput
python manage.py createsuperuser --username admin --email admin@exmaple.com
python ma... | 21,097 | 4,259,260 | 2021-02-10 05:41:53 | 26,963,549 | 24 | 2014-11-16 23:58:49 | 2,255,491 | 2014-11-17 00:23:04 | https://stackoverflow.com/q/26963444 | https://stackoverflow.com/a/26963549 | <p>As it seems you can't provide a password with the <code>echo ''stuff | cmd</code>, the only way I see to do it is to create it in Python:</p>
<pre><code>python manage.py syncdb --noinput
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@example.com', 'pass')" | python ... | <p>As it seems you can't provide a password with the <code>echo ''stuff | cmd</code>, the only way I see to do it is to create it in Python:</p> <pre><code>python manage.py syncdb --noinput echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@example.com', 'pass')" | python ... | 243, 2631, 7002, 9938 | batch-file, cmd, command-prompt, django | <h1>Django create superuser from batch file</h1>
<p>I'm trying to make a batch file that runs syncdb to create a database file, and then create a superuser with the username "admin" and the password "admin". </p>
<p>My code so far:</p>
<pre><code>python manage.py syncdb --noinput
python manage.py createsuperuser --us... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,761 | cmd | # Django create superuser from batch file
I'm trying to make a batch file that runs syncdb to create a database file, and then create a superuser with the username "admin" and the password "admin".
My code so far:
```
python manage.py syncdb --noinput
python manage.py createsuperuser --username admin --email admin@e... | As it seems you can't provide a password with the `echo ''stuff | cmd`, the only way I see to do it is to create it in Python:
```
python manage.py syncdb --noinput
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@example.com', 'pass')" | python manage.py shell
python ma... |
21765178 | How to pass a variable as an argument to a CasperJS script through the command line? | 18 | 2014-02-13 20:49:11 | <p>I'm using PhantomJs, CasperJs, and Js in a js file ran through the cmd.</p>
<p>Imagine we had two files(test1.js, and test2.js). Both files have a url/site variable that directs the test to a particular address. Everytime an environment changed or the target location changed, we would need to update this variable.<... | 10,967 | null | 2019-06-12 15:37:14 | 21,765,253 | 24 | 2014-02-13 20:53:26 | 468,793 | 2015-11-17 21:54:05 | https://stackoverflow.com/q/21765178 | https://stackoverflow.com/a/21765253 | <p>The <a href="http://docs.casperjs.org/en/latest/cli.html">documentation</a> says you can pass command-line parameters.</p>
<blockquote>
<p>CasperJS ships with a built-in command line parser on top of
PhantomJS’ one, located in the <code>cli</code> module; it exposes passed arguments
as positional ones and nam... | <p>The <a href="http://docs.casperjs.org/en/latest/cli.html">documentation</a> says you can pass command-line parameters.</p> <blockquote> <p>CasperJS ships with a built-in command line parser on top of PhantomJS’ one, located in the <code>cli</code> module; it exposes passed arguments as positional ones and nam... | 3, 820, 2631, 68203, 78879 | casperjs, cmd, javascript, jquery, phantomjs | <h1>How to pass a variable as an argument to a CasperJS script through the command line?</h1>
<p>I'm using PhantomJs, CasperJs, and Js in a js file ran through the cmd.</p>
<p>Imagine we had two files(test1.js, and test2.js). Both files have a url/site variable that directs the test to a particular address. Everytime ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,762 | cmd | # How to pass a variable as an argument to a CasperJS script through the command line?
I'm using PhantomJs, CasperJs, and Js in a js file ran through the cmd.
Imagine we had two files(test1.js, and test2.js). Both files have a url/site variable that directs the test to a particular address. Everytime an environment c... | The [documentation](http://docs.casperjs.org/en/latest/cli.html) says you can pass command-line parameters.
> CasperJS ships with a built-in command line parser on top of
> PhantomJS’ one, located in the `cli` module; it exposes passed arguments
> as positional ones and named options
>
> But no worries for manipulatin... |
11177419 | Batch file: GOTO in a FOR loop | 17 | 2012-06-24 12:26:20 | <p>I have a batch file with a FOR loop. In the loop I must wait for a process to end, for which I used IF and GOTO. The problem is the GOTO is breaking the loop. I tried to find other solutions but I didn't find anything. How can it be done?</p>
<pre><code>@echo off
for /f "tokens=*" %%a in (file.txt) do (
bl... | 39,719 | 1,447,199 | 2021-09-16 09:03:12 | 11,177,449 | 24 | 2012-06-24 12:33:36 | 463,115 | 2021-09-16 09:02:49 | https://stackoverflow.com/q/11177419 | https://stackoverflow.com/a/11177449 | <p>Inside the loop, you could use a <code>call</code> to a subroutine, there are <code>goto</code>s allowed.<br />
The loop will not be broken by a <code>call</code> to a subroutine.</p>
<pre><code>@echo off
for /f "tokens=*" %%a in (file.txt) do (
bla bla bla
bla bla bla
call :check
)
exit /b
:check
t... | <p>Inside the loop, you could use a <code>call</code> to a subroutine, there are <code>goto</code>s allowed.<br /> The loop will not be broken by a <code>call</code> to a subroutine.</p> <pre><code>@echo off for /f "tokens=*" %%a in (file.txt) do ( bla bla bla bla bla bla call :check ) exit /b :check t... | 64, 2531, 2631, 3996, 7002 | batch-file, cmd, for-loop, goto, windows | <h1>Batch file: GOTO in a FOR loop</h1>
<p>I have a batch file with a FOR loop. In the loop I must wait for a process to end, for which I used IF and GOTO. The problem is the GOTO is breaking the loop. I tried to find other solutions but I didn't find anything. How can it be done?</p>
<pre><code>@echo off
for /f "... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,763 | cmd | # Batch file: GOTO in a FOR loop
I have a batch file with a FOR loop. In the loop I must wait for a process to end, for which I used IF and GOTO. The problem is the GOTO is breaking the loop. I tried to find other solutions but I didn't find anything. How can it be done?
```
@echo off
for /f "tokens=*" %%a in (file.t... | Inside the loop, you could use a `call` to a subroutine, there are `goto`s allowed.
The loop will not be broken by a `call` to a subroutine.
```
@echo off
for /f "tokens=*" %%a in (file.txt) do (
bla bla bla
bla bla bla
call :check
)
exit /b
:check
tasklist /FI "IMAGENAME eq prog.exe" 2>NUL | find /I /N "prog... |
10261521 | How to run DOS/CMD/Command Prompt commands from VB.NET? | 17 | 2012-04-21 17:55:12 | <p>The question is self-explanatory. It would be great if the code was one line long (something to do with "<code>Process.Start("...")</code>"?). I researched the web but only found old examples and such ones that do not work (at least for me). I want to use this in my class library, to run Git commands (if that helps?... | 174,326 | null | 2019-05-16 11:52:27 | 10,263,144 | 24 | 2012-04-21 21:26:00 | 1,197,518 | 2017-01-29 01:57:58 | https://stackoverflow.com/q/10261521 | https://stackoverflow.com/a/10263144 | <p>You could try this method:</p>
<pre><code>Public Class MyUtilities
Shared Sub RunCommandCom(command as String, arguments as String, permanent as Boolean)
Dim p as Process = new Process()
Dim pi as ProcessStartInfo = new ProcessStartInfo()
pi.Arguments = " " + if(permanent = true, "/K"... | <p>You could try this method:</p> <pre><code>Public Class MyUtilities Shared Sub RunCommandCom(command as String, arguments as String, permanent as Boolean) Dim p as Process = new Process() Dim pi as ProcessStartInfo = new ProcessStartInfo() pi.Arguments = " " + if(permanent = true, "/K"... | 41, 1796, 2631 | cmd, command, vb.net | <h1>How to run DOS/CMD/Command Prompt commands from VB.NET?</h1>
<p>The question is self-explanatory. It would be great if the code was one line long (something to do with "<code>Process.Start("...")</code>"?). I researched the web but only found old examples and such ones that do not work (at least for me). I want to ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,764 | cmd | # How to run DOS/CMD/Command Prompt commands from VB.NET?
The question is self-explanatory. It would be great if the code was one line long (something to do with "`Process.Start("...")`"?). I researched the web but only found old examples and such ones that do not work (at least for me). I want to use this in my class... | You could try this method:
```
Public Class MyUtilities
Shared Sub RunCommandCom(command as String, arguments as String, permanent as Boolean)
Dim p as Process = new Process()
Dim pi as ProcessStartInfo = new ProcessStartInfo()
pi.Arguments = " " + if(permanent = true, "/K" , "/C") + " "... |
4137688 | batch file copy contents of 1 file into another | 17 | 2010-11-09 19:35:36 | <p>I am trying to create a bat file to copy the contents of one file and append it to the end of another file. </p>
<p>Say I have a file named <strong>test.txt</strong> and I want to append the contents of test.txt to a file that is already created with the name of <strong>results.txt</strong></p>
<p>How can this be... | 61,107 | 318,724 | 2020-07-01 20:35:10 | 4,137,717 | 24 | 2010-11-09 19:38:06 | 457,352 | 2010-11-09 19:38:06 | https://stackoverflow.com/q/4137688 | https://stackoverflow.com/a/4137717 | <p>You can do <code>type test.txt >> results.txt</code></p>
<p>Also see <a href="http://ss64.com/nt/syntax-redirection.html">this reference at ss64.com</a> for redirection.</p>
<p>Note that <code>TYPE</code> will convert Unicode files to ANSI. If you need to keep files as they are, download the UnxUtils and us... | <p>You can do <code>type test.txt >> results.txt</code></p> <p>Also see <a href="http://ss64.com/nt/syntax-redirection.html">this reference at ss64.com</a> for redirection.</p> <p>Note that <code>TYPE</code> will convert Unicode files to ANSI. If you need to keep files as they are, download the UnxUtils and us... | 2216, 7002 | batch-file, windows-xp | <h1>batch file copy contents of 1 file into another</h1>
<p>I am trying to create a bat file to copy the contents of one file and append it to the end of another file. </p>
<p>Say I have a file named <strong>test.txt</strong> and I want to append the contents of test.txt to a file that is already created with the nam... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,765 | cmd | # batch file copy contents of 1 file into another
I am trying to create a bat file to copy the contents of one file and append it to the end of another file.
Say I have a file named **test.txt** and I want to append the contents of test.txt to a file that is already created with the name of **results.txt**
How can t... | You can do `type test.txt >> results.txt`
Also see [this reference at ss64.com](http://ss64.com/nt/syntax-redirection.html) for redirection.
Note that `TYPE` will convert Unicode files to ANSI. If you need to keep files as they are, download the UnxUtils and use `cat` instead of `type`. |
12314638 | Close a batch file after running the jar file | 16 | 2012-09-07 08:42:11 | <p>I wrote a batch file that runs a jar file. But after it runs the jar file the batch file doesn't close until the jar file is also closed. How can I close the command screen when it opens the jar file?( when the jar file is open I want to close the command screen.)</p>
<p>My batch file :</p>
<pre><code>@echo off
ja... | 16,976 | 1,332,870 | 2016-09-08 23:51:00 | 12,314,649 | 24 | 2012-09-07 08:43:08 | 464,988 | 2012-09-07 08:43:08 | https://stackoverflow.com/q/12314638 | https://stackoverflow.com/a/12314649 | <p>Use the <a href="http://ss64.com/nt/start.html"><code>start</code> command</a> before the rest of the command.</p>
| <p>Use the <a href="http://ss64.com/nt/start.html"><code>start</code> command</a> before the rest of the command.</p> | 64, 4841, 7002 | batch-file, jar, windows | <h1>Close a batch file after running the jar file</h1>
<p>I wrote a batch file that runs a jar file. But after it runs the jar file the batch file doesn't close until the jar file is also closed. How can I close the command screen when it opens the jar file?( when the jar file is open I want to close the command screen... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,767 | cmd | # Close a batch file after running the jar file
I wrote a batch file that runs a jar file. But after it runs the jar file the batch file doesn't close until the jar file is also closed. How can I close the command screen when it opens the jar file?( when the jar file is open I want to close the command screen.)
My ba... | Use the [`start` command](http://ss64.com/nt/start.html) before the rest of the command. |
29249830 | How can I get total physical memory using Windows cmd | 15 | 2015-03-25 07:31:21 | <p>I inquired typeperf counters and instances, but couldn't find anything about the total memory. I only found</p>
<pre><code> \Memory\Availble Bytes
\Memory\Cache Bytes
\Process\Private Bytes
\Process\Working Set
</code></pre>
<p>and adding any combination of them didn't match the total memory in task... | 37,708 | 4,531,512 | 2015-07-28 16:52:33 | 29,250,090 | 24 | 2015-03-25 07:50:26 | 3,536,342 | 2015-07-28 16:52:33 | https://stackoverflow.com/q/29249830 | https://stackoverflow.com/a/29250090 | <h3>How can I get total physical memory</h3>
<p>Use the following command:</p>
<pre><code>wmic ComputerSystem get TotalPhysicalMemory
</code></pre>
<p>Example output:</p>
<pre><code>TotalPhysicalMemory
4275273728
</code></pre>
<hr>
<blockquote>
<p><strong>Total Physical Memory</strong></p>
<pre><code>wmic Comp... | <h3>How can I get total physical memory</h3> <p>Use the following command:</p> <pre><code>wmic ComputerSystem get TotalPhysicalMemory </code></pre> <p>Example output:</p> <pre><code>TotalPhysicalMemory 4275273728 </code></pre> <hr> <blockquote> <p><strong>Total Physical Memory</strong></p> <pre><code>wmic Comp... | 61, 64, 2631 | cmd, memory, windows | <h1>How can I get total physical memory using Windows cmd</h1>
<p>I inquired typeperf counters and instances, but couldn't find anything about the total memory. I only found</p>
<pre><code> \Memory\Availble Bytes
\Memory\Cache Bytes
\Process\Private Bytes
\Process\Working Set
</code></pre>
<p>and addin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,768 | cmd | # How can I get total physical memory using Windows cmd
I inquired typeperf counters and instances, but couldn't find anything about the total memory. I only found
```
\Memory\Availble Bytes
\Memory\Cache Bytes
\Process\Private Bytes
\Process\Working Set
```
and adding any combination of them didn't ... | ### How can I get total physical memory
Use the following command:
```
wmic ComputerSystem get TotalPhysicalMemory
```
Example output:
```
TotalPhysicalMemory
4275273728
```
---
> **Total Physical Memory**
>
> ```
> wmic ComputerSystem get TotalPhysicalMemory
> ```
>
> **Available Physical Memory**
>
> ```
> wmic... |
16712795 | Pass arguments from cmd to python script | 15 | 2013-05-23 11:30:38 | <p>I write my scripts in python and run them with cmd by typing in:</p>
<pre><code>C:\> python script.py
</code></pre>
<p>Some of my scripts contain separate algorithms and methods which are called based on a flag.
Now I would like to pass the flag through cmd directly rather than having to go into the script and ... | 69,719 | 2,394,867 | 2024-08-21 16:47:58 | 16,713,986 | 24 | 2013-05-23 12:30:10 | 1,491,200 | 2020-03-04 10:00:39 | https://stackoverflow.com/q/16712795 | https://stackoverflow.com/a/16713986 | <p>There are a few modules specialized in parsing command line arguments: <a href="http://docs.python.org/2/library/getopt.html" rel="noreferrer"><code>getopt</code></a>, <a href="http://docs.python.org/2/library/optparse.html" rel="noreferrer"><code>optparse</code></a> and <a href="http://docs.python.org/2/library/arg... | <p>There are a few modules specialized in parsing command line arguments: <a href="http://docs.python.org/2/library/getopt.html" rel="noreferrer"><code>getopt</code></a>, <a href="http://docs.python.org/2/library/optparse.html" rel="noreferrer"><code>optparse</code></a> and <a href="http://docs.python.org/2/library/arg... | 16, 2631, 31134 | cmd, command-line-arguments, python | <h1>Pass arguments from cmd to python script</h1>
<p>I write my scripts in python and run them with cmd by typing in:</p>
<pre><code>C:\> python script.py
</code></pre>
<p>Some of my scripts contain separate algorithms and methods which are called based on a flag.
Now I would like to pass the flag through cmd dire... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,769 | cmd | # Pass arguments from cmd to python script
I write my scripts in python and run them with cmd by typing in:
```
C:\> python script.py
```
Some of my scripts contain separate algorithms and methods which are called based on a flag.
Now I would like to pass the flag through cmd directly rather than having to go into t... | There are a few modules specialized in parsing command line arguments: [`getopt`](http://docs.python.org/2/library/getopt.html), [`optparse`](http://docs.python.org/2/library/optparse.html) and [`argparse`](http://docs.python.org/2/library/argparse.html). `optparse` is deprecated, and `getopt` is less powerful than `ar... |
41271606 | What is the function of JobBuilderFactory.get(job).incrementer(RunIdIncrementer)? | 14 | 2016-12-21 20:46:04 | <p>I'm developing a Spring-Batch project using Spring-Boot and everything is going along nicely. I've done a few spring-batch examples (including some from spring.io), but I'm not sure what some of the stuff does, and "it just works" doesn't satiate me.</p>
<p>My spring boot main class implements <code>CommandLineRunn... | 23,262 | 3,491,770 | 2023-08-20 12:23:09 | 41,368,027 | 24 | 2016-12-28 18:51:01 | 618,059 | 2023-08-20 12:23:09 | https://stackoverflow.com/q/41271606 | https://stackoverflow.com/a/41368027 | <p>This isn't a "Boot thing" as much as it is a "Batch thing". Spring Batch has the rule that a <code>JobInstance</code> can only be run once to completion. This means that for each combination of identifying job parameters, you can only have one <code>JobExecution</code> that results in <code>COM... | <p>This isn't a "Boot thing" as much as it is a "Batch thing". Spring Batch has the rule that a <code>JobInstance</code> can only be run once to completion. This means that for each combination of identifying job parameters, you can only have one <code>JobExecution</code> that results in <code>COM... | 17, 1211, 41895, 95875 | java, spring, spring-batch, spring-boot | <h1>What is the function of JobBuilderFactory.get(job).incrementer(RunIdIncrementer)?</h1>
<p>I'm developing a Spring-Batch project using Spring-Boot and everything is going along nicely. I've done a few spring-batch examples (including some from spring.io), but I'm not sure what some of the stuff does, and "it just wo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,771 | cmd | # What is the function of JobBuilderFactory.get(job).incrementer(RunIdIncrementer)?
I'm developing a Spring-Batch project using Spring-Boot and everything is going along nicely. I've done a few spring-batch examples (including some from spring.io), but I'm not sure what some of the stuff does, and "it just works" does... | This isn't a "Boot thing" as much as it is a "Batch thing". Spring Batch has the rule that a `JobInstance` can only be run once to completion. This means that for each combination of identifying job parameters, you can only have one `JobExecution` that results in `COMPLETE`. A `RunIdIncrementer` will append an addition... |
1447703 | Search for files in a batch script and process those files? | 13 | 2009-09-19 04:02:46 | <p>I'm trying to do some things during the pre-build phase of a visual studio project. Specifically, I'm trying to execute some commands on all *.resx files within the project. Here is what I have but it doesn't work when the files/directory path have a space in them. How do I get around these spaces?</p>
<pre><cod... | 51,501 | 120,755 | 2016-08-08 20:04:11 | 1,447,952 | 24 | 2009-09-19 06:29:27 | 73,070 | 2009-09-19 06:29:27 | https://stackoverflow.com/q/1447703 | https://stackoverflow.com/a/1447952 | <p>You know that <code>for</code> can also run recursively over directories?</p>
<pre><code>for /r %%x in (*.resx) do echo "%%x"
</code></pre>
<p>Much easier than fiddling with delimiters and saves you from running <code>dir</code>.</p>
| <p>You know that <code>for</code> can also run recursively over directories?</p> <pre><code>for /r %%x in (*.resx) do echo "%%x" </code></pre> <p>Much easier than fiddling with delimiters and saves you from running <code>dir</code>.</p> | 2631, 7002 | batch-file, cmd | <h1>Search for files in a batch script and process those files?</h1>
<p>I'm trying to do some things during the pre-build phase of a visual studio project. Specifically, I'm trying to execute some commands on all *.resx files within the project. Here is what I have but it doesn't work when the files/directory path ha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,773 | cmd | # Search for files in a batch script and process those files?
I'm trying to do some things during the pre-build phase of a visual studio project. Specifically, I'm trying to execute some commands on all *.resx files within the project. Here is what I have but it doesn't work when the files/directory path have a space ... | You know that `for` can also run recursively over directories?
```
for /r %%x in (*.resx) do echo "%%x"
```
Much easier than fiddling with delimiters and saves you from running `dir`. |
24233821 | Skippable exception classes for Spring Batch with java based configuration | 12 | 2014-06-15 20:27:58 | <p>I configure a step in XML like this:</p>
<pre><code><batch:step id="slaveStep">
<batch:tasklet>
<batch:chunk
reader="reader"
processor="processor"
writer="writer"
commit-interval="10"
... | 11,741 | 1,198,176 | 2015-12-11 04:59:38 | 24,237,547 | 24 | 2014-06-16 06:11:40 | 2,587,166 | 2014-06-16 06:11:40 | https://stackoverflow.com/q/24233821 | https://stackoverflow.com/a/24237547 | <p>You need to build up a <code>FaultTolerantStepBuilder</code> using <code>StepBuilder.faultTolerant</code> method.</p>
<pre><code>return stepBuilder()
.chunk()
.faultTolerant()
.skip(MyException.class)
.skipLimit(100000)
.build()
</code></pre>
| <p>You need to build up a <code>FaultTolerantStepBuilder</code> using <code>StepBuilder.faultTolerant</code> method.</p> <pre><code>return stepBuilder() .chunk() .faultTolerant() .skip(MyException.class) .skipLimit(100000) .build() </code></pre> | 17, 1211, 41895, 97195 | java, spring, spring-batch, spring-java-config | <h1>Skippable exception classes for Spring Batch with java based configuration</h1>
<p>I configure a step in XML like this:</p>
<pre><code><batch:step id="slaveStep">
<batch:tasklet>
<batch:chunk
reader="reader"
processor="processor"
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,775 | cmd | # Skippable exception classes for Spring Batch with java based configuration
I configure a step in XML like this:
```
<batch:step id="slaveStep">
<batch:tasklet>
<batch:chunk
reader="reader"
processor="processor"
writer="writer"
... | You need to build up a `FaultTolerantStepBuilder` using `StepBuilder.faultTolerant` method.
```
return stepBuilder()
.chunk()
.faultTolerant()
.skip(MyException.class)
.skipLimit(100000)
.build()
``` |
8836368 | Windows batch file - how to loop through files in a directory? | 12 | 2012-01-12 14:06:11 | <p>I have this batch:</p>
<pre><code>for /f %%a IN ('dir /b *.pdf') do call convert.exe %%a
</code></pre>
<p>This gets every pdf file thats in the same folder as convert.exe. I want to be able to say where the PDF resides. What do I have to change? </p>
<p>Thanks!</p>
| 49,697 | 1,127,709 | 2012-01-12 14:14:32 | 8,836,401 | 24 | 2012-01-12 14:08:55 | 625,594 | 2012-01-12 14:14:32 | https://stackoverflow.com/q/8836368 | https://stackoverflow.com/a/8836401 | <p>If the directory name can be hardcoded, then it will be </p>
<pre><code>for /f %%a IN ('dir /b /s "Disk:\Your\Directory\Name\*.pdf"') do call convert.exe %%a
</code></pre>
<p>Note that this will also return all .pdf files in subdirectories of Disk:\Your\Directory\Name.</p>
| <p>If the directory name can be hardcoded, then it will be </p> <pre><code>for /f %%a IN ('dir /b /s "Disk:\Your\Directory\Name\*.pdf"') do call convert.exe %%a </code></pre> <p>Note that this will also return all .pdf files in subdirectories of Disk:\Your\Directory\Name.</p> | 2531, 7002 | batch-file, for-loop | <h1>Windows batch file - how to loop through files in a directory?</h1>
<p>I have this batch:</p>
<pre><code>for /f %%a IN ('dir /b *.pdf') do call convert.exe %%a
</code></pre>
<p>This gets every pdf file thats in the same folder as convert.exe. I want to be able to say where the PDF resides. What do I have to chang... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,776 | cmd | # Windows batch file - how to loop through files in a directory?
I have this batch:
```
for /f %%a IN ('dir /b *.pdf') do call convert.exe %%a
```
This gets every pdf file thats in the same folder as convert.exe. I want to be able to say where the PDF resides. What do I have to change?
Thanks! | If the directory name can be hardcoded, then it will be
```
for /f %%a IN ('dir /b /s "Disk:\Your\Directory\Name\*.pdf"') do call convert.exe %%a
```
Note that this will also return all .pdf files in subdirectories of Disk:\Your\Directory\Name. |
5109897 | Multiple do commands in a for loop: Echoing a string to a file and then redirecting to the command window | 12 | 2011-02-24 20:13:31 | <p>I am trying to write a batch file to iteratively execute a fortran compiled executable. Normally one would go to the windows command prompt, type 'Model.exe'. This would bring up a dos command window asking the user to type a required file name directly in to the command window at the dos prompt. </p>
<p>I want to... | 42,015 | 633,048 | 2014-06-11 17:09:07 | 5,110,156 | 24 | 2011-02-24 20:38:32 | 599,792 | 2011-02-24 20:38:32 | https://stackoverflow.com/q/5109897 | https://stackoverflow.com/a/5110156 | <p>Ugh, cmd.exe's treatment of variable expansion is ugly. So, you need "delayed expansion", as follows:</p>
<pre><code>setlocal enabledelayedexpansion
for /L %%i in (1,1,10) do (
set str=Sim%%i
echo !str! > input.txt
Model.exe < input.txt)
endlocal
</code></pre>
<p>(Of course in this particular case you could ... | <p>Ugh, cmd.exe's treatment of variable expansion is ugly. So, you need "delayed expansion", as follows:</p> <pre><code>setlocal enabledelayedexpansion for /L %%i in (1,1,10) do ( set str=Sim%%i echo !str! > input.txt Model.exe < input.txt) endlocal </code></pre> <p>(Of course in this particular case you could ... | 2531, 5370, 7002, 31901 | batch-file, dos, for-loop, http-redirect | <h1>Multiple do commands in a for loop: Echoing a string to a file and then redirecting to the command window</h1>
<p>I am trying to write a batch file to iteratively execute a fortran compiled executable. Normally one would go to the windows command prompt, type 'Model.exe'. This would bring up a dos command window a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,777 | cmd | # Multiple do commands in a for loop: Echoing a string to a file and then redirecting to the command window
I am trying to write a batch file to iteratively execute a fortran compiled executable. Normally one would go to the windows command prompt, type 'Model.exe'. This would bring up a dos command window asking the ... | Ugh, cmd.exe's treatment of variable expansion is ugly. So, you need "delayed expansion", as follows:
```
setlocal enabledelayedexpansion
for /L %%i in (1,1,10) do (
set str=Sim%%i
echo !str! > input.txt
Model.exe < input.txt)
endlocal
```
(Of course in this particular case you could just say `echo Sim%%i > input.txt... |
4587608 | Best way to insert a good amount of records in hibernate | 12 | 2011-01-03 19:30:52 | <p>I'm using hibernate + play! framework at work, is there a "best practice" on inserting a good amount of records using hibernate? They are around 6,000 to 10,000 per text file so I don't know if Hibernate is going to choke on the job or throw an exception.</p>
<p>Any suggestion let me know, let me know if I have to ... | 25,862 | 133,055 | 2016-03-28 11:59:23 | 4,587,732 | 24 | 2011-01-03 19:46:17 | 199,148 | 2016-03-28 11:59:23 | https://stackoverflow.com/q/4587608 | https://stackoverflow.com/a/4587732 | <p>From *Java Persistence and Hibernate" (Manning) and following a comment from Pangea, use a stateless session (which doesn't have a persistence context cache) :</p>
<pre><code>StatelessSession session = sessionFactory.openStatelessSession();
Transaction tx = session.beginTransaction();
for ( int i=0; i<100000; i+... | <p>From *Java Persistence and Hibernate" (Manning) and following a comment from Pangea, use a stateless session (which doesn't have a persistence context cache) :</p> <pre><code>StatelessSession session = sessionFactory.openStatelessSession(); Transaction tx = session.beginTransaction(); for ( int i=0; i<100000; i+... | 17, 2620, 30645 | batch-processing, hibernate, java | <h1>Best way to insert a good amount of records in hibernate</h1>
<p>I'm using hibernate + play! framework at work, is there a "best practice" on inserting a good amount of records using hibernate? They are around 6,000 to 10,000 per text file so I don't know if Hibernate is going to choke on the job or throw an except... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,778 | cmd | # Best way to insert a good amount of records in hibernate
I'm using hibernate + play! framework at work, is there a "best practice" on inserting a good amount of records using hibernate? They are around 6,000 to 10,000 per text file so I don't know if Hibernate is going to choke on the job or throw an exception.
Any... | From *Java Persistence and Hibernate" (Manning) and following a comment from Pangea, use a stateless session (which doesn't have a persistence context cache) :
```
StatelessSession session = sessionFactory.openStatelessSession();
Transaction tx = session.beginTransaction();
for ( int i=0; i<100000; i++ ) {
Item it... |
2513682 | How can I pause the console window in .pl and .bat file? | 12 | 2010-03-25 07:18:25 | <p>As I know, when I run <strong>cs myConsoleApp.cs</strong> from windows command line, I can pause the Console Window by add the code below:</p>
<p><code>Console.ReadLine();</code></p>
<p>Then How can I pause Console Window in myConsoleApp.pl and myConsoleApp.bat? I just want to monitor the running result from the C... | 24,460 | 215,912 | 2012-09-28 11:55:31 | 2,513,717 | 24 | 2010-03-25 07:27:38 | 13,467 | 2010-03-25 07:27:38 | https://stackoverflow.com/q/2513682 | https://stackoverflow.com/a/2513717 | <p><code>pause</code> for .bat</p>
<p>and</p>
<pre><code><>; #Read from STDIN
</code></pre>
<p>for Perl</p>
| <p><code>pause</code> for .bat</p> <p>and</p> <pre><code><>; #Read from STDIN </code></pre> <p>for Perl</p> | 580, 7002 | batch-file, perl | <h1>How can I pause the console window in .pl and .bat file?</h1>
<p>As I know, when I run <strong>cs myConsoleApp.cs</strong> from windows command line, I can pause the Console Window by add the code below:</p>
<p><code>Console.ReadLine();</code></p>
<p>Then How can I pause Console Window in myConsoleApp.pl and myCo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,779 | cmd | # How can I pause the console window in .pl and .bat file?
As I know, when I run **cs myConsoleApp.cs** from windows command line, I can pause the Console Window by add the code below:
`Console.ReadLine();`
Then How can I pause Console Window in myConsoleApp.pl and myConsoleApp.bat? I just want to monitor the runnin... | `pause` for .bat
and
```
<>; #Read from STDIN
```
for Perl |
39495024 | Persistent history in python cmd module | 10 | 2016-09-14 16:04:19 | <p>Is there any way to configure the <a href="https://docs.python.org/2/library/cmd.html" rel="nofollow">CMD module from Python</a> to keep a persistent history even after the interactive shell has been closed?</p>
<p>When I press the up and down keys I would like to access commands that were previously entered into t... | 4,974 | 6,831,712 | 2022-08-14 21:11:14 | 39,495,060 | 24 | 2016-09-14 16:06:50 | 100,297 | 2016-09-14 16:36:22 | https://stackoverflow.com/q/39495024 | https://stackoverflow.com/a/39495060 | <p><code>readline</code> automatically keeps a history of everything you enter. All you need to add is hooks to load and store that history.</p>
<p>Use <a href="https://docs.python.org/2/library/readline.html#readline.read_history_file" rel="noreferrer"><code>readline.read_history_file(filename)</code></a> to read a h... | <p><code>readline</code> automatically keeps a history of everything you enter. All you need to add is hooks to load and store that history.</p> <p>Use <a href="https://docs.python.org/2/library/readline.html#readline.read_history_file" rel="noreferrer"><code>readline.read_history_file(filename)</code></a> to read a h... | 16, 5686, 10353, 59047, 75832 | python, python-2.7, python-cmd, python-module, readline | <h1>Persistent history in python cmd module</h1>
<p>Is there any way to configure the <a href="https://docs.python.org/2/library/cmd.html" rel="nofollow">CMD module from Python</a> to keep a persistent history even after the interactive shell has been closed?</p>
<p>When I press the up and down keys I would like to ac... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,780 | cmd | # Persistent history in python cmd module
Is there any way to configure the [CMD module from Python](https://docs.python.org/2/library/cmd.html) to keep a persistent history even after the interactive shell has been closed?
When I press the up and down keys I would like to access commands that were previously entered... | `readline` automatically keeps a history of everything you enter. All you need to add is hooks to load and store that history.
Use [`readline.read_history_file(filename)`](https://docs.python.org/2/library/readline.html#readline.read_history_file) to read a history file. Use [`readline.write_history_file()`](https://d... |
33584587 | How to wait all batch files to finish before exiting? | 10 | 2015-11-07 15:48:49 | <p>I have a main batch file than calls 4 other batch files so we can run in parallel.</p>
<p>Example:</p>
<p>Main.bat</p>
<pre><code> start call batch1.bat
start call batch2.bat
start call batch3.bat
start call batch4.bat
exit
</code></pre>
<p>I want the Main.bat to exit after all the batch1 to ... | 11,633 | 4,552,837 | 2020-01-14 11:13:45 | 33,586,872 | 24 | 2015-11-07 19:29:35 | 778,560 | 2017-03-14 02:25:54 | https://stackoverflow.com/q/33584587 | https://stackoverflow.com/a/33586872 | <p>I think this is the simplest and most efficient way:</p>
<pre><code>@echo off
echo %time%
(
start call batch1.bat
start call batch2.bat
start call batch3.bat
start call batch4.bat
) | set /P "="
echo %time%
</code></pre>
<p>In this method the waiting state in the main file is <em>event driven</e... | <p>I think this is the simplest and most efficient way:</p> <pre><code>@echo off echo %time% ( start call batch1.bat start call batch2.bat start call batch3.bat start call batch4.bat ) | set /P "=" echo %time% </code></pre> <p>In this method the waiting state in the main file is <em>event driven</e... | 64, 353, 2631, 7002, 8632 | batch-file, call, cmd, parallel-processing, windows | <h1>How to wait all batch files to finish before exiting?</h1>
<p>I have a main batch file than calls 4 other batch files so we can run in parallel.</p>
<p>Example:</p>
<p>Main.bat</p>
<pre><code> start call batch1.bat
start call batch2.bat
start call batch3.bat
start call batch4.bat
exit
</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,781 | cmd | # How to wait all batch files to finish before exiting?
I have a main batch file than calls 4 other batch files so we can run in parallel.
Example:
Main.bat
```
start call batch1.bat
start call batch2.bat
start call batch3.bat
start call batch4.bat
exit
```
I want the Main.bat to exit after al... | I think this is the simplest and most efficient way:
```
@echo off
echo %time%
(
start call batch1.bat
start call batch2.bat
start call batch3.bat
start call batch4.bat
) | set /P "="
echo %time%
```
In this method the waiting state in the main file is *event driven*, so it does not consume any CPU... |
14211967 | Update a batch of rows with CodeIgniter | 10 | 2013-01-08 09:35:45 | <p>I have been looking around but I have not found an answer yet. Kindly help if you know the answer.</p>
<p>How do you update multiple rows in CI?</p>
<p>In my MySQL:</p>
<p>I have column names:</p>
<pre><code>ID, Settings Name, Settings Value ( Settings Name is Unique )
</code></pre>
<p>I have the ff Data:</p>
... | 42,191 | 1,957,373 | 2025-09-25 08:37:17 | 14,212,183 | 24 | 2013-01-08 09:47:23 | 1,645,076 | 2017-07-01 10:16:41 | https://stackoverflow.com/q/14211967 | https://stackoverflow.com/a/14212183 | <p>Are you using Active record?</p>
<p>Yes there is an update batch: <a href="https://www.codeigniter.com/userguide3/database/query_builder.html#updating-data" rel="noreferrer">$this->db->update_batch();</a></p>
<pre><code>$data = array(
array(
'ID' => 1 ,
'Settings Name' => 'Hello' ,
'Settings Value' =&g... | <p>Are you using Active record?</p> <p>Yes there is an update batch: <a href="https://www.codeigniter.com/userguide3/database/query_builder.html#updating-data" rel="noreferrer">$this->db->update_batch();</a></p> <pre><code>$data = array( array( 'ID' => 1 , 'Settings Name' => 'Hello' , 'Settings Value' =&g... | 5, 3988, 28708, 35561, 65778 | batch-updates, codeigniter, php, query-builder, sql-update | <h1>Update a batch of rows with CodeIgniter</h1>
<p>I have been looking around but I have not found an answer yet. Kindly help if you know the answer.</p>
<p>How do you update multiple rows in CI?</p>
<p>In my MySQL:</p>
<p>I have column names:</p>
<pre><code>ID, Settings Name, Settings Value ( Settings Name is Uni... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,782 | cmd | # Update a batch of rows with CodeIgniter
I have been looking around but I have not found an answer yet. Kindly help if you know the answer.
How do you update multiple rows in CI?
In my MySQL:
I have column names:
```
ID, Settings Name, Settings Value ( Settings Name is Unique )
```
I have the ff Data:
```
ID = ... | Are you using Active record?
Yes there is an update batch: [$this->db->update_batch();](https://www.codeigniter.com/userguide3/database/query_builder.html#updating-data)
```
$data = array(
array(
'ID' => 1 ,
'Settings Name' => 'Hello' ,
'Settings Value' => 'True'
),
array(
'ID' => '2' ,
'Settings Name' => '... |
12785638 | Command for opening serial port in Windows 7 | 10 | 2012-10-08 16:26:30 | <p>Is there a Windows command for opening serial ports, say COM3 via the command prompt in Windows 7? For example:</p>
<pre><code>OPEN "COM6" AS #1
</code></pre>
<p>I cannot use pyserial or any other utilities that are not distributed with Windows 7.</p>
<p><strong>Preferred solution</strong>
<a href="https://stacko... | 80,993 | 181,783 | 2020-03-27 14:33:54 | 12,801,667 | 24 | 2012-10-09 13:53:00 | 1,057,961 | 2012-10-09 13:53:00 | https://stackoverflow.com/q/12785638 | https://stackoverflow.com/a/12801667 | <p>Maybe you can use the Powershell? It's included in Win7... </p>
<p>code taken from here <a href="http://blogs.msdn.com/b/powershell/archive/2006/08/31/writing-and-reading-info-from-serial-ports.aspx" rel="noreferrer">http://blogs.msdn.com/b/powershell/archive/2006/08/31/writing-and-reading-info-from-serial-ports.a... | <p>Maybe you can use the Powershell? It's included in Win7... </p> <p>code taken from here <a href="http://blogs.msdn.com/b/powershell/archive/2006/08/31/writing-and-reading-info-from-serial-ports.aspx" rel="noreferrer">http://blogs.msdn.com/b/powershell/archive/2006/08/31/writing-and-reading-info-from-serial-ports.a... | 64, 2631, 3716, 7002, 34595 | batch-file, cmd, serial-port, windows, windows-7 | <h1>Command for opening serial port in Windows 7</h1>
<p>Is there a Windows command for opening serial ports, say COM3 via the command prompt in Windows 7? For example:</p>
<pre><code>OPEN "COM6" AS #1
</code></pre>
<p>I cannot use pyserial or any other utilities that are not distributed with Windows 7.</p>
<p><stro... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,783 | cmd | # Command for opening serial port in Windows 7
Is there a Windows command for opening serial ports, say COM3 via the command prompt in Windows 7? For example:
```
OPEN "COM6" AS #1
```
I cannot use pyserial or any other utilities that are not distributed with Windows 7.
**Preferred solution**
[Opening a COM port in... | Maybe you can use the Powershell? It's included in Win7...
code taken from here <http://blogs.msdn.com/b/powershell/archive/2006/08/31/writing-and-reading-info-from-serial-ports.aspx>
**Writing to a Serial Port**
```
PS> [System.IO.Ports.SerialPort]::getportnames()
COM3
PS> $port= new-Object System.IO.Ports.SerialPo... |
11706800 | php.exe is not recognized:create webapp | 9 | 2012-07-29 04:58:41 | <p>I am toying with my new install of yii framework, and trying to compile my first webapp through the command line. when I run <code>yiic webapp ../testdrive</code> i receive this error in my console:</p>
<pre><code>"php.exe" is not recognized as an internal or external command, operable program or batch file
</code... | 11,769 | 977,203 | 2015-08-22 19:40:42 | 11,715,726 | 24 | 2012-07-30 05:14:38 | 430,167 | 2012-07-30 05:14:38 | https://stackoverflow.com/q/11706800 | https://stackoverflow.com/a/11715726 | <p>You need to add complete path in your <code>php.exe</code> in `yii\framework\yiic.bat</p>
<p>for example in my case it is if</p>
<p><code>"%PHP_COMMAND%" == "" set PHP_COMMAND=C:\wamp\bin\php\php5.3.8\php.exe</code></p>
| <p>You need to add complete path in your <code>php.exe</code> in `yii\framework\yiic.bat</p> <p>for example in my case it is if</p> <p><code>"%PHP_COMMAND%" == "" set PHP_COMMAND=C:\wamp\bin\php\php5.3.8\php.exe</code></p> | 5, 2631, 26762 | cmd, php, yii | <h1>php.exe is not recognized:create webapp</h1>
<p>I am toying with my new install of yii framework, and trying to compile my first webapp through the command line. when I run <code>yiic webapp ../testdrive</code> i receive this error in my console:</p>
<pre><code>"php.exe" is not recognized as an internal or extern... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,784 | cmd | # php.exe is not recognized:create webapp
I am toying with my new install of yii framework, and trying to compile my first webapp through the command line. when I run `yiic webapp ../testdrive` i receive this error in my console:
```
"php.exe" is not recognized as an internal or external command, operable program or ... | You need to add complete path in your `php.exe` in `yii\framework\yiic.bat
for example in my case it is if
`"%PHP_COMMAND%" == "" set PHP_COMMAND=C:\wamp\bin\php\php5.3.8\php.exe` |
17836416 | Add "django-admin.py" path to command line on Windows 7 | 8 | 2013-07-24 14:08:18 | <p>I've been trying to add the <code>django-admin.py</code> path to command line on Windows 7. </p>
<p>I have tried to do it this way:</p>
<pre><code>C:\>set django-admin.py = C:\Python27\Scripts\django-admin.py
</code></pre>
<p>But <code>cmd</code> told me that:</p>
<pre><code>'django-admin.py' is not recognize... | 61,114 | 2,598,876 | 2022-07-07 10:53:00 | 17,836,439 | 24 | 2013-07-24 14:09:06 | 2,225,682 | 2013-07-24 14:19:03 | https://stackoverflow.com/q/17836416 | https://stackoverflow.com/a/17836439 | <p>Try following command.</p>
<pre><code>set path=%path%;c:\python27\scripts
</code></pre>
<p><code>PATH</code> is set only for the cmd.exe in which you run the above command.</p>
<p><strong>UPDATE</strong></p>
<p>To permanently set PATH:</p>
<ol>
<li>Right click <strong>My computer</strong> in the desktop.</li>
<... | <p>Try following command.</p> <pre><code>set path=%path%;c:\python27\scripts </code></pre> <p><code>PATH</code> is set only for the cmd.exe in which you run the above command.</p> <p><strong>UPDATE</strong></p> <p>To permanently set PATH:</p> <ol> <li>Right click <strong>My computer</strong> in the desktop.</li> <... | 16, 64, 243, 2631, 34595 | cmd, django, python, windows, windows-7 | <h1>Add "django-admin.py" path to command line on Windows 7</h1>
<p>I've been trying to add the <code>django-admin.py</code> path to command line on Windows 7. </p>
<p>I have tried to do it this way:</p>
<pre><code>C:\>set django-admin.py = C:\Python27\Scripts\django-admin.py
</code></pre>
<p>But <code>cmd</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,785 | cmd | # Add "django-admin.py" path to command line on Windows 7
I've been trying to add the `django-admin.py` path to command line on Windows 7.
I have tried to do it this way:
```
C:\>set django-admin.py = C:\Python27\Scripts\django-admin.py
```
But `cmd` told me that:
```
'django-admin.py' is not recognized as an inte... | Try following command.
```
set path=%path%;c:\python27\scripts
```
`PATH` is set only for the cmd.exe in which you run the above command.
**UPDATE**
To permanently set PATH:
1. Right click **My computer** in the desktop.
2. Click **Advanced System Settings** on the left.
3. Click **Environmental Variable**.
4. Add... |
61419086 | Fatal error in launcher: Unable to create process using "file path1" file path2" : The system cannot find the file specified | 7 | 2020-04-24 23:41:19 | <p>I am trying to use different versions of Python on my Windows pc and I'm getting this error when using <code>pip</code>:</p>
<blockquote>
<p>Fatal error in launcher: Unable to create process using '"c:\users\mypc\appdata\local\programs\python\python38\python.exe" "C:\Python38\Scripts\pip.exe" ':... | 25,333 | 10,343,353 | 2021-07-28 14:27:31 | 62,190,111 | 24 | 2020-06-04 08:28:24 | 11,818,952 | 2021-02-06 07:21:50 | https://stackoverflow.com/q/61419086 | https://stackoverflow.com/a/62190111 | <p>it seems like python team may have implemented some security measures.
The new method now is just to prefix <code>python -m</code> before your commands.</p>
<p>Let's say you are trying to install pygame (any package) with pip. For that, you'll use</p>
<pre><code>python -m pip install pygame //Or any package name
</c... | <p>it seems like python team may have implemented some security measures. The new method now is just to prefix <code>python -m</code> before your commands.</p> <p>Let's say you are trying to install pygame (any package) with pip. For that, you'll use</p> <pre><code>python -m pip install pygame //Or any package name </c... | 16, 2631, 5119, 60010 | cmd, pip, python, python-3.x | <h1>Fatal error in launcher: Unable to create process using "file path1" file path2" : The system cannot find the file specified</h1>
<p>I am trying to use different versions of Python on my Windows pc and I'm getting this error when using <code>pip</code>:</p>
<blockquote>
<p>Fatal error in launcher: Unable to create ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,786 | cmd | # Fatal error in launcher: Unable to create process using "file path1" file path2" : The system cannot find the file specified
I am trying to use different versions of Python on my Windows pc and I'm getting this error when using `pip`:
> Fatal error in launcher: Unable to create process using '"c:\users\mypc\appdata... | it seems like python team may have implemented some security measures.
The new method now is just to prefix `python -m` before your commands.
Let's say you are trying to install pygame (any package) with pip. For that, you'll use
```
python -m pip install pygame //Or any package name
```
Also, upgrading pip and all ... |
12725322 | Alter folder permission in windows command line? | 7 | 2012-10-04 10:31:06 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2928738/how-to-grant-permission-to-users-for-a-directory-using-command-line-in-windows">How to grant permission to users for a directory using command line in Windows?</a> </p>
</blockquote>
<p>I want to grant ... | 86,502 | 1,635,051 | 2012-10-04 11:00:31 | 12,725,569 | 24 | 2012-10-04 10:45:23 | 15,393 | 2012-10-04 10:45:23 | https://stackoverflow.com/q/12725322 | https://stackoverflow.com/a/12725569 | <p>There <strong>is</strong> a command line - <a href="http://technet.microsoft.com/en-us/library/bb490872.aspx" rel="noreferrer">CACLS</a>.</p>
<p>For example, to add "Everyone" with "Full Control" to the folder <code>c:\temp\test</code> you would use:</p>
<pre><code>REM /t means "apply change recursively"
REM /e me... | <p>There <strong>is</strong> a command line - <a href="http://technet.microsoft.com/en-us/library/bb490872.aspx" rel="noreferrer">CACLS</a>.</p> <p>For example, to add "Everyone" with "Full Control" to the folder <code>c:\temp\test</code> you would use:</p> <pre><code>REM /t means "apply change recursively" REM /e me... | 64, 2631 | cmd, windows | <h1>Alter folder permission in windows command line?</h1>
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2928738/how-to-grant-permission-to-users-for-a-directory-using-command-line-in-windows">How to grant permission to users for a directory using command line ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,787 | cmd | # Alter folder permission in windows command line?
> **Possible Duplicate:**
> [How to grant permission to users for a directory using command line in Windows?](https://stackoverflow.com/questions/2928738/how-to-grant-permission-to-users-for-a-directory-using-command-line-in-windows)
I want to grant all users of a ... | There **is** a command line - [CACLS](http://technet.microsoft.com/en-us/library/bb490872.aspx).
For example, to add "Everyone" with "Full Control" to the folder `c:\temp\test` you would use:
```
REM /t means "apply change recursively"
REM /e means "edit existing DACL".
REM Omitting this will overwrite the exist... |
24782826 | The filename, directory name, or volume label syntax is incorrect inside batch | 34 | 2014-07-16 14:01:18 | <p>When I am running the following inside batch.... </p>
<pre><code>set PATH='C:\Users\DEB\Downloads\10.1.1.0.4'
cd !PATH!
</code></pre>
<p>I get error "The filename, directory name, or volume label syntax is incorrect"</p>
<p><strong>Update</strong>: There are the solutions that worked for me.</p>
<ul>
<li>Don't u... | 334,960 | 1,278,540 | 2021-08-06 20:05:45 | 24,783,032 | 23 | 2014-07-16 14:10:22 | 478,656 | 2014-07-16 14:45:16 | https://stackoverflow.com/q/24782826 | https://stackoverflow.com/a/24783032 | <pre><code>set myPATH="C:\Users\DEB\Downloads\10.1.1.0.4"
cd %myPATH%
</code></pre>
<ul>
<li><p>The single quotes do not indicate a string, they make it starts: <code>'C:\</code> instead of <code>C:\</code> so</p></li>
<li><p><code>%name%</code> is the usual syntax for expanding a variable, the <code>!name!</code> syn... | <pre><code>set myPATH="C:\Users\DEB\Downloads\10.1.1.0.4" cd %myPATH% </code></pre> <ul> <li><p>The single quotes do not indicate a string, they make it starts: <code>'C:\</code> instead of <code>C:\</code> so</p></li> <li><p><code>%name%</code> is the usual syntax for expanding a variable, the <code>!name!</code> syn... | 64, 2631 | cmd, windows | <h1>The filename, directory name, or volume label syntax is incorrect inside batch</h1>
<p>When I am running the following inside batch.... </p>
<pre><code>set PATH='C:\Users\DEB\Downloads\10.1.1.0.4'
cd !PATH!
</code></pre>
<p>I get error "The filename, directory name, or volume label syntax is incorrect"</p>
<p><s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,789 | cmd | # The filename, directory name, or volume label syntax is incorrect inside batch
When I am running the following inside batch....
```
set PATH='C:\Users\DEB\Downloads\10.1.1.0.4'
cd !PATH!
```
I get error "The filename, directory name, or volume label syntax is incorrect"
**Update**: There are the solutions that wo... | ```
set myPATH="C:\Users\DEB\Downloads\10.1.1.0.4"
cd %myPATH%
```
- The single quotes do not indicate a string, they make it starts: `'C:\` instead of `C:\` so
- `%name%` is the usual syntax for expanding a variable, the `!name!` syntax needs to be enabled using the command `setlocal ENABLEDELAYEDEXPANSION` first, or... |
9419875 | Determining if batch script has been started/executed from the command line (cmd) -or- To pause or not to pause? | 28 | 2012-02-23 19:30:20 | <p>I like to have a typical "usage:" line in my <code>cmd.exe</code> scripts — if a parameter is missing, user is given simple reminder of how the script is to be used.</p>
<p>The problem is that I can't safely predict whether potential user would use GUI or CLI. If somebody using GUI double-clicks this script i... | 10,053 | 835,945 | 2024-11-07 23:18:35 | 9,422,268 | 23 | 2012-02-23 22:18:39 | 785,536 | 2012-02-29 00:02:34 | https://stackoverflow.com/q/9419875 | https://stackoverflow.com/a/9422268 | <p>You can check the value of <code>%CMDCMDLINE%</code> variable. It contains the command that was used to launch <code>cmd.exe</code>. </p>
<p>I prepared a test .bat file:</p>
<pre><code>@Echo Off
echo %CMDCMDLINE%
pause
</code></pre>
<p>When run from inside of open <code>cmd.exe</code> window, the script prints <c... | <p>You can check the value of <code>%CMDCMDLINE%</code> variable. It contains the command that was used to launch <code>cmd.exe</code>. </p> <p>I prepared a test .bat file:</p> <pre><code>@Echo Off echo %CMDCMDLINE% pause </code></pre> <p>When run from inside of open <code>cmd.exe</code> window, the script prints <c... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>Determining if batch script has been started/executed from the command line (cmd) -or- To pause or not to pause?</h1>
<p>I like to have a typical "usage:" line in my <code>cmd.exe</code> scripts — if a parameter is missing, user is given simple reminder of how the script is to be used.</p>
<p>The problem is ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,790 | cmd | # Determining if batch script has been started/executed from the command line (cmd) -or- To pause or not to pause?
I like to have a typical "usage:" line in my `cmd.exe` scripts — if a parameter is missing, user is given simple reminder of how the script is to be used.
The problem is that I can't safely predict wheth... | You can check the value of `%CMDCMDLINE%` variable. It contains the command that was used to launch `cmd.exe`.
I prepared a test .bat file:
```
@Echo Off
echo %CMDCMDLINE%
pause
```
When run from inside of open `cmd.exe` window, the script prints `"C:\Windows\system32\cmd.exe"`.
When run by double-clicking, it print... |
20485419 | Batch file script to zip files | 27 | 2013-12-10 03:21:56 | <p>i have a folder structure in this pattern. I've just shown two sub directories and 2 files in each but generally I have n number of subdirectories at a single level and single level of files (but can be n number of files)under them.</p>
<pre><code>Directory master
subDirectory x:
file1
file2
Directory y:
file... | 282,657 | 3,085,265 | 2025-08-19 16:49:36 | 20,487,261 | 23 | 2013-12-10 05:59:13 | 2,128,947 | 2013-12-10 05:59:13 | https://stackoverflow.com/q/20485419 | https://stackoverflow.com/a/20487261 | <pre><code>for /d %%a in (*) do (ECHO zip -r -p "%%~na.zip" ".\%%a\*")
</code></pre>
<p>should work from within a batch.</p>
<p>Note that I've included an <code>ECHO</code> to simply SHOW the command that is proposed. You'd need to remove the <code>ECHO</code> keywor to EXECUTE the commands.</p>
| <pre><code>for /d %%a in (*) do (ECHO zip -r -p "%%~na.zip" ".\%%a\*") </code></pre> <p>should work from within a batch.</p> <p>Note that I've included an <code>ECHO</code> to simply SHOW the command that is proposed. You'd need to remove the <code>ECHO</code> keywor to EXECUTE the commands.</p> | 64, 7002 | batch-file, windows | <h1>Batch file script to zip files</h1>
<p>i have a folder structure in this pattern. I've just shown two sub directories and 2 files in each but generally I have n number of subdirectories at a single level and single level of files (but can be n number of files)under them.</p>
<pre><code>Directory master
subDirector... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,791 | cmd | # Batch file script to zip files
i have a folder structure in this pattern. I've just shown two sub directories and 2 files in each but generally I have n number of subdirectories at a single level and single level of files (but can be n number of files)under them.
```
Directory master
subDirectory x:
file1
file2... | ```
for /d %%a in (*) do (ECHO zip -r -p "%%~na.zip" ".\%%a\*")
```
should work from within a batch.
Note that I've included an `ECHO` to simply SHOW the command that is proposed. You'd need to remove the `ECHO` keywor to EXECUTE the commands. |
5534324 | How to run multiple programs using batch file | 27 | 2011-04-04 03:35:01 | <p>I like to run two programs using batch file, but the condition is, the second program must start only after the first program loaded, so is there any way to control using timer to control when the program starts.</p>
| 147,043 | 276,660 | 2021-04-10 09:40:22 | 5,535,154 | 23 | 2011-04-04 06:16:11 | 297,408 | 2011-04-04 06:16:11 | https://stackoverflow.com/q/5534324 | https://stackoverflow.com/a/5535154 | <p>Basically, you could try this approach (not tested):</p>
<ol>
<li><p>Run the first program using the <code>start</code> command.</p></li>
<li><p>Check the task list in a loop to see if the program has appeared there. </p></li>
<li><p>Impose some time limitation to the said loop.</p></li>
<li><p>Run the next program... | <p>Basically, you could try this approach (not tested):</p> <ol> <li><p>Run the first program using the <code>start</code> command.</p></li> <li><p>Check the task list in a loop to see if the program has appeared there. </p></li> <li><p>Impose some time limitation to the said loop.</p></li> <li><p>Run the next program... | 7002 | batch-file | <h1>How to run multiple programs using batch file</h1>
<p>I like to run two programs using batch file, but the condition is, the second program must start only after the first program loaded, so is there any way to control using timer to control when the program starts.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,792 | cmd | # How to run multiple programs using batch file
I like to run two programs using batch file, but the condition is, the second program must start only after the first program loaded, so is there any way to control using timer to control when the program starts. | Basically, you could try this approach (not tested):
1. Run the first program using the `start` command.
2. Check the task list in a loop to see if the program has appeared there.
3. Impose some time limitation to the said loop.
4. Run the next program in case of success, exit with notification otherwise.
The scripti... |
25107406 | How to ping a server only once from within a batch file? | 23 | 2014-08-03 17:47:41 | <p>I want to learn how to write batch scripts and tried to create a script which automatically runs this command in the command line once:</p>
<pre><code>ping www.google.de -t
</code></pre>
<p>and displays the ping, so it would look like this:</p>
<pre><code>Reply from XXX.XXX.X.XX: time=30ms
Reply from XXX.XXX.X.XX... | 216,553 | 2,514,164 | 2024-11-30 14:41:42 | 25,107,677 | 23 | 2014-08-03 18:16:38 | 3,074,564 | 2024-11-30 14:41:42 | https://stackoverflow.com/q/25107406 | https://stackoverflow.com/a/25107677 | <p>Enter in a command prompt window <code>ping /?</code> and read the short help output after pressing <kbd>RETURN</kbd>. Or take a look on:</p>
<ul>
<li><a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ping" rel="nofollow noreferrer">ping</a> - latest Microsoft documentation fo... | <p>Enter in a command prompt window <code>ping /?</code> and read the short help output after pressing <kbd>RETURN</kbd>. Or take a look on:</p> <ul> <li><a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ping" rel="nofollow noreferrer">ping</a> - latest Microsoft documentation fo... | 5649, 7002 | batch-file, ping | <h1>How to ping a server only once from within a batch file?</h1>
<p>I want to learn how to write batch scripts and tried to create a script which automatically runs this command in the command line once:</p>
<pre><code>ping www.google.de -t
</code></pre>
<p>and displays the ping, so it would look like this:</p>
<pr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,793 | cmd | # How to ping a server only once from within a batch file?
I want to learn how to write batch scripts and tried to create a script which automatically runs this command in the command line once:
```
ping www.google.de -t
```
and displays the ping, so it would look like this:
```
Reply from XXX.XXX.X.XX: time=30ms
R... | Enter in a command prompt window `ping /?` and read the short help output after pressing `RETURN`. Or take a look on:
- [ping](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/ping) - latest Microsoft documentation for this Windows command
- [ping](https://learn.microsoft.com/en-us/prev... |
14578175 | xcopy with credentials on remote machine | 23 | 2013-01-29 08:01:11 | <p>I am trying to access a remote server on a different domain through its IP address. In run command I entered the following</p>
<pre><code>\\XXX.XXX.XXX.XXX\C$\Program Files\
</code></pre>
<p>I get a pop up window asking for username and password. I enter it, and accessed the path. When I try accessing the folder a... | 107,276 | 815,600 | 2015-10-21 17:13:48 | 14,578,260 | 23 | 2013-01-29 08:08:12 | 381,149 | 2015-10-21 17:13:48 | https://stackoverflow.com/q/14578175 | https://stackoverflow.com/a/14578260 | <p>You just have to map a network drive:</p>
<pre><code>net use Z: \\XXX.XXX.XXX.XXX\C$ password /user:domain\username
</code></pre>
<p>If you want the drive to reconnect at next logon, add the option <code>/persistent:yes</code></p>
| <p>You just have to map a network drive:</p> <pre><code>net use Z: \\XXX.XXX.XXX.XXX\C$ password /user:domain\username </code></pre> <p>If you want the drive to reconnect at next logon, add the option <code>/persistent:yes</code></p> | 794, 5357, 7002, 8192 | batch-file, credentials, network-programming, remote-access | <h1>xcopy with credentials on remote machine</h1>
<p>I am trying to access a remote server on a different domain through its IP address. In run command I entered the following</p>
<pre><code>\\XXX.XXX.XXX.XXX\C$\Program Files\
</code></pre>
<p>I get a pop up window asking for username and password. I enter it, and ac... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,794 | cmd | # xcopy with credentials on remote machine
I am trying to access a remote server on a different domain through its IP address. In run command I entered the following
```
\\XXX.XXX.XXX.XXX\C$\Program Files\
```
I get a pop up window asking for username and password. I enter it, and accessed the path. When I try acces... | You just have to map a network drive:
```
net use Z: \\XXX.XXX.XXX.XXX\C$ password /user:domain\username
```
If you want the drive to reconnect at next logon, add the option `/persistent:yes` |
34353504 | How to set environment variables with spaces? | 20 | 2015-12-18 10:30:55 | <p>I need to set values to a environmental variable using a batch file. I wrote the script for this:</p>
<pre><code>@echo off
set value="Hello world"
setx -M srijani "%srijani%;%value%"
</code></pre>
<p>It gives the error:</p>
<pre><code>ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).
Typ... | 44,889 | 2,880,781 | 2019-06-07 05:48:33 | 34,402,887 | 23 | 2015-12-21 19:23:38 | 3,074,564 | 2019-06-07 05:48:33 | https://stackoverflow.com/q/34353504 | https://stackoverflow.com/a/34402887 | <p>The error output by command <strong>setx</strong> is caused by wrong usage of the quotes on assigning the string to variable <code>value</code>.</p>
<p>The command is <strong>set</strong> and the parameter is <code>variable=value</code>. As for most commands and applications it is possible and often required to sur... | <p>The error output by command <strong>setx</strong> is caused by wrong usage of the quotes on assigning the string to variable <code>value</code>.</p> <p>The command is <strong>set</strong> and the parameter is <code>variable=value</code>. As for most commands and applications it is possible and often required to sur... | 1231, 7002, 34595 | batch-file, command-line, windows-7 | <h1>How to set environment variables with spaces?</h1>
<p>I need to set values to a environmental variable using a batch file. I wrote the script for this:</p>
<pre><code>@echo off
set value="Hello world"
setx -M srijani "%srijani%;%value%"
</code></pre>
<p>It gives the error:</p>
<pre><code>ERROR: Invalid syntax. D... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,795 | cmd | # How to set environment variables with spaces?
I need to set values to a environmental variable using a batch file. I wrote the script for this:
```
@echo off
set value="Hello world"
setx -M srijani "%srijani%;%value%"
```
It gives the error:
```
ERROR: Invalid syntax. Default option is not allowed more than '2' t... | The error output by command **setx** is caused by wrong usage of the quotes on assigning the string to variable `value`.
The command is **set** and the parameter is `variable=value`. As for most commands and applications it is possible and often required to surround a parameter with double quotes if containing 1 or mo... |
9277630 | Windows shutdown hook on java application run from a bat script | 20 | 2012-02-14 13:23:41 | <p>I have a bat script which runs a java application. If I press ctrl+c on it, it the application terminates gracefully, invoking all the shutdown hooks. However, if I just close the cmd window of the bat script, the shutdown hooks are never invoked. </p>
<p>Is there a way to solve this? Perhaps there's a way to tell ... | 12,010 | 900,130 | 2017-09-04 04:53:54 | 9,277,766 | 23 | 2012-02-14 13:33:01 | 1,187,194 | 2014-01-31 10:49:19 | https://stackoverflow.com/q/9277630 | https://stackoverflow.com/a/9277766 | <p>From <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29" rel="noreferrer">addShutdownHook</a> documentation:</p>
<blockquote>
<p>In rare circumstances the virtual machine may abort, that is, stop running without shutting down cleanly. This occurs when th... | <p>From <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29" rel="noreferrer">addShutdownHook</a> documentation:</p> <blockquote> <p>In rare circumstances the virtual machine may abort, that is, stop running without shutting down cleanly. This occurs when th... | 17, 64, 7002, 22528, 57582 | application-shutdown, batch-file, java, shutdown-hook, windows | <h1>Windows shutdown hook on java application run from a bat script</h1>
<p>I have a bat script which runs a java application. If I press ctrl+c on it, it the application terminates gracefully, invoking all the shutdown hooks. However, if I just close the cmd window of the bat script, the shutdown hooks are never invok... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,796 | cmd | # Windows shutdown hook on java application run from a bat script
I have a bat script which runs a java application. If I press ctrl+c on it, it the application terminates gracefully, invoking all the shutdown hooks. However, if I just close the cmd window of the bat script, the shutdown hooks are never invoked.
Is t... | From [addShutdownHook](http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29) documentation:
> In rare circumstances the virtual machine may abort, that is, stop running without shutting down cleanly. This occurs when the virtual machine is terminated externally, for exa... |
29118156 | Add parameter to job context from tasklet step and use in later steps in Spring Batch | 19 | 2015-03-18 09:23:45 | <p>For now, I'm using jobParameters to get the filenames for both my FlatFileItemReader and FlatFileItemWriter. It's okay for testing my batch, but my goal is to read a file in some directory (there is only this file in this directory) and the filename might change. The output filename should depend on the input filena... | 58,901 | 4,292,792 | 2015-03-21 13:25:14 | 29,119,897 | 23 | 2015-03-18 10:44:03 | 4,617,377 | 2015-03-18 10:56:26 | https://stackoverflow.com/q/29118156 | https://stackoverflow.com/a/29119897 | <p>In tasklet you have <code>ChunkContext</code> at your disposal so you do not need <code>@BeforeStep</code>, you can remove it (in my configuration it is not invoked at all, and when you think of it as one action step does not make much sense but I do not see NPE so guess that part work). We solved it with one of two... | <p>In tasklet you have <code>ChunkContext</code> at your disposal so you do not need <code>@BeforeStep</code>, you can remove it (in my configuration it is not invoked at all, and when you think of it as one action step does not make much sense but I do not see NPE so guess that part work). We solved it with one of two... | 17, 41895 | java, spring-batch | <h1>Add parameter to job context from tasklet step and use in later steps in Spring Batch</h1>
<p>For now, I'm using jobParameters to get the filenames for both my FlatFileItemReader and FlatFileItemWriter. It's okay for testing my batch, but my goal is to read a file in some directory (there is only this file in this ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,798 | cmd | # Add parameter to job context from tasklet step and use in later steps in Spring Batch
For now, I'm using jobParameters to get the filenames for both my FlatFileItemReader and FlatFileItemWriter. It's okay for testing my batch, but my goal is to read a file in some directory (there is only this file in this directory... | In tasklet you have `ChunkContext` at your disposal so you do not need `@BeforeStep`, you can remove it (in my configuration it is not invoked at all, and when you think of it as one action step does not make much sense but I do not see NPE so guess that part work). We solved it with one of two approaches:
1. You can ... |
23091906 | Official MS reference for cmd.exe %errorlevel% 9009 | 19 | 2014-04-15 18:45:28 | <p>So I know from experience that running a valid program from cmd.exe and checking the %errorlevel% will return a 0:</p>
<pre><code>C:\>dir logo.bmp
Volume in drive C has no label.
Volume Serial Number is 5283-A7A2
Directory of C:\
05/22/2008 12:43 PM 1,440,054 logo.bmp
1 File(s) ... | 35,240 | 591,182 | 2020-10-22 20:14:06 | 23,095,106 | 23 | 2014-04-15 21:44:55 | 1,518,974 | 2020-10-22 20:14:06 | https://stackoverflow.com/q/23091906 | https://stackoverflow.com/a/23095106 | <p>Microsoft has a <a href="https://learn.microsoft.com/en-us/windows/win32/debug/system-error-code-lookup-tool" rel="noreferrer">Common Error Lookup Tool</a> that will translate error codes (including HRESULTs, which is handy) for you. The output for 9009 is:</p>
<pre><code># for decimal 9009 / hex 0x2331 :
MSG_DIR... | <p>Microsoft has a <a href="https://learn.microsoft.com/en-us/windows/win32/debug/system-error-code-lookup-tool" rel="noreferrer">Common Error Lookup Tool</a> that will translate error codes (including HRESULTs, which is handy) for you. The output for 9009 is:</p> <pre><code># for decimal 9009 / hex 0x2331 : MSG_DIR... | 2631, 7002, 17564 | batch-file, cmd, errorlevel | <h1>Official MS reference for cmd.exe %errorlevel% 9009</h1>
<p>So I know from experience that running a valid program from cmd.exe and checking the %errorlevel% will return a 0:</p>
<pre><code>C:\>dir logo.bmp
Volume in drive C has no label.
Volume Serial Number is 5283-A7A2
Directory of C:\
05/22/2008 12:43... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,799 | cmd | # Official MS reference for cmd.exe %errorlevel% 9009
So I know from experience that running a valid program from cmd.exe and checking the %errorlevel% will return a 0:
```
C:\>dir logo.bmp
Volume in drive C has no label.
Volume Serial Number is 5283-A7A2
Directory of C:\
05/22/2008 12:43 PM 1,440,054 l... | Microsoft has a [Common Error Lookup Tool](https://learn.microsoft.com/en-us/windows/win32/debug/system-error-code-lookup-tool) that will translate error codes (including HRESULTs, which is handy) for you. The output for 9009 is:
```
# for decimal 9009 / hex 0x2331 :
MSG_DIR_BAD_COMMAND_OR_FILE ... |
8899106 | Windows batch - delete a hidden file | 19 | 2012-01-17 17:36:50 | <p>I have the following script to clean my Visual Studio 2010 solution directory:</p>
<pre><code>@echo off
FOR /D /R %%X IN (debug,release,bin,obj,ipch) DO RD /S /Q "%%X"
del /S /F *.suo
del /S /F *.user
del /S /F *.ncb
del /S /F *.sbr
del /S /F *.log
echo Solution clean.
</code></pre>
<p>It works like a charm exept... | 14,621 | 767,843 | 2015-02-12 20:39:23 | 8,899,141 | 23 | 2012-01-17 17:39:55 | 457,352 | 2015-02-12 20:39:02 | https://stackoverflow.com/q/8899106 | https://stackoverflow.com/a/8899141 | <pre><code>del /S /F /AH *.suo
</code></pre>
<p>the <code>/AH</code> switch (as specified in <code>del /?</code> turns on deletion of hidden files.</p>
| <pre><code>del /S /F /AH *.suo </code></pre> <p>the <code>/AH</code> switch (as specified in <code>del /?</code> turns on deletion of hidden files.</p> | 64, 7002, 14456 | batch-file, visual-studio-2010, windows | <h1>Windows batch - delete a hidden file</h1>
<p>I have the following script to clean my Visual Studio 2010 solution directory:</p>
<pre><code>@echo off
FOR /D /R %%X IN (debug,release,bin,obj,ipch) DO RD /S /Q "%%X"
del /S /F *.suo
del /S /F *.user
del /S /F *.ncb
del /S /F *.sbr
del /S /F *.log
echo Solution clean.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,800 | cmd | # Windows batch - delete a hidden file
I have the following script to clean my Visual Studio 2010 solution directory:
```
@echo off
FOR /D /R %%X IN (debug,release,bin,obj,ipch) DO RD /S /Q "%%X"
del /S /F *.suo
del /S /F *.user
del /S /F *.ncb
del /S /F *.sbr
del /S /F *.log
echo Solution clean.
```
It works like ... | ```
del /S /F /AH *.suo
```
the `/AH` switch (as specified in `del /?` turns on deletion of hidden files. |
36355490 | "continue" equivalent command in nested loop in Windows Batch | 18 | 2016-04-01 11:43:29 | <p>I have a batch file which contains nested loop with <code>continue</code>-like command:</p>
<pre><code>for %%i in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
for %%j in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
if %%i gtr %%j goto CONTINUE
test.exe 0 %%i %%j 100000 > "%%i_%%j".txt
:CONTINUE... | 31,900 | 2,548,628 | 2024-06-30 16:44:36 | 36,357,869 | 23 | 2016-04-01 13:40:44 | 5,047,996 | 2016-04-01 16:14:17 | https://stackoverflow.com/q/36355490 | https://stackoverflow.com/a/36357869 | <p><code>goto :Label</code> inside of a block of code <code>()</code> like a <code>for</code> loop breaks the block context, so everything after the <code>:Label</code> is treated as being outside of the block. So you need to invert the <code>if</code> condition to not need <code>goto</code> as <a href="https://stackov... | <p><code>goto :Label</code> inside of a block of code <code>()</code> like a <code>for</code> loop breaks the block context, so everything after the <code>:Label</code> is treated as being outside of the block. So you need to invert the <code>if</code> condition to not need <code>goto</code> as <a href="https://stackov... | 64, 2531, 2631, 7002 | batch-file, cmd, for-loop, windows | <h1>"continue" equivalent command in nested loop in Windows Batch</h1>
<p>I have a batch file which contains nested loop with <code>continue</code>-like command:</p>
<pre><code>for %%i in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
for %%j in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
if %%i gtr %%j goto CONTINUE... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,801 | cmd | # "continue" equivalent command in nested loop in Windows Batch
I have a batch file which contains nested loop with `continue`-like command:
```
for %%i in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
for %%j in (1, 2, 4, 8, 16, 32, 64, 128, 256) do (
if %%i gtr %%j goto CONTINUE
test.exe 0 %%i %%j 100... | `goto :Label` inside of a block of code `()` like a `for` loop breaks the block context, so everything after the `:Label` is treated as being outside of the block. So you need to invert the `if` condition to not need `goto` as [ths's answer](https://stackoverflow.com/a/36356625) demonstrates, or you place the code frag... |
16333782 | How to display only files that have alternate data streams in Command Prompt | 18 | 2013-05-02 08:45:31 | <p>I know that to display alternate data streams of all the files (if any) in command prompt, this is the command <code>dir /R</code>. But, how do I do it if I only want to display files that have alternate data streams?</p>
| 26,874 | 1,164,615 | 2023-04-01 18:59:14 | 16,781,253 | 23 | 2013-05-27 22:19:19 | 388,389 | 2023-04-01 18:59:14 | https://stackoverflow.com/q/16333782 | https://stackoverflow.com/a/16781253 | <pre><code>dir /s /r | findstr /e ":$DATA"
</code></pre>
<p>or</p>
<pre><code>dir /r | findstr /e ":$DATA"
</code></pre>
<p>the first will search in all sub-directories.The second only in current folder. These will show also the ADS assigned to the directory.For only files:</p>
<pre><code>dir /a... | <pre><code>dir /s /r | findstr /e ":$DATA" </code></pre> <p>or</p> <pre><code>dir /r | findstr /e ":$DATA" </code></pre> <p>the first will search in all sub-directories.The second only in current folder. These will show also the ADS assigned to the directory.For only files:</p> <pre><code>dir /a... | 2631, 5003, 7002, 8257, 49329 | alternate, batch-file, cmd, prompt, stream | <h1>How to display only files that have alternate data streams in Command Prompt</h1>
<p>I know that to display alternate data streams of all the files (if any) in command prompt, this is the command <code>dir /R</code>. But, how do I do it if I only want to display files that have alternate data streams?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,803 | cmd | # How to display only files that have alternate data streams in Command Prompt
I know that to display alternate data streams of all the files (if any) in command prompt, this is the command `dir /R`. But, how do I do it if I only want to display files that have alternate data streams? | ```
dir /s /r | findstr /e ":$DATA"
```
or
```
dir /r | findstr /e ":$DATA"
```
the first will search in all sub-directories.The second only in current folder. These will show also the ADS assigned to the directory.For only files:
```
dir /a-d /s /r | findstr /e ":$DATA"
``` |
1013246 | Call Python From Bat File And Get Return Code | 17 | 2009-06-18 15:11:43 | <p>I'm looking for a way to call a python script from a batch file and getting a return code from the python script. Confusing I know, but it's based on a system that's currently in use. I'd re-write it, but this way would be much, much quicker.</p>
<p>So:</p>
<pre><code>Bat ---------------------> Python
* ... | 34,350 | 39,693 | 2024-08-20 09:33:39 | 1,013,293 | 23 | 2009-06-18 15:17:46 | 56,338 | 2009-06-18 15:22:54 | https://stackoverflow.com/q/1013246 | https://stackoverflow.com/a/1013293 | <p>The windows shell saves the return code in the <code>ERRORLEVEL</code> variable:</p>
<pre><code>python somescript.py
echo %ERRORLEVEL%
</code></pre>
<p>In the python script you can exit the script and set the return value by calling <code>exit()</code>:</p>
<pre><code>exit(15)
</code></pre>
<p>In older versions ... | <p>The windows shell saves the return code in the <code>ERRORLEVEL</code> variable:</p> <pre><code>python somescript.py echo %ERRORLEVEL% </code></pre> <p>In the python script you can exit the script and set the return value by calling <code>exit()</code>:</p> <pre><code>exit(15) </code></pre> <p>In older versions ... | 16, 7002 | batch-file, python | <h1>Call Python From Bat File And Get Return Code</h1>
<p>I'm looking for a way to call a python script from a batch file and getting a return code from the python script. Confusing I know, but it's based on a system that's currently in use. I'd re-write it, but this way would be much, much quicker.</p>
<p>So:</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,804 | cmd | # Call Python From Bat File And Get Return Code
I'm looking for a way to call a python script from a batch file and getting a return code from the python script. Confusing I know, but it's based on a system that's currently in use. I'd re-write it, but this way would be much, much quicker.
So:
```
Bat --------------... | The windows shell saves the return code in the `ERRORLEVEL` variable:
```
python somescript.py
echo %ERRORLEVEL%
```
In the python script you can exit the script and set the return value by calling `exit()`:
```
exit(15)
```
In older versions of python you might first have to import the `exit()` function from the `... |
31810950 | findstr exit codes/errorlevel | 16 | 2015-08-04 13:41:19 | <p>I have a program that is using <code>findstr</code>, and when the string is found the <code>errorlevel</code> returns <code>0</code> and when the string is not found the <code>errorlevel</code> returns <code>1</code>. Alright, that's fine I can deal with that.</p>
<p>Where the issue lies is I cannot find any offici... | 37,415 | 2,784,086 | 2015-08-04 15:31:54 | 31,813,397 | 23 | 2015-08-04 15:31:54 | 2,152,082 | 2015-08-04 15:31:54 | https://stackoverflow.com/q/31810950 | https://stackoverflow.com/a/31813397 | <p><a href="http://ss64.com/nt/findstr.html">http://ss64.com/nt/findstr.html</a> says:</p>
<pre><code>FINDSTR will set %ERRORLEVEL% as follows:
0 (False) a match is found in at least one line of at least one file.
1 (True) if a match is not found in any line of any file, (or if the file is not found at all).
2 Wrong ... | <p><a href="http://ss64.com/nt/findstr.html">http://ss64.com/nt/findstr.html</a> says:</p> <pre><code>FINDSTR will set %ERRORLEVEL% as follows: 0 (False) a match is found in at least one line of at least one file. 1 (True) if a match is not found in any line of any file, (or if the file is not found at all). 2 Wrong ... | 2631, 10021, 17564, 21229 | cmd, errorlevel, exit-code, findstr | <h1>findstr exit codes/errorlevel</h1>
<p>I have a program that is using <code>findstr</code>, and when the string is found the <code>errorlevel</code> returns <code>0</code> and when the string is not found the <code>errorlevel</code> returns <code>1</code>. Alright, that's fine I can deal with that.</p>
<p>Where the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,805 | cmd | # findstr exit codes/errorlevel
I have a program that is using `findstr`, and when the string is found the `errorlevel` returns `0` and when the string is not found the `errorlevel` returns `1`. Alright, that's fine I can deal with that.
Where the issue lies is I cannot find any official documentation on what each `e... | <http://ss64.com/nt/findstr.html> says:
```
FINDSTR will set %ERRORLEVEL% as follows:
0 (False) a match is found in at least one line of at least one file.
1 (True) if a match is not found in any line of any file, (or if the file is not found at all).
2 Wrong syntax
An invalid switch will only print an error message... |
12849017 | Echo of String with Double Quotes to Output file using Windows Batch | 16 | 2012-10-11 21:45:05 | <p>I'm attempting to rewrite a configuration file using a Windows Batch file.
I'm looping through the lines of the file and looking for the line that I want to replace with a specified new line.</p>
<p>I have a 'function' that writes the line to the file</p>
<pre><code>:AddText %1 %2
set Text=%~1%
set NewLine=%~2%
ec... | 29,065 | 913,102 | 2018-09-14 08:27:35 | 12,884,316 | 23 | 2012-10-14 16:42:45 | 1,537,042 | 2012-10-14 16:47:45 | https://stackoverflow.com/q/12849017 | https://stackoverflow.com/a/12884316 | <p>Try replacing all <code>"</code> in <code>Text</code> with <code>^"</code>.</p>
<p><code>^</code> is escape character so the the <code>"</code> will be treated as regular character</p>
<p>you can try the following:</p>
<pre><code>:AddText %1 %2
set _Text=%~1%
set Text=%_Text:"=^^^"%
... rest of your code
REM fo... | <p>Try replacing all <code>"</code> in <code>Text</code> with <code>^"</code>.</p> <p><code>^</code> is escape character so the the <code>"</code> will be treated as regular character</p> <p>you can try the following:</p> <pre><code>:AddText %1 %2 set _Text=%~1% set Text=%_Text:"=^^^"% ... rest of your code REM fo... | 64, 7002 | batch-file, windows | <h1>Echo of String with Double Quotes to Output file using Windows Batch</h1>
<p>I'm attempting to rewrite a configuration file using a Windows Batch file.
I'm looping through the lines of the file and looking for the line that I want to replace with a specified new line.</p>
<p>I have a 'function' that writes the lin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,806 | cmd | # Echo of String with Double Quotes to Output file using Windows Batch
I'm attempting to rewrite a configuration file using a Windows Batch file.
I'm looping through the lines of the file and looking for the line that I want to replace with a specified new line.
I have a 'function' that writes the line to the file
`... | Try replacing all `"` in `Text` with `^"`.
`^` is escape character so the the `"` will be treated as regular character
you can try the following:
```
:AddText %1 %2
set _Text=%~1%
set Text=%_Text:"=^^^"%
... rest of your code
REM for example if %1 is "blah"blah"blah"
REM _Text will be blah"blah"blah
REM Text will ... |
59844962 | Execute a bat file on keypress in VsCode | 15 | 2020-01-21 16:05:09 | <p>I'm writing shaders for vulkan, which have to be compiled into spir-v. I have a very nice batch file that will go through and build my shaders for me using the GLSlangvalidator. I'm trying to get a keypress to run my batch file in VsCode so I can check my code for errors and so that it is built. I have the following... | 36,134 | 5,438,234 | 2021-07-07 19:23:24 | 59,849,230 | 23 | 2020-01-21 21:06:59 | 2,752,075 | 2021-07-06 17:20:05 | https://stackoverflow.com/q/59844962 | https://stackoverflow.com/a/59849230 | <p>In <code>tasks.json</code>, create a task to run the <code>.bat</code>. Something like this:</p>
<pre><code>{
"label": "MY_TASK",
"type": "shell",
"command": "MY_BAT_FILE.bat",
"presentation": {"echo": true, "reveal&... | <p>In <code>tasks.json</code>, create a task to run the <code>.bat</code>. Something like this:</p> <pre><code>{ "label": "MY_TASK", "type": "shell", "command": "MY_BAT_FILE.bat", "presentation": {"echo": true, "reveal&... | 6957, 7002, 110351, 111608 | batch-file, glsl, visual-studio-code, vulkan | <h1>Execute a bat file on keypress in VsCode</h1>
<p>I'm writing shaders for vulkan, which have to be compiled into spir-v. I have a very nice batch file that will go through and build my shaders for me using the GLSlangvalidator. I'm trying to get a keypress to run my batch file in VsCode so I can check my code for er... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,808 | cmd | # Execute a bat file on keypress in VsCode
I'm writing shaders for vulkan, which have to be compiled into spir-v. I have a very nice batch file that will go through and build my shaders for me using the GLSlangvalidator. I'm trying to get a keypress to run my batch file in VsCode so I can check my code for errors and ... | In `tasks.json`, create a task to run the `.bat`. Something like this:
```
{
"label": "MY_TASK",
"type": "shell",
"command": "MY_BAT_FILE.bat",
"presentation": {"echo": true, "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": false, "clear": true},
"group": {"kind": "build",... |
47450531 | Batch - Write output of DIR to a variable | 15 | 2017-11-23 08:14:32 | <p>I have to store the ouput of <code>DIR</code> in a variable.</p>
<p>This was asked before e.g. <a href="https://stackoverflow.com/questions/39957309/batch-store-output-of-dir-command-into-variable-directory-listing">here</a> or <a href="https://stackoverflow.com/questions/28663803/batch-assign-command-output-with-v... | 35,884 | 7,111,561 | 2017-11-23 08:21:11 | 47,450,629 | 23 | 2017-11-23 08:21:11 | 2,152,082 | 2017-11-23 08:21:11 | https://stackoverflow.com/q/47450531 | https://stackoverflow.com/a/47450629 | <pre><code>for /f "delims=" %%a in ('dir /s /b *.sln') do set "name=%%a"
</code></pre>
<p>indeed is the most efficient method (you can process the output of a command directly, no need for a temporary file).<br>
<code>%name%</code> will contain the full qualified file name of your file (or the last of the files, if th... | <pre><code>for /f "delims=" %%a in ('dir /s /b *.sln') do set "name=%%a" </code></pre> <p>indeed is the most efficient method (you can process the output of a command directly, no need for a temporary file).<br> <code>%name%</code> will contain the full qualified file name of your file (or the last of the files, if th... | 64, 7002, 84917 | batch-file, output, windows | <h1>Batch - Write output of DIR to a variable</h1>
<p>I have to store the ouput of <code>DIR</code> in a variable.</p>
<p>This was asked before e.g. <a href="https://stackoverflow.com/questions/39957309/batch-store-output-of-dir-command-into-variable-directory-listing">here</a> or <a href="https://stackoverflow.com/qu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,809 | cmd | # Batch - Write output of DIR to a variable
I have to store the ouput of `DIR` in a variable.
This was asked before e.g. [here](https://stackoverflow.com/questions/39957309/batch-store-output-of-dir-command-into-variable-directory-listing) or [here](https://stackoverflow.com/questions/28663803/batch-assign-command-ou... | ```
for /f "delims=" %%a in ('dir /s /b *.sln') do set "name=%%a"
```
indeed is the most efficient method (you can process the output of a command directly, no need for a temporary file).
`%name%` will contain the full qualified file name of your file (or the last of the files, if there are more than one) |
19540089 | How to get the list of filenames in a directory and store that in a variable using cmd commands | 15 | 2013-10-23 11:12:12 | <p>I need to get all the filenames in a directory and store them in some variable from a command line.</p>
<p>I came across this</p>
<pre><code>`dir /s /b > print.txt`
</code></pre>
<p>but this prints the file names to a txt file.</p>
<p>How can I store these names in a variable?</p>
| 92,016 | 2,907,999 | 2015-10-28 10:50:38 | 19,542,051 | 23 | 2013-10-23 12:43:35 | 1,012,053 | 2015-10-28 10:50:38 | https://stackoverflow.com/q/19540089 | https://stackoverflow.com/a/19542051 | <p>I'm assuming you really mean Windows batch file, not DOS.</p>
<p>Batch environment variables are limited to 8191 characters, so likely will not be able to fit all the file paths into one variable, depending on the number of files and the average file path length.</p>
<p>File names should be quoted in case they con... | <p>I'm assuming you really mean Windows batch file, not DOS.</p> <p>Batch environment variables are limited to 8191 characters, so likely will not be able to fit all the file paths into one variable, depending on the number of files and the average file path length.</p> <p>File names should be quoted in case they con... | 7002 | batch-file | <h1>How to get the list of filenames in a directory and store that in a variable using cmd commands</h1>
<p>I need to get all the filenames in a directory and store them in some variable from a command line.</p>
<p>I came across this</p>
<pre><code>`dir /s /b > print.txt`
</code></pre>
<p>but this prints the file... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,811 | cmd | # How to get the list of filenames in a directory and store that in a variable using cmd commands
I need to get all the filenames in a directory and store them in some variable from a command line.
I came across this
```
`dir /s /b > print.txt`
```
but this prints the file names to a txt file.
How can I store thes... | I'm assuming you really mean Windows batch file, not DOS.
Batch environment variables are limited to 8191 characters, so likely will not be able to fit all the file paths into one variable, depending on the number of files and the average file path length.
File names should be quoted in case they contain spaces.
Ass... |
9560709 | Adding a registry key in windows with quotes needed in the data using a batch script | 15 | 2012-03-05 01:45:06 | <p>Little Willis here. I am trying to using a batch script to edit an existing registry key that is used when double clicking a .jar file. The issue is that the data that I'm trying to enter contains quotes but I also need quotes for it to be considered a string. </p>
<p>Example:</p>
<pre><code>reg add "HKEY_LOCAL_MA... | 48,730 | 1,248,873 | 2019-05-19 15:31:09 | 9,560,889 | 23 | 2012-03-05 02:21:00 | 1,024,832 | 2012-03-05 03:54:29 | https://stackoverflow.com/q/9560709 | https://stackoverflow.com/a/9560889 | <p>Use backslashes to escape the inner quotes, i.e.:</p>
<pre><code>reg add "HKEY_LOCAL_MACHINE\Software\Classes\jarfile\shell\open\command" /v "" /t REG_EXPAND_SZ /d "\"C:\Program Files\Java\jre7\bin\javaw.exe\" -jar \"%1\" %*" /f
</code></pre>
| <p>Use backslashes to escape the inner quotes, i.e.:</p> <pre><code>reg add "HKEY_LOCAL_MACHINE\Software\Classes\jarfile\shell\open\command" /v "" /t REG_EXPAND_SZ /d "\"C:\Program Files\Java\jre7\bin\javaw.exe\" -jar \"%1\" %*" /f </code></pre> | 64, 7002, 49671, 63342 | batch-file, double-quotes, registrykey, windows | <h1>Adding a registry key in windows with quotes needed in the data using a batch script</h1>
<p>Little Willis here. I am trying to using a batch script to edit an existing registry key that is used when double clicking a .jar file. The issue is that the data that I'm trying to enter contains quotes but I also need quo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,812 | cmd | # Adding a registry key in windows with quotes needed in the data using a batch script
Little Willis here. I am trying to using a batch script to edit an existing registry key that is used when double clicking a .jar file. The issue is that the data that I'm trying to enter contains quotes but I also need quotes for i... | Use backslashes to escape the inner quotes, i.e.:
```
reg add "HKEY_LOCAL_MACHINE\Software\Classes\jarfile\shell\open\command" /v "" /t REG_EXPAND_SZ /d "\"C:\Program Files\Java\jre7\bin\javaw.exe\" -jar \"%1\" %*" /f
``` |
48345857 | BatchNorm momentum convention PyTorch | 14 | 2018-01-19 16:49:46 | <p>Is the <a href="http://pytorch.org/docs/master/_modules/torch/nn/modules/batchnorm.html" rel="noreferrer">batchnorm momentum convention</a> (default=0.1) correct as in other libraries e.g. Tensorflow it seems to usually be 0.9 or 0.99 by default? Or maybe we are just using a different convention?</p>
| 8,953 | 6,097,525 | 2023-12-08 17:52:33 | 48,950,072 | 23 | 2018-02-23 14:28:11 | 3,990,607 | 2018-02-23 14:28:11 | https://stackoverflow.com/q/48345857 | https://stackoverflow.com/a/48950072 | <p>It seems that the parametrization convention is different in pytorch than in tensorflow, so that 0.1 in pytorch is equivalent to 0.9 in tensorflow.</p>
<p>To be more precise:</p>
<p>In Tensorflow:</p>
<pre><code>running_mean = decay*running_mean + (1-decay)*new_value
</code></pre>
<p>In PyTorch:</p>
<pre><code>... | <p>It seems that the parametrization convention is different in pytorch than in tensorflow, so that 0.1 in pytorch is equivalent to 0.9 in tensorflow.</p> <p>To be more precise:</p> <p>In Tensorflow:</p> <pre><code>running_mean = decay*running_mean + (1-decay)*new_value </code></pre> <p>In PyTorch:</p> <pre><code>... | 16, 40102, 100570, 124253, 124994 | batch-normalization, deep-learning, neural-network, python, pytorch | <h1>BatchNorm momentum convention PyTorch</h1>
<p>Is the <a href="http://pytorch.org/docs/master/_modules/torch/nn/modules/batchnorm.html" rel="noreferrer">batchnorm momentum convention</a> (default=0.1) correct as in other libraries e.g. Tensorflow it seems to usually be 0.9 or 0.99 by default? Or maybe we are just us... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,813 | cmd | # BatchNorm momentum convention PyTorch
Is the [batchnorm momentum convention](http://pytorch.org/docs/master/_modules/torch/nn/modules/batchnorm.html) (default=0.1) correct as in other libraries e.g. Tensorflow it seems to usually be 0.9 or 0.99 by default? Or maybe we are just using a different convention? | It seems that the parametrization convention is different in pytorch than in tensorflow, so that 0.1 in pytorch is equivalent to 0.9 in tensorflow.
To be more precise:
In Tensorflow:
```
running_mean = decay*running_mean + (1-decay)*new_value
```
In PyTorch:
```
running_mean = (1-decay)*running_mean + decay*new_va... |
44588260 | How does the echo command works in batch programming | 13 | 2017-06-16 11:33:39 | <p>I'm have started to learn batch programming to go a little more deeper in the Windows Machines. In Internet I have seen some commands with echo like <strong>"@echo off"</strong> or <strong>"on"</strong> and also this: <strong>"echo."</strong> but I don't know what are they doing. If anyone can explain me the functio... | 117,945 | 8,166,773 | 2022-11-05 03:12:21 | 44,588,428 | 23 | 2017-06-16 11:42:56 | 7,281,326 | 2017-06-16 11:42:56 | https://stackoverflow.com/q/44588260 | https://stackoverflow.com/a/44588428 | <p>The ECHO command in Windows CMD is used to print out text to the screen, display the actual setting of the Command-line which means when you do:</p>
<pre><code>@echo off
</code></pre>
<p>The <strong>"C:\Users[User]"</strong> line before your command input will disappear.
You can restore it with:</p>
<pre><code>@e... | <p>The ECHO command in Windows CMD is used to print out text to the screen, display the actual setting of the Command-line which means when you do:</p> <pre><code>@echo off </code></pre> <p>The <strong>"C:\Users[User]"</strong> line before your command input will disappear. You can restore it with:</p> <pre><code>@e... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>How does the echo command works in batch programming</h1>
<p>I'm have started to learn batch programming to go a little more deeper in the Windows Machines. In Internet I have seen some commands with echo like <strong>"@echo off"</strong> or <strong>"on"</strong> and also this: <strong>"echo."</strong> but I don't ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,814 | cmd | # How does the echo command works in batch programming
I'm have started to learn batch programming to go a little more deeper in the Windows Machines. In Internet I have seen some commands with echo like **"@echo off"** or **"on"** and also this: **"echo."** but I don't know what are they doing. If anyone can explain ... | The ECHO command in Windows CMD is used to print out text to the screen, display the actual setting of the Command-line which means when you do:
```
@echo off
```
The **"C:\Users[User]"** line before your command input will disappear.
You can restore it with:
```
@echo on
```
Here all functions of ECHO explained:
... |
13774713 | Command to get Hard disk & processor spec remotely | 13 | 2012-12-08 05:10:18 | <p>What is the command(s) helps to get information of the Hard disk & processor in a remote windows machine ? </p>
| 79,948 | 630,908 | 2017-10-03 05:05:54 | 13,774,891 | 23 | 2012-12-08 05:45:15 | 970,543 | 2012-12-08 05:45:15 | https://stackoverflow.com/q/13774713 | https://stackoverflow.com/a/13774891 | <p>If you can rely on running on Windows Vista or later, then you can use WMIC. For details on WMIC, check out <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394531(v=vs.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/windows/desktop/aa394531(v=vs.85).aspx</a>.</p>
<p>To get CPU ... | <p>If you can rely on running on Windows Vista or later, then you can use WMIC. For details on WMIC, check out <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394531(v=vs.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/windows/desktop/aa394531(v=vs.85).aspx</a>.</p> <p>To get CPU ... | 64, 2631, 61774 | cmd, windows, wmic | <h1>Command to get Hard disk & processor spec remotely</h1>
<p>What is the command(s) helps to get information of the Hard disk & processor in a remote windows machine ? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,815 | cmd | # Command to get Hard disk & processor spec remotely
What is the command(s) helps to get information of the Hard disk & processor in a remote windows machine ? | If you can rely on running on Windows Vista or later, then you can use WMIC. For details on WMIC, check out <http://msdn.microsoft.com/en-us/library/windows/desktop/aa394531(v=vs.85).aspx>.
To get CPU information try `wmic cpu`
To get hard disk information try either `wmic diskdrive` or `wmic logicaldisk` depending o... |
8735463 | How to run a shell command without opening a CMD window in VB6 | 13 | 2012-01-04 23:12:52 | <p>the following code is part from my VB6 program</p>
<p>I used shell command in the VB in order to execute the pscp.exe with the flags and arguments</p>
<p>my problem is , when VB run the line:</p>
<pre><code> Shell strCommand, 1
</code></pre>
<p>its also open the CMD window for 2-4 seconds (CMD popup wind... | 53,702 | null | 2015-07-16 03:14:02 | 8,735,521 | 23 | 2012-01-04 23:19:36 | 1,079,221 | 2015-07-16 03:14:02 | https://stackoverflow.com/q/8735463 | https://stackoverflow.com/a/8735521 | <p>You can use hidden focus:</p>
<pre><code>Shell strCommand, vbHide
</code></pre>
<p>or</p>
<pre><code>Shell strCommand, 0
</code></pre>
<p>For other focus types look <a href="http://www.developerfusion.com/article/9/shell-and-shellexecute-function/" rel="noreferrer">Here</a>
or <a href="http://msdn.microsoft.com/... | <p>You can use hidden focus:</p> <pre><code>Shell strCommand, vbHide </code></pre> <p>or</p> <pre><code>Shell strCommand, 0 </code></pre> <p>For other focus types look <a href="http://www.developerfusion.com/article/9/shell-and-shellexecute-function/" rel="noreferrer">Here</a> or <a href="http://msdn.microsoft.com/... | 64, 153, 1449, 7002 | batch-file, vb6, vba, windows | <h1>How to run a shell command without opening a CMD window in VB6</h1>
<p>the following code is part from my VB6 program</p>
<p>I used shell command in the VB in order to execute the pscp.exe with the flags and arguments</p>
<p>my problem is , when VB run the line:</p>
<pre><code> Shell strCommand, 1
</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,816 | cmd | # How to run a shell command without opening a CMD window in VB6
the following code is part from my VB6 program
I used shell command in the VB in order to execute the pscp.exe with the flags and arguments
my problem is , when VB run the line:
```
Shell strCommand, 1
```
its also open the CMD window for 2-4 s... | You can use hidden focus:
```
Shell strCommand, vbHide
```
or
```
Shell strCommand, 0
```
For other focus types look [Here](http://www.developerfusion.com/article/9/shell-and-shellexecute-function/)
or <http://msdn.microsoft.com/en-us/library/aa242087%28v=VS.60%29.aspx> (thanks to MarkJ for the link) |
46969575 | How to trigger a scheduled Spring Batch Job? | 12 | 2017-10-27 07:19:48 | <p>I want to be able to start my job with a REST controller, then when the job is started, it should run on a scheduled basis, until i stop it again with REST.</p>
<p>So this is my Controller:</p>
<pre><code>@RestController
public class LauncherController {
@Autowired
JobLauncher jobLauncher;
@Autowired... | 42,835 | 2,224,454 | 2018-03-12 12:12:45 | 47,046,075 | 23 | 2017-10-31 23:38:22 | 1,160,445 | 2017-10-31 23:38:22 | https://stackoverflow.com/q/46969575 | https://stackoverflow.com/a/47046075 | <p>I would approach it in a way, that scheduled job runs always, but it does something only when the flag is set to true:</p>
<pre><code>@Component
class ScheduledJob {
private final AtomicBoolean enabled = new AtomicBoolean(false);
@Scheduled(fixedRate = 1000)
void execute() {
if (enabled.get(... | <p>I would approach it in a way, that scheduled job runs always, but it does something only when the flag is set to true:</p> <pre><code>@Component class ScheduledJob { private final AtomicBoolean enabled = new AtomicBoolean(false); @Scheduled(fixedRate = 1000) void execute() { if (enabled.get(... | 17, 1211, 7027, 41895, 95875 | java, spring, spring-batch, spring-boot, spring-mvc | <h1>How to trigger a scheduled Spring Batch Job?</h1>
<p>I want to be able to start my job with a REST controller, then when the job is started, it should run on a scheduled basis, until i stop it again with REST.</p>
<p>So this is my Controller:</p>
<pre><code>@RestController
public class LauncherController {
@... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,817 | cmd | # How to trigger a scheduled Spring Batch Job?
I want to be able to start my job with a REST controller, then when the job is started, it should run on a scheduled basis, until i stop it again with REST.
So this is my Controller:
```
@RestController
public class LauncherController {
@Autowired
JobLauncher j... | I would approach it in a way, that scheduled job runs always, but it does something only when the flag is set to true:
```
@Component
class ScheduledJob {
private final AtomicBoolean enabled = new AtomicBoolean(false);
@Scheduled(fixedRate = 1000)
void execute() {
if (enabled.get()) {
... |
24345345 | How to prevent sqlcmd truncation with for xml path query result | 12 | 2014-06-21 19:55:49 | <p>After reading <a href="https://stackoverflow.com/questions/18856260/for-xml-path-results-in-ssms-truncated-to-2034-characters">one answer</a> and <a href="https://stackoverflow.com/questions/2533552/how-to-export-more-than-1mb-in-xml-format-using-sqlcmd-and-without-an-input-file">second answer</a> and the <a href="h... | 9,052 | 2,942,175 | 2022-08-25 14:17:35 | 37,548,315 | 23 | 2016-05-31 14:21:05 | 6,405,160 | 2018-01-09 16:41:19 | https://stackoverflow.com/q/24345345 | https://stackoverflow.com/a/37548315 | <p>I ran into the same issue today, I used the -y0 option. My output looks correct now. Thought I would post my findings so it might help others running into the same thing.</p>
<pre><code>sqlcmd -Sxxxxxxx -E -dmaster -h-1 -y0 -Q" my query that produces long results in here;" > "D\:out.txt"
</code></pre>
<p><cod... | <p>I ran into the same issue today, I used the -y0 option. My output looks correct now. Thought I would post my findings so it might help others running into the same thing.</p> <pre><code>sqlcmd -Sxxxxxxx -E -dmaster -h-1 -y0 -Q" my query that produces long results in here;" > "D\:out.txt" </code></pre> <p><cod... | 19, 23, 7002, 30408, 47436 | batch-file, for-xml-path, sql-server-2008, t-sql, xml | <h1>How to prevent sqlcmd truncation with for xml path query result</h1>
<p>After reading <a href="https://stackoverflow.com/questions/18856260/for-xml-path-results-in-ssms-truncated-to-2034-characters">one answer</a> and <a href="https://stackoverflow.com/questions/2533552/how-to-export-more-than-1mb-in-xml-format-usi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,818 | cmd | # How to prevent sqlcmd truncation with for xml path query result
After reading [one answer](https://stackoverflow.com/questions/18856260/for-xml-path-results-in-ssms-truncated-to-2034-characters) and [second answer](https://stackoverflow.com/questions/2533552/how-to-export-more-than-1mb-in-xml-format-using-sqlcmd-and... | I ran into the same issue today, I used the -y0 option. My output looks correct now. Thought I would post my findings so it might help others running into the same thing.
```
sqlcmd -Sxxxxxxx -E -dmaster -h-1 -y0 -Q" my query that produces long results in here;" > "D\:out.txt"
```
`-h-1` removes the column headers to... |
14581099 | Script to run .jar file on Mac OS X | 12 | 2013-01-29 10:46:39 | <p>I want to run batch file (similar to Windows) on Mac OS X to run a jar file, after search I found it run batch script. </p>
<p>I am not getting proper link from where I can take help. How can I create this? </p>
| 45,359 | 1,053,182 | 2018-10-26 19:24:43 | 14,581,170 | 23 | 2013-01-29 10:50:11 | 475,192 | 2018-10-26 19:24:43 | https://stackoverflow.com/q/14581099 | https://stackoverflow.com/a/14581170 | <p>You could create a shell script and run it with Terminal.</p>
<p>For example: </p>
<pre><code>#!/bin/sh
java -jar path/to/jar/file.jar
</code></pre>
<p>To run it you need to set up the right user permission, so do
<code>chmod u+x script-name</code>
then run with
<code>./script-name</code></p>
| <p>You could create a shell script and run it with Terminal.</p> <p>For example: </p> <pre><code>#!/bin/sh java -jar path/to/jar/file.jar </code></pre> <p>To run it you need to set up the right user permission, so do <code>chmod u+x script-name</code> then run with <code>./script-name</code></p> | 17, 369, 7002 | batch-file, java, macos | <h1>Script to run .jar file on Mac OS X</h1>
<p>I want to run batch file (similar to Windows) on Mac OS X to run a jar file, after search I found it run batch script. </p>
<p>I am not getting proper link from where I can take help. How can I create this? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,819 | cmd | # Script to run .jar file on Mac OS X
I want to run batch file (similar to Windows) on Mac OS X to run a jar file, after search I found it run batch script.
I am not getting proper link from where I can take help. How can I create this? | You could create a shell script and run it with Terminal.
For example:
```
#!/bin/sh
java -jar path/to/jar/file.jar
```
To run it you need to set up the right user permission, so do
`chmod u+x script-name`
then run with
`./script-name` |
11767654 | Sending commands to cmd prompt in C# | 11 | 2012-08-01 21:11:26 | <p>For one of my implementations I am working on a tool that is supposed to send/retrieve commands/results to/from the cmd window. Everything works fine but the Use case below fails to do anything. It seems as if my application is waiting for something (instead of displaying the result) </p>
<p>From my tool I navigate... | 39,532 | 412,628 | 2012-11-07 19:09:08 | 11,768,260 | 23 | 2012-08-01 22:04:05 | 1,015,164 | 2012-11-07 19:09:08 | https://stackoverflow.com/q/11767654 | https://stackoverflow.com/a/11768260 | <p>You cannot send commands to a shell this way. The string in info.Arguments is the arguments provided to the program on the command line. If you want the cmd.exe shell to execute a series of command and then quit you will have to provide the /c argument. If you have multiple commands that you want it to perform you w... | <p>You cannot send commands to a shell this way. The string in info.Arguments is the arguments provided to the program on the command line. If you want the cmd.exe shell to execute a series of command and then quit you will have to provide the /c argument. If you have multiple commands that you want it to perform you w... | 9, 2631, 36252 | c#, cmd, winforms | <h1>Sending commands to cmd prompt in C#</h1>
<p>For one of my implementations I am working on a tool that is supposed to send/retrieve commands/results to/from the cmd window. Everything works fine but the Use case below fails to do anything. It seems as if my application is waiting for something (instead of displayin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,820 | cmd | # Sending commands to cmd prompt in C#
For one of my implementations I am working on a tool that is supposed to send/retrieve commands/results to/from the cmd window. Everything works fine but the Use case below fails to do anything. It seems as if my application is waiting for something (instead of displaying the res... | You cannot send commands to a shell this way. The string in info.Arguments is the arguments provided to the program on the command line. If you want the cmd.exe shell to execute a series of command and then quit you will have to provide the /c argument. If you have multiple commands that you want it to perform you will... |
133154 | How do I implement quicksort using a batch file? | 11 | 2008-09-25 12:55:35 | <p>While normally it's good to always choose the right language for the job, it can sometimes be instructive to try and do something in a language which is wildly inappropriate.</p>
<ol>
<li>It can help you understand the problem better. Maybe you don't <em>have</em> to solve it the way you thought you did.</li>
<li>... | 4,474 | 17,086 | 2014-11-19 18:34:19 | 133,155 | 23 | 2008-09-25 12:55:44 | 17,086 | 2008-09-25 23:17:08 | https://stackoverflow.com/q/133154 | https://stackoverflow.com/a/133155 | <p>Turns out, it's not as hard as you might think. The syntax is ugly as hell, but the batch syntax is actually capable of some surprising things, including recursion, local variables, and some surprisingly sophisticated parsing of strings. Don't get me wrong, it's a terrible language, but to my surprise, it isn't c... | <p>Turns out, it's not as hard as you might think. The syntax is ugly as hell, but the batch syntax is actually capable of some surprising things, including recursion, local variables, and some surprisingly sophisticated parsing of strings. Don't get me wrong, it's a terrible language, but to my surprise, it isn't c... | 134, 7002 | batch-file, sorting | <h1>How do I implement quicksort using a batch file?</h1>
<p>While normally it's good to always choose the right language for the job, it can sometimes be instructive to try and do something in a language which is wildly inappropriate.</p>
<ol>
<li>It can help you understand the problem better. Maybe you don't <em>ha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,821 | cmd | # How do I implement quicksort using a batch file?
While normally it's good to always choose the right language for the job, it can sometimes be instructive to try and do something in a language which is wildly inappropriate.
1. It can help you understand the problem better. Maybe you don't *have* to solve it the way... | Turns out, it's not as hard as you might think. The syntax is ugly as hell, but the batch syntax is actually capable of some surprising things, including recursion, local variables, and some surprisingly sophisticated parsing of strings. Don't get me wrong, it's a terrible language, but to my surprise, it isn't complet... |
11250799 | PHP execute command and log output without waiting | 10 | 2012-06-28 18:30:40 | <p>I use exec() to execute command, either linux or windows.</p>
<p>How do you execute a command, linux and windows, and log the output without waiting?</p>
<p>I know for linux, to not wait for the output: <code>command* > /dev/null 2>/dev/null &</code></p>
<p>And to log output for linux: <code>command* &... | 7,777 | 1,105,430 | 2012-06-28 19:00:25 | 11,250,818 | 23 | 2012-06-28 18:32:20 | 1,431,239 | 2012-06-28 19:00:25 | https://stackoverflow.com/q/11250799 | https://stackoverflow.com/a/11250818 | <p>On Linux you can do:</p>
<pre><code>exec('command* > /dev/null 2>/dev/null &');
</code></pre>
<p>On Windows you can do:</p>
<pre><code>pclose(popen('start /B cmd /C "command* >NUL 2>NUL"', 'r'));
</code></pre>
<p>Both examples disable output and errors, those go to <code>/dev/null</code> (linux) ... | <p>On Linux you can do:</p> <pre><code>exec('command* > /dev/null 2>/dev/null &'); </code></pre> <p>On Windows you can do:</p> <pre><code>pclose(popen('start /B cmd /C "command* >NUL 2>NUL"', 'r')); </code></pre> <p>Both examples disable output and errors, those go to <code>/dev/null</code> (linux) ... | 5, 58, 64, 2631 | cmd, linux, php, windows | <h1>PHP execute command and log output without waiting</h1>
<p>I use exec() to execute command, either linux or windows.</p>
<p>How do you execute a command, linux and windows, and log the output without waiting?</p>
<p>I know for linux, to not wait for the output: <code>command* > /dev/null 2>/dev/null &</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,822 | cmd | # PHP execute command and log output without waiting
I use exec() to execute command, either linux or windows.
How do you execute a command, linux and windows, and log the output without waiting?
I know for linux, to not wait for the output: `command* > /dev/null 2>/dev/null &`
And to log output for linux: `command... | On Linux you can do:
```
exec('command* > /dev/null 2>/dev/null &');
```
On Windows you can do:
```
pclose(popen('start /B cmd /C "command* >NUL 2>NUL"', 'r'));
```
Both examples disable output and errors, those go to `/dev/null` (linux) or `NUL` (windows) which means they are stored "nowhere".
You can replace the... |
8208181 | Create Postgres database using batch file with [template],[encoding],[owner] and a .sql file | 7 | 2011-11-21 06:43:50 | <p>I want to create a Postgres database using a batch file. Now the normal way of doing this is the following:</p>
<p>"C:\Program Files\PostgreSQL\9.0\bin\createdb.exe" -U Myadmin MydatAbseName</p>
<p>This script above creates a database with the default database parameters. However, I want to create a database wit... | 48,456 | 1,051,198 | 2025-01-11 05:40:36 | 8,208,821 | 23 | 2011-11-21 08:01:51 | 939,860 | 2025-01-11 05:40:36 | https://stackoverflow.com/q/8208181 | https://stackoverflow.com/a/8208821 | <p>The client program <code>createdb</code> does not support all those options.<br />
Create a file <code>db_create.sql</code>:</p>
<pre><code>CREATE DATABASE MydatAbseName
WITH OWNER myadmin
TEMPLATE template0
ENCODING 'SQL_ASCII'
TABLESPACE pg_default
LC_COLLATE 'C'
LC_CTYPE 'C'
CONNECTION LI... | <p>The client program <code>createdb</code> does not support all those options.<br /> Create a file <code>db_create.sql</code>:</p> <pre><code>CREATE DATABASE MydatAbseName WITH OWNER myadmin TEMPLATE template0 ENCODING 'SQL_ASCII' TABLESPACE pg_default LC_COLLATE 'C' LC_CTYPE 'C' CONNECTION LI... | 30, 256, 835, 2783, 7002 | batch-file, database, database-connection, ddl, postgresql | <h1>Create Postgres database using batch file with [template],[encoding],[owner] and a .sql file</h1>
<p>I want to create a Postgres database using a batch file. Now the normal way of doing this is the following:</p>
<p>"C:\Program Files\PostgreSQL\9.0\bin\createdb.exe" -U Myadmin MydatAbseName</p>
<p>This script ab... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,823 | cmd | # Create Postgres database using batch file with [template],[encoding],[owner] and a .sql file
I want to create a Postgres database using a batch file. Now the normal way of doing this is the following:
"C:\Program Files\PostgreSQL\9.0\bin\createdb.exe" -U Myadmin MydatAbseName
This script above creates a database w... | The client program `createdb` does not support all those options.
Create a file `db_create.sql`:
```
CREATE DATABASE MydatAbseName
WITH OWNER myadmin
TEMPLATE template0
ENCODING 'SQL_ASCII'
TABLESPACE pg_default
LC_COLLATE 'C'
LC_CTYPE 'C'
CONNECTION LIMIT -1;
```
Call it:
```
psql -U pos... |
819319 | Append text file data to log file, .bat | 7 | 2009-05-04 08:49:55 | <p>This <code>.bat</code> file is used for website replication, transferring files from development to production and then produces a log file with job statistics. I'd like to include the contents of a text file at the end of the log file. Is there an easy way to do this?</p>
<pre><code>@ECHO off
IF "%1"=="" goto ... | 19,949 | 56,327 | 2012-07-30 12:55:39 | 819,332 | 23 | 2009-05-04 08:53:25 | 22,656 | 2009-05-04 08:53:25 | https://stackoverflow.com/q/819319 | https://stackoverflow.com/a/819332 | <p>Something like:</p>
<pre><code>type textfile.txt >> test.log
</code></pre>
<p>?</p>
<p>(Note that in the batch file it <em>looks</em> like you're currently creating two separate log files. Is that deliberate?)</p>
<p>Alternatively, if you need to copy the files elsewhere you can just do:</p>
<pre><code>co... | <p>Something like:</p> <pre><code>type textfile.txt >> test.log </code></pre> <p>?</p> <p>(Note that in the batch file it <em>looks</em> like you're currently creating two separate log files. Is that deliberate?)</p> <p>Alternatively, if you need to copy the files elsewhere you can just do:</p> <pre><code>co... | 7002 | batch-file | <h1>Append text file data to log file, .bat</h1>
<p>This <code>.bat</code> file is used for website replication, transferring files from development to production and then produces a log file with job statistics. I'd like to include the contents of a text file at the end of the log file. Is there an easy way to do this... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,824 | cmd | # Append text file data to log file, .bat
This `.bat` file is used for website replication, transferring files from development to production and then produces a log file with job statistics. I'd like to include the contents of a text file at the end of the log file. Is there an easy way to do this?
```
@ECHO off
... | Something like:
```
type textfile.txt >> test.log
```
?
(Note that in the batch file it *looks* like you're currently creating two separate log files. Is that deliberate?)
Alternatively, if you need to copy the files elsewhere you can just do:
```
copy test.log+textfile.txt destination.log
```
That creates `desti... |
3713601 | Subroutines in batch files | 46 | 2010-09-14 23:15:07 | <p>Given the following code:</p>
<pre><code>@Echo off
ECHO Start
ECHO Calling SUB_A
CALL :SUB_A
ECHO Calling SUB_B
CALL :SUB_B
:SUB_A
ECHO In SUB_A
GOTO:EOF
:SUB_B
ECHO In SUB_B
GOTO:EOF
ECHO End
</code></pre>
<p>I expect this output:</p>
<pre><code>Start
Calling SUB_A
In SUB_A
Calling SUB_B
In SU... | 85,277 | 447,871 | 2022-05-16 10:03:44 | 3,713,631 | 22 | 2010-09-14 23:21:06 | 63,991 | 2010-09-14 23:21:06 | https://stackoverflow.com/q/3713601 | https://stackoverflow.com/a/3713631 | <p>The line <code>CALL :SUB_B</code> returns, the script proceeds to the next few lines:</p>
<pre><code>:SUB_A # no effect from this one
ECHO In SUB_A # prints message
</code></pre>
<p>You need to insert a <code>GOTO:EOF</code> after the call if you want it to stop there.</p>
<p>Batch files are not stru... | <p>The line <code>CALL :SUB_B</code> returns, the script proceeds to the next few lines:</p> <pre><code>:SUB_A # no effect from this one ECHO In SUB_A # prints message </code></pre> <p>You need to insert a <code>GOTO:EOF</code> after the call if you want it to stop there.</p> <p>Batch files are not stru... | 7002 | batch-file | <h1>Subroutines in batch files</h1>
<p>Given the following code:</p>
<pre><code>@Echo off
ECHO Start
ECHO Calling SUB_A
CALL :SUB_A
ECHO Calling SUB_B
CALL :SUB_B
:SUB_A
ECHO In SUB_A
GOTO:EOF
:SUB_B
ECHO In SUB_B
GOTO:EOF
ECHO End
</code></pre>
<p>I expect this output:</p>
<pre><code>Start
Callin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,826 | cmd | # Subroutines in batch files
Given the following code:
```
@Echo off
ECHO Start
ECHO Calling SUB_A
CALL :SUB_A
ECHO Calling SUB_B
CALL :SUB_B
:SUB_A
ECHO In SUB_A
GOTO:EOF
:SUB_B
ECHO In SUB_B
GOTO:EOF
ECHO End
```
I expect this output:
```
Start
Calling SUB_A
In SUB_A
Calling SUB_B
In SUB_B
End
... | The line `CALL :SUB_B` returns, the script proceeds to the next few lines:
```
:SUB_A # no effect from this one
ECHO In SUB_A # prints message
```
You need to insert a `GOTO:EOF` after the call if you want it to stop there.
Batch files are not structured programs; they are a sequence of instructions wit... |
27079534 | How to start a system "beep", from the built-in pc speaker, using a batch file? | 44 | 2014-11-22 16:17:19 | <p>I have written an interactive batch script where tasks sometimes take a long time to complete. After each task, the script prompts the user to decide whether to proceed to the next task, return to the main menu, or something else.</p>
<p>I would like to add an "Interactive Alarm" command that makes a small... | 89,433 | 4,121,720 | 2024-10-28 03:14:43 | 27,080,437 | 22 | 2014-11-22 17:42:10 | 2,152,082 | 2014-11-22 17:42:10 | https://stackoverflow.com/q/27079534 | https://stackoverflow.com/a/27080437 | <p>It's not possible to type the <code>BEL</code> directly in (for example) notepad.</p>
<p>To get it, type <code>echo ^G>>yourbatch.bat</code> on the command line (don't type <code>^</code> <code>G</code>, but <code><Control>-G</code>, which will be shown as <code>^G</code> on the screen). That puts a str... | <p>It's not possible to type the <code>BEL</code> directly in (for example) notepad.</p> <p>To get it, type <code>echo ^G>>yourbatch.bat</code> on the command line (don't type <code>^</code> <code>G</code>, but <code><Control>-G</code>, which will be shown as <code>^G</code> on the screen). That puts a str... | 64, 1731, 7002 | batch-file, cygwin, windows | <h1>How to start a system "beep", from the built-in pc speaker, using a batch file?</h1>
<p>I have written an interactive batch script where tasks sometimes take a long time to complete. After each task, the script prompts the user to decide whether to proceed to the next task, return to the main menu, or something els... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,827 | cmd | # How to start a system "beep", from the built-in pc speaker, using a batch file?
I have written an interactive batch script where tasks sometimes take a long time to complete. After each task, the script prompts the user to decide whether to proceed to the next task, return to the main menu, or something else.
I wou... | It's not possible to type the `BEL` directly in (for example) notepad.
To get it, type `echo ^G>>yourbatch.bat` on the command line (don't type `^` `G`, but `<Control>-G`, which will be shown as `^G` on the screen). That puts a strange looking character to the end of your file. That's the `BEL`character 0x007 ("contro... |
17271586 | Rename multiple files in cmd | 41 | 2013-06-24 08:57:56 | <p>If I have multiple files in a directory and want to append something to their filenames, but not to the extension, how would I do this?</p>
<p>I have tried the following, with test files <code>file1.txt</code> and <code>file2.txt</code>:</p>
<pre><code>ren *.txt *1.1.txt
</code></pre>
<p>This renames the files to... | 236,017 | 1,752,318 | 2023-03-17 11:45:38 | 17,274,246 | 22 | 2013-06-24 11:21:13 | 2,098,699 | 2013-06-24 11:21:13 | https://stackoverflow.com/q/17271586 | https://stackoverflow.com/a/17274246 | <pre><code>for /f "delims=" %%i in ('dir /b /a-d *.txt') do ren "%%~i" "%%~ni 1.1%%~xi"
</code></pre>
<p>If you use the simple <code>for</code> loop without the <code>/f</code> parameter, already renamed files will be again renamed.</p>
| <pre><code>for /f "delims=" %%i in ('dir /b /a-d *.txt') do ren "%%~i" "%%~ni 1.1%%~xi" </code></pre> <p>If you use the simple <code>for</code> loop without the <code>/f</code> parameter, already renamed files will be again renamed.</p> | 64, 2631, 4510, 5997, 7002 | batch-file, cmd, rename, wildcard, windows | <h1>Rename multiple files in cmd</h1>
<p>If I have multiple files in a directory and want to append something to their filenames, but not to the extension, how would I do this?</p>
<p>I have tried the following, with test files <code>file1.txt</code> and <code>file2.txt</code>:</p>
<pre><code>ren *.txt *1.1.txt
</cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,828 | cmd | # Rename multiple files in cmd
If I have multiple files in a directory and want to append something to their filenames, but not to the extension, how would I do this?
I have tried the following, with test files `file1.txt` and `file2.txt`:
```
ren *.txt *1.1.txt
```
This renames the files to `file1.1.txt` and `file... | ```
for /f "delims=" %%i in ('dir /b /a-d *.txt') do ren "%%~i" "%%~ni 1.1%%~xi"
```
If you use the simple `for` loop without the `/f` parameter, already renamed files will be again renamed. |
26243865 | Sync two folders using batch file | 24 | 2014-10-07 19:38:31 | <p>I want to use a batch file to synchronize 2 folders on Windows, and I'm using the xcopy command like this</p>
<pre><code>xcopy /s /d <Original Folder> <Destination Folder>
</code></pre>
<p>It's working perfectly because I just want to overwrite only the modified ones, but I have 1 tiny problem, when I ... | 71,824 | 3,234,858 | 2024-06-25 19:58:15 | 26,243,978 | 22 | 2014-10-07 19:45:18 | 1,486,834 | 2014-10-07 19:45:18 | https://stackoverflow.com/q/26243865 | https://stackoverflow.com/a/26243978 | <p><code>xcopy</code> has no such option. Your alternatives are:</p>
<p>rsync - <a href="http://rsync.samba.org">http://rsync.samba.org</a></p>
<p>robocopy - <a href="http://technet.microsoft.com/en-us/library/cc733145.aspx">http://technet.microsoft.com/en-us/library/cc733145.aspx</a></p>
| <p><code>xcopy</code> has no such option. Your alternatives are:</p> <p>rsync - <a href="http://rsync.samba.org">http://rsync.samba.org</a></p> <p>robocopy - <a href="http://technet.microsoft.com/en-us/library/cc733145.aspx">http://technet.microsoft.com/en-us/library/cc733145.aspx</a></p> | 7002 | batch-file | <h1>Sync two folders using batch file</h1>
<p>I want to use a batch file to synchronize 2 folders on Windows, and I'm using the xcopy command like this</p>
<pre><code>xcopy /s /d <Original Folder> <Destination Folder>
</code></pre>
<p>It's working perfectly because I just want to overwrite only the modifi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,830 | cmd | # Sync two folders using batch file
I want to use a batch file to synchronize 2 folders on Windows, and I'm using the xcopy command like this
```
xcopy /s /d <Original Folder> <Destination Folder>
```
It's working perfectly because I just want to overwrite only the modified ones, but I have 1 tiny problem, when I de... | `xcopy` has no such option. Your alternatives are:
rsync - <http://rsync.samba.org>
robocopy - <http://technet.microsoft.com/en-us/library/cc733145.aspx> |
3062100 | Piping to findstr's input | 24 | 2010-06-17 13:39:52 | <p>I have a text file with a list of macro names (one per line). My final goal is to get a print of how many times the macro's name appears in the files of the current directory.</p>
<p>The macro's names are in <code>C:\temp\macros.txt</code>.</p>
<p><code>type C:\temp\macros.txt</code> in the command prompt prints t... | 53,869 | 108,802 | 2010-06-17 14:00:38 | 3,062,149 | 22 | 2010-06-17 13:46:50 | 73,070 | 2010-06-17 13:54:19 | https://stackoverflow.com/q/3062100 | https://stackoverflow.com/a/3062149 | <p>I think you're confusing a little how <code>findstr</code> works. It gets input (to find things in – not the things to look for) either as a file name (pattern) or from stdin, but the things you're looking for are <em>always</em> given on the command line as an argument to <code>findstr</code>.</p>
<pre><code>finds... | <p>I think you're confusing a little how <code>findstr</code> works. It gets input (to find things in – not the things to look for) either as a file name (pattern) or from stdin, but the things you're looking for are <em>always</em> given on the command line as an argument to <code>findstr</code>.</p> <pre><code>finds... | 5813, 7002, 21229 | batch-file, findstr, pipe | <h1>Piping to findstr's input</h1>
<p>I have a text file with a list of macro names (one per line). My final goal is to get a print of how many times the macro's name appears in the files of the current directory.</p>
<p>The macro's names are in <code>C:\temp\macros.txt</code>.</p>
<p><code>type C:\temp\macros.txt</c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,831 | cmd | # Piping to findstr's input
I have a text file with a list of macro names (one per line). My final goal is to get a print of how many times the macro's name appears in the files of the current directory.
The macro's names are in `C:\temp\macros.txt`.
`type C:\temp\macros.txt` in the command prompt prints the list al... | I think you're confusing a little how `findstr` works. It gets input (to find things in – not the things to look for) either as a file name (pattern) or from stdin, but the things you're looking for are *always* given on the command line as an argument to `findstr`.
```
findstr foo xyz.txt
```
finds the string `foo` ... |
1477500 | How do I get the output of an external command in Perl? | 24 | 2009-09-25 14:09:22 | <p>I want to have output of Windows command-line program (say, <code>powercfg -l</code>) written into a file which is created using Perl and then read the file line by line in a for loop and assign it to a string.</p>
| 83,135 | 73,073 | 2010-03-07 18:21:31 | 1,477,621 | 22 | 2009-09-25 14:28:26 | 168,569 | 2009-09-25 15:01:36 | https://stackoverflow.com/q/1477500 | https://stackoverflow.com/a/1477621 | <pre><code>my $output = qx(powercfg -l);
## You've got your output loaded into the $output variable.
## Still want to write it to a file?
open my $OUTPUT, '>', 'output.txt' or die "Couldn't open output.txt: $!\n";
print $OUTPUT $output;
close $OUTPUT
## Now you can loop through each line and
## parse the $line ... | <pre><code>my $output = qx(powercfg -l); ## You've got your output loaded into the $output variable. ## Still want to write it to a file? open my $OUTPUT, '>', 'output.txt' or die "Couldn't open output.txt: $!\n"; print $OUTPUT $output; close $OUTPUT ## Now you can loop through each line and ## parse the $line ... | 580, 1231, 7002 | batch-file, command-line, perl | <h1>How do I get the output of an external command in Perl?</h1>
<p>I want to have output of Windows command-line program (say, <code>powercfg -l</code>) written into a file which is created using Perl and then read the file line by line in a for loop and assign it to a string.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,832 | cmd | # How do I get the output of an external command in Perl?
I want to have output of Windows command-line program (say, `powercfg -l`) written into a file which is created using Perl and then read the file line by line in a for loop and assign it to a string. | ```
my $output = qx(powercfg -l);
## You've got your output loaded into the $output variable.
## Still want to write it to a file?
open my $OUTPUT, '>', 'output.txt' or die "Couldn't open output.txt: $!\n";
print $OUTPUT $output;
close $OUTPUT
## Now you can loop through each line and
## parse the $line variable t... |
346107 | creating a shortcut for a exe from a batch file | 24 | 2008-12-06 08:59:56 | <p>how to create a shortcut for a exe from a batch file.</p>
<p>i tried </p>
<pre><code>call link.bat "c:\program Files\App1\program1.exe" "C:\Documents and Settings\%USERNAME%\Desktop" "C:\Documents and Settings\%USERNAME%\Start Menu\Programs" "Program1 shortcut"
</code></pre>
<p>but it did not worked.</p>
<p>link... | 94,411 | 32,670 | 2020-11-09 01:12:52 | 346,134 | 22 | 2008-12-06 09:32:52 | 21,038 | 2012-07-20 10:08:57 | https://stackoverflow.com/q/346107 | https://stackoverflow.com/a/346134 | <p>Your link points to a Windows 95/98 version and I guess you have at least Windows 2000 or XP. You should try the NT version <a href="http://www.robvanderwoude.com/amb_shortcutsnt.html" rel="noreferrer">here</a>.</p>
<p>Alternatively use a little VBScript that you can call from the command line:</p>
<pre><code>set ... | <p>Your link points to a Windows 95/98 version and I guess you have at least Windows 2000 or XP. You should try the NT version <a href="http://www.robvanderwoude.com/amb_shortcutsnt.html" rel="noreferrer">here</a>.</p> <p>Alternatively use a little VBScript that you can call from the command line:</p> <pre><code>set ... | 7002 | batch-file | <h1>creating a shortcut for a exe from a batch file</h1>
<p>how to create a shortcut for a exe from a batch file.</p>
<p>i tried </p>
<pre><code>call link.bat "c:\program Files\App1\program1.exe" "C:\Documents and Settings\%USERNAME%\Desktop" "C:\Documents and Settings\%USERNAME%\Start Menu\Programs" "Program1 shortc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,833 | cmd | # creating a shortcut for a exe from a batch file
how to create a shortcut for a exe from a batch file.
i tried
```
call link.bat "c:\program Files\App1\program1.exe" "C:\Documents and Settings\%USERNAME%\Desktop" "C:\Documents and Settings\%USERNAME%\Start Menu\Programs" "Program1 shortcut"
```
but it did not work... | Your link points to a Windows 95/98 version and I guess you have at least Windows 2000 or XP. You should try the NT version [here](http://www.robvanderwoude.com/amb_shortcutsnt.html).
Alternatively use a little VBScript that you can call from the command line:
```
set objWSHShell = CreateObject("WScript.Shell")
set o... |
17821304 | How to execute 'msbuild' command from a batch file | 23 | 2013-07-23 21:19:42 | <p>I would like to create a batch file to make the builds from my VS project in on click. All the days I do the following steps:</p>
<ol>
<li>Opens a cmd console as administrador</li>
<li>Go to the path of my project/solution (using the CD.., CD commands)</li>
<li><p>Write the following command to make the build:</p>
... | 42,209 | 2,055,298 | 2018-02-20 19:51:59 | 17,821,671 | 22 | 2013-07-23 21:49:06 | 2,612,291 | 2017-07-26 19:19:43 | https://stackoverflow.com/q/17821304 | https://stackoverflow.com/a/17821671 | <p>You're not in the right directory, you need to cd to the directory that msbuild is in. Try this:</p>
<pre><code>set pathMSBuild="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\"
@echo off
cls
cd %pathMSBuild%
msbuild.exe "C:\myPath\..\MyFolderSolution\lucre.sln" /p:configuration=debug
pause
</code></pre>
<p>Or y... | <p>You're not in the right directory, you need to cd to the directory that msbuild is in. Try this:</p> <pre><code>set pathMSBuild="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\" @echo off cls cd %pathMSBuild% msbuild.exe "C:\myPath\..\MyFolderSolution\lucre.sln" /p:configuration=debug pause </code></pre> <p>Or y... | 488, 7002, 14456, 33953 | batch-file, console, visual-studio, visual-studio-2010 | <h1>How to execute 'msbuild' command from a batch file</h1>
<p>I would like to create a batch file to make the builds from my VS project in on click. All the days I do the following steps:</p>
<ol>
<li>Opens a cmd console as administrador</li>
<li>Go to the path of my project/solution (using the CD.., CD commands)</li... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,834 | cmd | # How to execute 'msbuild' command from a batch file
I would like to create a batch file to make the builds from my VS project in on click. All the days I do the following steps:
1. Opens a cmd console as administrador
2. Go to the path of my project/solution (using the CD.., CD commands)
3. Write the following comma... | You're not in the right directory, you need to cd to the directory that msbuild is in. Try this:
```
set pathMSBuild="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\"
@echo off
cls
cd %pathMSBuild%
msbuild.exe "C:\myPath\..\MyFolderSolution\lucre.sln" /p:configuration=debug
pause
```
Or you could add the msbuild dir... |
5628971 | Using xcopy to copy multiple files/directories, some of which have spaces | 23 | 2011-04-12 00:10:44 | <p>I'm trying to use xcopy to copy over several files and directories onto an external hard drive. The following command works fine...</p>
<pre><code>xcopy d:\location\folder /e
</code></pre>
<p>... except it's not copying over any files/directories withing d:/location/folder that have spaces. I understand that Wind... | 71,188 | 333,900 | 2019-11-28 03:04:04 | 5,629,026 | 22 | 2011-04-12 00:22:24 | 62,576 | 2011-04-12 00:22:24 | https://stackoverflow.com/q/5628971 | https://stackoverflow.com/a/5629026 | <p>Use quotes:</p>
<pre><code>xcopy "d:\location\folder" /e
</code></pre>
| <p>Use quotes:</p> <pre><code>xcopy "d:\location\folder" /e </code></pre> | 64, 2631, 4710 | cmd, windows, xcopy | <h1>Using xcopy to copy multiple files/directories, some of which have spaces</h1>
<p>I'm trying to use xcopy to copy over several files and directories onto an external hard drive. The following command works fine...</p>
<pre><code>xcopy d:\location\folder /e
</code></pre>
<p>... except it's not copying over any fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,835 | cmd | # Using xcopy to copy multiple files/directories, some of which have spaces
I'm trying to use xcopy to copy over several files and directories onto an external hard drive. The following command works fine...
```
xcopy d:\location\folder /e
```
... except it's not copying over any files/directories withing d:/locatio... | Use quotes:
```
xcopy "d:\location\folder" /e
``` |
18439373 | Batch File to disable internet options proxy server | 21 | 2013-08-26 08:00:40 | <p>In <strong>Windows</strong>, I want to disable the Proxy Server setting in <strong>Internet Options</strong> by using a batch Script.
What command can I use to do this?</p>
<p>If unsure what I am referring to, see </p>
<pre><code>Internet Properties > Connections > LAN Settings >Proxy Server
</code></pre>... | 97,019 | 1,140,828 | 2021-07-21 08:43:42 | 18,439,473 | 22 | 2013-08-26 08:07:02 | 30,447 | 2013-08-26 08:12:59 | https://stackoverflow.com/q/18439373 | https://stackoverflow.com/a/18439473 | <p>It's in the registry, under <strong>[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]</strong></p>
<p>you can either use the <code>REG</code> command in your BAT, or prepare a couple of <code>.REG</code> files, to automate the changes.</p>
<p>for example, to disable Proxy, try</p>
<p... | <p>It's in the registry, under <strong>[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]</strong></p> <p>you can either use the <code>REG</code> command in your BAT, or prepare a couple of <code>.REG</code> files, to automate the changes.</p> <p>for example, to disable Proxy, try</p> <p... | 64, 7002, 36733 | batch-file, internet-options, windows | <h1>Batch File to disable internet options proxy server</h1>
<p>In <strong>Windows</strong>, I want to disable the Proxy Server setting in <strong>Internet Options</strong> by using a batch Script.
What command can I use to do this?</p>
<p>If unsure what I am referring to, see </p>
<pre><code>Internet Properties >... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,836 | cmd | # Batch File to disable internet options proxy server
In **Windows**, I want to disable the Proxy Server setting in **Internet Options** by using a batch Script.
What command can I use to do this?
If unsure what I am referring to, see
```
Internet Properties > Connections > LAN Settings >Proxy Server
```
Thank you | It's in the registry, under **[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]**
you can either use the `REG` command in your BAT, or prepare a couple of `.REG` files, to automate the changes.
for example, to disable Proxy, try
```
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersio... |
12479250 | How to set recursive depth for the Windows command DIR? | 21 | 2012-09-18 14:38:24 | <p>I'm currently using the following command to list some directories:</p>
<pre><code>dir /b /s /AD > c:\temp\dir_list.txt
</code></pre>
<p>This gives me almost the list that I need. But it is way too much data because some folders have lots of subfolders that I don't want to see in my listing.</p>
<p>Is it possible... | 41,167 | 822,664 | 2023-01-06 16:19:29 | 12,480,971 | 22 | 2012-09-18 16:15:35 | 1,012,053 | 2017-03-02 16:01:33 | https://stackoverflow.com/q/12479250 | https://stackoverflow.com/a/12480971 | <p>I'm sure it is possible to write a complex command that would list n levels of directories. But it would be hard to remember the syntax and error prone. It would also need to change each time you want to change the number of levels.</p>
<p>Much better to use a simple script.</p>
<p><strong><em>EDIT 5 Years Later</... | <p>I'm sure it is possible to write a complex command that would list n levels of directories. But it would be hard to remember the syntax and error prone. It would also need to change each time you want to change the number of levels.</p> <p>Much better to use a simple script.</p> <p><strong><em>EDIT 5 Years Later</... | 64, 218, 578, 2631, 4859 | cmd, directory, directory-structure, recursion, windows | <h1>How to set recursive depth for the Windows command DIR?</h1>
<p>I'm currently using the following command to list some directories:</p>
<pre><code>dir /b /s /AD > c:\temp\dir_list.txt
</code></pre>
<p>This gives me almost the list that I need. But it is way too much data because some folders have lots of subfold... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,837 | cmd | # How to set recursive depth for the Windows command DIR?
I'm currently using the following command to list some directories:
```
dir /b /s /AD > c:\temp\dir_list.txt
```
This gives me almost the list that I need. But it is way too much data because some folders have lots of subfolders that I don't want to see in my... | I'm sure it is possible to write a complex command that would list n levels of directories. But it would be hard to remember the syntax and error prone. It would also need to change each time you want to change the number of levels.
Much better to use a simple script.
***EDIT 5 Years Later*** *- Actually, there is a ... |
2635740 | Why does findstr not handle case properly (in some circumstances)? | 21 | 2010-04-14 07:56:09 | <p>While writing some recent scripts in cmd.exe, I had a need to use <code>findstr</code> with regular expressions - customer required standard cmd.exe commands (no GnuWin32 nor Cygwin nor VBS nor Powershell).</p>
<p>I just wanted to know if a variable contained any upper-case characters and attempted to use:</p>
<pr... | 16,117 | 14,860 | 2017-01-04 16:15:13 | 8,767,815 | 22 | 2012-01-07 06:15:55 | 1,012,053 | 2017-01-04 16:15:13 | https://stackoverflow.com/q/2635740 | https://stackoverflow.com/a/8767815 | <p>I believe this is mostly a horrible design flaw.</p>
<p>We all expect the ranges to collate based on the ASCII code value. But they don't - instead the ranges are based on a collation sequence that nearly matches the default sequence used by SORT. <strong><em>EDIT</em></strong> <em>-The exact collation sequence use... | <p>I believe this is mostly a horrible design flaw.</p> <p>We all expect the ranges to collate based on the ASCII code value. But they don't - instead the ranges are based on a collation sequence that nearly matches the default sequence used by SORT. <strong><em>EDIT</em></strong> <em>-The exact collation sequence use... | 18, 64, 2631, 7002, 21229 | batch-file, cmd, findstr, regex, windows | <h1>Why does findstr not handle case properly (in some circumstances)?</h1>
<p>While writing some recent scripts in cmd.exe, I had a need to use <code>findstr</code> with regular expressions - customer required standard cmd.exe commands (no GnuWin32 nor Cygwin nor VBS nor Powershell).</p>
<p>I just wanted to know if a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,838 | cmd | # Why does findstr not handle case properly (in some circumstances)?
While writing some recent scripts in cmd.exe, I had a need to use `findstr` with regular expressions - customer required standard cmd.exe commands (no GnuWin32 nor Cygwin nor VBS nor Powershell).
I just wanted to know if a variable contained any upp... | I believe this is mostly a horrible design flaw.
We all expect the ranges to collate based on the ASCII code value. But they don't - instead the ranges are based on a collation sequence that nearly matches the default sequence used by SORT. ***EDIT*** *-The exact collation sequence used by FINDSTR is now available at ... |
10429011 | Accessing the returned value of a SQL statement in SQLCMD | 19 | 2012-05-03 09:53:41 | <p>I'm trying to get the value of a SQL statement when I run it in a DOS batch file ...</p>
<pre><code>sqlcmd -E -S DEVSERVER -Q "SELECT COUNT(1) as [CaseCount] FROM Cases"
</code></pre>
<p>I'm not after the error level as in this <a href="https://stackoverflow.com/questions/5418690/return-value-of-sqlcmd">stackover... | 37,520 | 27,756 | 2015-11-11 16:41:53 | 10,429,411 | 22 | 2012-05-03 10:20:49 | 394,042 | 2012-05-03 17:43:52 | https://stackoverflow.com/q/10429011 | https://stackoverflow.com/a/10429411 | <p>You can easily save the result of the execution into a text file, either by using the <code>-o</code> sqlcmd flag or by using the standard <code>></code> redirector. You can then format this file by removing the column header (flag <code>-h</code>) and removing the rowcount from SQL Server (<code>SET NOCOUNT ON</... | <p>You can easily save the result of the execution into a text file, either by using the <code>-o</code> sqlcmd flag or by using the standard <code>></code> redirector. You can then format this file by removing the column header (flag <code>-h</code>) and removing the rowcount from SQL Server (<code>SET NOCOUNT ON</... | 72, 5370, 7002, 7445 | batch-file, dos, sqlcmd, sql-server | <h1>Accessing the returned value of a SQL statement in SQLCMD</h1>
<p>I'm trying to get the value of a SQL statement when I run it in a DOS batch file ...</p>
<pre><code>sqlcmd -E -S DEVSERVER -Q "SELECT COUNT(1) as [CaseCount] FROM Cases"
</code></pre>
<p>I'm not after the error level as in this <a href="https://st... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,839 | cmd | # Accessing the returned value of a SQL statement in SQLCMD
I'm trying to get the value of a SQL statement when I run it in a DOS batch file ...
```
sqlcmd -E -S DEVSERVER -Q "SELECT COUNT(1) as [CaseCount] FROM Cases"
```
I'm not after the error level as in this [stackoverflow](https://stackoverflow.com/questions/... | You can easily save the result of the execution into a text file, either by using the `-o` sqlcmd flag or by using the standard `>` redirector. You can then format this file by removing the column header (flag `-h`) and removing the rowcount from SQL Server (`SET NOCOUNT ON`).
The following script will generate a file... |
4418233 | _cmd value inside C functions | 19 | 2010-12-11 18:27:41 | <p>What's the value of <code>_cmd</code> variable when I access it from C-style function's body?</p>
<p>Is it defined inside Objective-C methods <em>only</em>?</p>
<p>P.S. This question may originate from my non-understanding of what <code>_cmd</code> is. I would greatly appreciate if someone provided me with a good ex... | 13,789 | 499,206 | 2021-02-16 16:24:07 | 4,418,258 | 22 | 2010-12-11 18:31:23 | 34,218 | 2016-07-24 02:39:39 | https://stackoverflow.com/q/4418233 | https://stackoverflow.com/a/4418258 | <p>It's for Objective-C methods only, so you can't access it. The first two parameters passed to all Objective-C methods are <code>self</code> and <code>_cmd</code>, then whatever other arguments the actual method takes. Since neither <code>self</code> nor <code>_cmd</code> are passed to regular C functions, you can't ... | <p>It's for Objective-C methods only, so you can't access it. The first two parameters passed to all Objective-C methods are <code>self</code> and <code>_cmd</code>, then whatever other arguments the actual method takes. Since neither <code>self</code> nor <code>_cmd</code> are passed to regular C functions, you can't ... | 2631, 5627, 7003, 15796 | cmd, introspection, objective-c, selector | <h1>_cmd value inside C functions</h1>
<p>What's the value of <code>_cmd</code> variable when I access it from C-style function's body?</p>
<p>Is it defined inside Objective-C methods <em>only</em>?</p>
<p>P.S. This question may originate from my non-understanding of what <code>_cmd</code> is. I would greatly appreciat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,840 | cmd | # _cmd value inside C functions
What's the value of `_cmd` variable when I access it from C-style function's body?
Is it defined inside Objective-C methods *only*?
P.S. This question may originate from my non-understanding of what `_cmd` is. I would greatly appreciate if someone provided me with a good explanation s... | It's for Objective-C methods only, so you can't access it. The first two parameters passed to all Objective-C methods are `self` and `_cmd`, then whatever other arguments the actual method takes. Since neither `self` nor `_cmd` are passed to regular C functions, you can't access them.
There's nothing particularly magi... |
65631547 | Spring Batch / Postgres : ERROR: relation "batch_job_instance" does not exist | 18 | 2021-01-08 15:09:36 | <p>I am trying to configure Spring Batch to use PostGres DB. I have included the following dependencies in my <code>build.gradle.kts</code> file:</p>
<pre><code>implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.postgresql:postgresql")
</code></pre>
<p>My <c... | 34,418 | 575,596 | 2025-03-29 17:52:05 | 65,632,518 | 22 | 2021-01-08 16:11:16 | 8,093,552 | 2021-01-11 10:47:11 | https://stackoverflow.com/q/65631547 | https://stackoverflow.com/a/65632518 | <p>Please check below added in application.yml</p>
<pre><code>spring.batch.initialize-schema: always
</code></pre>
<p>Please check below dependencies are added</p>
<pre><code><artifactId>spring-boot-starter-batch</artifactId>
</code></pre>
| <p>Please check below added in application.yml</p> <pre><code>spring.batch.initialize-schema: always </code></pre> <p>Please check below dependencies are added</p> <pre><code><artifactId>spring-boot-starter-batch</artifactId> </code></pre> | 256, 41895, 95875 | postgresql, spring-batch, spring-boot | <h1>Spring Batch / Postgres : ERROR: relation "batch_job_instance" does not exist</h1>
<p>I am trying to configure Spring Batch to use PostGres DB. I have included the following dependencies in my <code>build.gradle.kts</code> file:</p>
<pre><code>implementation("org.springframework.boot:spring-boot-starter-data-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,841 | cmd | # Spring Batch / Postgres : ERROR: relation "batch_job_instance" does not exist
I am trying to configure Spring Batch to use PostGres DB. I have included the following dependencies in my `build.gradle.kts` file:
```
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.postgresql... | Please check below added in application.yml
```
spring.batch.initialize-schema: always
```
Please check below dependencies are added
```
<artifactId>spring-boot-starter-batch</artifactId>
``` |
12328744 | Why I am getting "Echo is on" when trying to print a variable in batch | 18 | 2012-09-08 07:00:05 | <p>I tring to excute a simple batch file scripts :</p>
<pre><code>echo %1
set var = %1
echo %var%
</code></pre>
<p>When I am running it in XP, it is giving me expected output, but When I am running it in Vista or windows 7, I am getting "Echo is On" when trying to print (echo) value.</p>
<p>Below is the output of p... | 26,465 | 1,656,253 | 2022-09-14 21:04:51 | 12,329,235 | 22 | 2012-09-08 08:27:43 | 321,866 | 2012-09-08 08:27:43 | https://stackoverflow.com/q/12328744 | https://stackoverflow.com/a/12329235 | <p>Get rid of the spaces in your set expression. There can and should be no spaces on either side of the equal sign (=)</p>
<pre><code>set var=%1
</code></pre>
<p>BTW: I usually start all my batch files with @echo off, and end them with @echo on too, so I can avoid mixing code with the output of the batch file. It ju... | <p>Get rid of the spaces in your set expression. There can and should be no spaces on either side of the equal sign (=)</p> <pre><code>set var=%1 </code></pre> <p>BTW: I usually start all my batch files with @echo off, and end them with @echo on too, so I can avoid mixing code with the output of the batch file. It ju... | 64, 5370, 7002, 34595 | batch-file, dos, windows, windows-7 | <h1>Why I am getting "Echo is on" when trying to print a variable in batch</h1>
<p>I tring to excute a simple batch file scripts :</p>
<pre><code>echo %1
set var = %1
echo %var%
</code></pre>
<p>When I am running it in XP, it is giving me expected output, but When I am running it in Vista or windows 7, I am getting ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,842 | cmd | # Why I am getting "Echo is on" when trying to print a variable in batch
I tring to excute a simple batch file scripts :
```
echo %1
set var = %1
echo %var%
```
When I am running it in XP, it is giving me expected output, but When I am running it in Vista or windows 7, I am getting "Echo is On" when trying to print ... | Get rid of the spaces in your set expression. There can and should be no spaces on either side of the equal sign (=)
```
set var=%1
```
BTW: I usually start all my batch files with @echo off, and end them with @echo on too, so I can avoid mixing code with the output of the batch file. It just makes your batch file ou... |
34473934 | How can I convert a Windows short name path into long names within a batch script | 17 | 2015-12-26 18:15:35 | <p>I am writing a Windows batch script, and I have an argument or variable containing a path that uses short 8.3 names. The path might represent a file or folder.</p>
<p>How can I convert the 8.3 path into a long-name path? At a minimum I would like to be able to simply print out the full long-name path. But ideally I... | 9,210 | 1,012,053 | 2023-04-02 19:26:07 | 34,473,971 | 22 | 2015-12-26 18:19:36 | 1,012,053 | 2023-01-23 23:23:56 | https://stackoverflow.com/q/34473934 | https://stackoverflow.com/a/34473971 | <p>First I will demonstrate how to convert a batch file argument <code>%1</code> and print the result to the screen.</p>
<p><strong>PowerShell</strong></p>
<p>The simplest solution is to use PowerShell. I found the following code on a <a href="http://blogs.msdn.com/b/sergey_babkins_blog/archive/2015/04/01/how-to-conver... | <p>First I will demonstrate how to convert a batch file argument <code>%1</code> and print the result to the screen.</p> <p><strong>PowerShell</strong></p> <p>The simplest solution is to use PowerShell. I found the following code on a <a href="http://blogs.msdn.com/b/sergey_babkins_blog/archive/2015/04/01/how-to-conver... | 7002, 27094, 37114 | batch-file, long-filenames, short-filenames | <h1>How can I convert a Windows short name path into long names within a batch script</h1>
<p>I am writing a Windows batch script, and I have an argument or variable containing a path that uses short 8.3 names. The path might represent a file or folder.</p>
<p>How can I convert the 8.3 path into a long-name path? At a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,843 | cmd | # How can I convert a Windows short name path into long names within a batch script
I am writing a Windows batch script, and I have an argument or variable containing a path that uses short 8.3 names. The path might represent a file or folder.
How can I convert the 8.3 path into a long-name path? At a minimum I would... | First I will demonstrate how to convert a batch file argument `%1` and print the result to the screen.
**PowerShell**
The simplest solution is to use PowerShell. I found the following code on a [MSDN blog by Sergey Babkin](http://blogs.msdn.com/b/sergey_babkins_blog/archive/2015/04/01/how-to-convert-a-short-8-3-path-... |
15171255 | How to open ports on Windows firewall through batch file | 17 | 2013-03-02 05:53:17 | <p>Is there any way within a batch file to open up specific ports on Windows through a batch file? It would be nice to have the installer do this for our server application rather than having the user manually do it.</p>
| 49,037 | 39,371 | 2018-11-29 13:56:32 | 15,171,585 | 22 | 2013-03-02 06:36:22 | 654,946 | 2018-11-29 13:56:32 | https://stackoverflow.com/q/15171255 | https://stackoverflow.com/a/15171585 | <p>Use <a href="http://technet.microsoft.com/en-us/library/cc771920%28v=ws.10%29.aspx" rel="nofollow noreferrer">netsh.exe</a>. A <strong>very</strong> simple batch file that takes a port argument:</p>
<pre><code>@echo off
rem -- open port (first argument passed to batch script)
netsh advfirewall firewall add rule nam... | <p>Use <a href="http://technet.microsoft.com/en-us/library/cc771920%28v=ws.10%29.aspx" rel="nofollow noreferrer">netsh.exe</a>. A <strong>very</strong> simple batch file that takes a port argument:</p> <pre><code>@echo off rem -- open port (first argument passed to batch script) netsh advfirewall firewall add rule nam... | 64, 700, 2045, 2631, 7002 | batch-file, cmd, firewall, port, windows | <h1>How to open ports on Windows firewall through batch file</h1>
<p>Is there any way within a batch file to open up specific ports on Windows through a batch file? It would be nice to have the installer do this for our server application rather than having the user manually do it.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,844 | cmd | # How to open ports on Windows firewall through batch file
Is there any way within a batch file to open up specific ports on Windows through a batch file? It would be nice to have the installer do this for our server application rather than having the user manually do it. | Use [netsh.exe](http://technet.microsoft.com/en-us/library/cc771920%28v=ws.10%29.aspx). A **very** simple batch file that takes a port argument:
```
@echo off
rem -- open port (first argument passed to batch script)
netsh advfirewall firewall add rule name="Open Port %1" dir=in action=allow protocol=TCP localport=%1 r... |
13372299 | Run autostart_console.bat on startup or new tab in ConEmu? | 15 | 2012-11-14 02:46:49 | <p>I am using ConEmu (robust cmd) on Windows 8 Pro. </p>
<p>How/where can I set conemu to run autostart_console.bat when starting ConEmu or when opening a new tab?</p>
<p>Thank you.</p>
| 12,320 | 913,295 | 2016-11-12 09:16:10 | 13,374,719 | 22 | 2012-11-14 07:39:02 | 1,405,560 | 2012-11-14 07:39:02 | https://stackoverflow.com/q/13372299 | https://stackoverflow.com/a/13374719 | <p>In most cases you need to use following command in <code>Command line</code> field (Settings -> Startup).</p>
<pre><code>cmd /k autostart_console.bat
</code></pre>
<p>If you need to start other shell (not cmd.exe), for example <a href="http://www.farmanager.com/" rel="noreferrer">Far Manager</a></p>
<pre><code>cm... | <p>In most cases you need to use following command in <code>Command line</code> field (Settings -> Startup).</p> <pre><code>cmd /k autostart_console.bat </code></pre> <p>If you need to start other shell (not cmd.exe), for example <a href="http://www.farmanager.com/" rel="noreferrer">Far Manager</a></p> <pre><code>cm... | 2631, 69665, 85755 | cmd, conemu, windows-8 | <h1>Run autostart_console.bat on startup or new tab in ConEmu?</h1>
<p>I am using ConEmu (robust cmd) on Windows 8 Pro. </p>
<p>How/where can I set conemu to run autostart_console.bat when starting ConEmu or when opening a new tab?</p>
<p>Thank you.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,845 | cmd | # Run autostart_console.bat on startup or new tab in ConEmu?
I am using ConEmu (robust cmd) on Windows 8 Pro.
How/where can I set conemu to run autostart_console.bat when starting ConEmu or when opening a new tab?
Thank you. | In most cases you need to use following command in `Command line` field (Settings -> Startup).
```
cmd /k autostart_console.bat
```
If you need to start other shell (not cmd.exe), for example [Far Manager](http://www.farmanager.com/)
```
cmd /c autostart_console.bat & far.exe
```
Full paths to autostart_console.bat... |
2195223 | batch file to copy files to another location? | 15 | 2010-02-03 20:33:06 | <p>Is it possible to create a batch file to copy a folder to another location everytime I login, or when the folder is updated?</p>
<p>It could be written in VB or Java as well if not an easy solution.</p>
<p>Any ideas?</p>
| 218,284 | 99,329 | 2021-01-04 09:39:39 | 2,195,269 | 22 | 2010-02-03 20:38:56 | 113,794 | 2016-10-21 12:17:15 | https://stackoverflow.com/q/2195223 | https://stackoverflow.com/a/2195269 | <p>Two approaches:</p>
<ul>
<li><p>When you login: you can to create a <code>copy_my_files.bat</code> file into your <code>All Programs > Startup</code> folder with this content (its a plain text document):</p>
<ul>
<li><code>xcopy c:\folder\*.* d:\another_folder\.</code></li>
</ul>
<p>Use <code>xcopy c:\folder\*... | <p>Two approaches:</p> <ul> <li><p>When you login: you can to create a <code>copy_my_files.bat</code> file into your <code>All Programs > Startup</code> folder with this content (its a plain text document):</p> <ul> <li><code>xcopy c:\folder\*.* d:\another_folder\.</code></li> </ul> <p>Use <code>xcopy c:\folder\*... | 7002 | batch-file | <h1>batch file to copy files to another location?</h1>
<p>Is it possible to create a batch file to copy a folder to another location everytime I login, or when the folder is updated?</p>
<p>It could be written in VB or Java as well if not an easy solution.</p>
<p>Any ideas?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,846 | cmd | # batch file to copy files to another location?
Is it possible to create a batch file to copy a folder to another location everytime I login, or when the folder is updated?
It could be written in VB or Java as well if not an easy solution.
Any ideas? | Two approaches:
- When you login: you can to create a `copy_my_files.bat` file into your `All Programs > Startup` folder with this content (its a plain text document):
- `xcopy c:\folder\*.* d:\another_folder\.`
Use `xcopy c:\folder\*.* d:\another_folder\. /Y` to overwrite the file without any prompt.
- Everytim... |
43344914 | JBoss: How to ignore Press any key to continue, without editing the jboss-cli.bat? | 14 | 2017-04-11 11:41:40 | <p>We are trying to read the JBoss status using the <code>jboss-cli.bat</code> command.</p>
<pre><code>jboss-cli.bat -c --command=":read-attribute(name=server-state)" > "$env:JBOSS_HOME\JbossServerStatus.txt"
</code></pre>
<p>Storing the status in the <code>TXT</code> file. Since "<strong>Press any key to continue... | 4,891 | 3,227,430 | 2017-04-11 15:47:04 | 43,350,662 | 22 | 2017-04-11 15:47:04 | 2,861,476 | 2017-04-11 15:47:04 | https://stackoverflow.com/q/43344914 | https://stackoverflow.com/a/43350662 | <p>The <code>jboss-cli.bat</code> includes a line as </p>
<pre><code> if "x%NOPAUSE%" == "x" pause
</code></pre>
<p>so, we only need to declare a environment variable called <code>NOPAUSE</code> and set it to some value before calling the <code>jboss-cli.bat</code></p>
<pre><code>set "NOPAUSE=true"
jboss-cli.bat ...... | <p>The <code>jboss-cli.bat</code> includes a line as </p> <pre><code> if "x%NOPAUSE%" == "x" pause </code></pre> <p>so, we only need to declare a environment variable called <code>NOPAUSE</code> and set it to some value before calling the <code>jboss-cli.bat</code></p> <pre><code>set "NOPAUSE=true" jboss-cli.bat ...... | 1188, 7002, 105232 | batch-file, jboss, jboss-cli | <h1>JBoss: How to ignore Press any key to continue, without editing the jboss-cli.bat?</h1>
<p>We are trying to read the JBoss status using the <code>jboss-cli.bat</code> command.</p>
<pre><code>jboss-cli.bat -c --command=":read-attribute(name=server-state)" > "$env:JBOSS_HOME\JbossServerStatus.txt"
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,847 | cmd | # JBoss: How to ignore Press any key to continue, without editing the jboss-cli.bat?
We are trying to read the JBoss status using the `jboss-cli.bat` command.
```
jboss-cli.bat -c --command=":read-attribute(name=server-state)" > "$env:JBOSS_HOME\JbossServerStatus.txt"
```
Storing the status in the `TXT` file. Since ... | The `jboss-cli.bat` includes a line as
```
if "x%NOPAUSE%" == "x" pause
```
so, we only need to declare a environment variable called `NOPAUSE` and set it to some value before calling the `jboss-cli.bat`
```
set "NOPAUSE=true"
jboss-cli.bat .....
```
If the `joss-cli.bat` is being called from a powershell script (... |
15143259 | Adding flags to a batch script | 14 | 2013-02-28 18:46:05 | <p>I'm writing a Batch script that will run on a directory. I want to be able to add a flag (such as -r or /r or something like that) that will make the script run the folder tree instead of the single directory. Is it possible to add flag options using batch?</p>
<p>Thanks</p>
| 27,756 | 2,120,769 | 2013-02-28 20:12:22 | 15,143,832 | 22 | 2013-02-28 19:17:04 | 2,073,862 | 2013-02-28 20:12:22 | https://stackoverflow.com/q/15143259 | https://stackoverflow.com/a/15143832 | <p>Certainly it's possible. Command line parameters are passed in to your batch file as %1, %2, etc. (%0 is the name of the batch file.)</p>
<pre><code>IF "%1"=="/r" ECHO You passed the /r flag.
</code></pre>
<p>Use <code>SHIFT</code> to drop the first argument and move all the others over by one. You can use that... | <p>Certainly it's possible. Command line parameters are passed in to your batch file as %1, %2, etc. (%0 is the name of the batch file.)</p> <pre><code>IF "%1"=="/r" ECHO You passed the /r flag. </code></pre> <p>Use <code>SHIFT</code> to drop the first argument and move all the others over by one. You can use that... | 1079, 7002 | batch-file, flags | <h1>Adding flags to a batch script</h1>
<p>I'm writing a Batch script that will run on a directory. I want to be able to add a flag (such as -r or /r or something like that) that will make the script run the folder tree instead of the single directory. Is it possible to add flag options using batch?</p>
<p>Thanks</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,848 | cmd | # Adding flags to a batch script
I'm writing a Batch script that will run on a directory. I want to be able to add a flag (such as -r or /r or something like that) that will make the script run the folder tree instead of the single directory. Is it possible to add flag options using batch?
Thanks | Certainly it's possible. Command line parameters are passed in to your batch file as %1, %2, etc. (%0 is the name of the batch file.)
```
IF "%1"=="/r" ECHO You passed the /r flag.
```
Use `SHIFT` to drop the first argument and move all the others over by one. You can use that to get a bit fancier if you want to allo... |
45257856 | How do you de-normalise? | 13 | 2017-07-22 18:28:31 | <p>Once you do normalisation of your data so the values are between 0-1, how do you de-normalise it so you can interpret the result?</p>
<p>So when you normalise your data, and feed it to your network and get an output which is normalised data. How do you reverse normalisation to get the original data?</p>
| 14,667 | 7,102,029 | 2023-04-09 15:21:34 | 45,259,665 | 22 | 2017-07-22 22:07:56 | 4,640,905 | 2017-07-22 22:07:56 | https://stackoverflow.com/q/45257856 | https://stackoverflow.com/a/45259665 | <p>If you have some data <code>d</code> that you normalize to 0-1 by doing (something like)</p>
<pre><code>min_d = np.min(d)
max_d = np.max(d)
normalized_d = (d - min_d) / (max_d - min_d)
</code></pre>
<p>you can de-normalize this by inverting the normalization. In this case</p>
<pre><code>denormalized_d = normalize... | <p>If you have some data <code>d</code> that you normalize to 0-1 by doing (something like)</p> <pre><code>min_d = np.min(d) max_d = np.max(d) normalized_d = (d - min_d) / (max_d - min_d) </code></pre> <p>you can de-normalize this by inverting the normalization. In this case</p> <pre><code>denormalized_d = normalize... | 40102, 112144, 115813, 124994 | batch-normalization, keras, neural-network, tensorflow | <h1>How do you de-normalise?</h1>
<p>Once you do normalisation of your data so the values are between 0-1, how do you de-normalise it so you can interpret the result?</p>
<p>So when you normalise your data, and feed it to your network and get an output which is normalised data. How do you reverse normalisation to get ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,849 | cmd | # How do you de-normalise?
Once you do normalisation of your data so the values are between 0-1, how do you de-normalise it so you can interpret the result?
So when you normalise your data, and feed it to your network and get an output which is normalised data. How do you reverse normalisation to get the original dat... | If you have some data `d` that you normalize to 0-1 by doing (something like)
```
min_d = np.min(d)
max_d = np.max(d)
normalized_d = (d - min_d) / (max_d - min_d)
```
you can de-normalize this by inverting the normalization. In this case
```
denormalized_d = normalized_d * (max_d - min_d) + min_d
``` |
34077831 | How to see if a string contains a substring using batch | 13 | 2015-12-03 22:56:35 | <p>Currently trying to see if a string, in this case the current line of a text file, contains a substring <code>#</code>. I am new to batch, so I am not sure exactly how I would do something like this. Here is the code
<code>set substring = #</code></p>
<pre><code>for /f "delims=," %%a in (Text.txt) do (
set stri... | 61,543 | 5,293,898 | 2020-08-07 19:46:15 | 34,077,870 | 22 | 2015-12-03 22:59:51 | 2,128,947 | 2015-12-03 22:59:51 | https://stackoverflow.com/q/34077831 | https://stackoverflow.com/a/34077870 | <pre><code>echo %%a|find "substring" >nul
if errorlevel 1 (echo notfound) else (echo found)
</code></pre>
<p>Batch is sensitive to spaces in a <code>SET</code> statement. <code>SET FLAG = N</code> sets a variable named "FLAG<kbd>Space</kbd>" to a value of "<kbd>Space</kbd>N"</p>
<p>The syntax <code>SET "var=value"... | <pre><code>echo %%a|find "substring" >nul if errorlevel 1 (echo notfound) else (echo found) </code></pre> <p>Batch is sensitive to spaces in a <code>SET</code> statement. <code>SET FLAG = N</code> sets a variable named "FLAG<kbd>Space</kbd>" to a value of "<kbd>Space</kbd>N"</p> <p>The syntax <code>SET "var=value"... | 139, 4371, 5310, 7002 | batch-file, file, string, substring | <h1>How to see if a string contains a substring using batch</h1>
<p>Currently trying to see if a string, in this case the current line of a text file, contains a substring <code>#</code>. I am new to batch, so I am not sure exactly how I would do something like this. Here is the code
<code>set substring = #</code></p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,850 | cmd | # How to see if a string contains a substring using batch
Currently trying to see if a string, in this case the current line of a text file, contains a substring `#`. I am new to batch, so I am not sure exactly how I would do something like this. Here is the code
`set substring = #`
```
for /f "delims=," %%a in (Text... | ```
echo %%a|find "substring" >nul
if errorlevel 1 (echo notfound) else (echo found)
```
Batch is sensitive to spaces in a `SET` statement. `SET FLAG = N` sets a variable named "FLAG`Space`" to a value of "`Space`N"
The syntax `SET "var=value"` (where value may be empty) is used to ensure that any stray trailing spac... |
32035577 | 'cmd' is not recognized as an internal or external command, operable program or batch file | 13 | 2015-08-16 13:28:28 | <p>When I build my project in netbeans me it shows:</p>
<pre><code>'cmd' is not recognized as an internal or external command,
operable program or batch file.`
</code></pre>
<p>I'm using jdk 8 and maven 3.3. My path system variable is:</p>
<pre><code>%SystemRoot%\system32;%SystemRoot%;D:\POS\apache-maven-3.3.3-bin... | 113,811 | 4,286,824 | 2024-01-31 22:08:21 | 32,035,723 | 22 | 2015-08-16 13:42:35 | 3,654,356 | 2015-08-16 13:42:35 | https://stackoverflow.com/q/32035577 | https://stackoverflow.com/a/32035723 | <p>So far I understand this is not your <strong>IDE</strong> issue.Check your "system32" is correctly defined in the PATH environment variable .</p>
<pre><code>Path = %SystemRoot%\system32;
</code></pre>
| <p>So far I understand this is not your <strong>IDE</strong> issue.Check your "system32" is correctly defined in the PATH environment variable .</p> <pre><code>Path = %SystemRoot%\system32; </code></pre> | 17, 7002, 39087, 102232 | batch-file, java, maven-3, netbeans-8 | <h1>'cmd' is not recognized as an internal or external command, operable program or batch file</h1>
<p>When I build my project in netbeans me it shows:</p>
<pre><code>'cmd' is not recognized as an internal or external command,
operable program or batch file.`
</code></pre>
<p>I'm using jdk 8 and maven 3.3. My path ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,851 | cmd | # 'cmd' is not recognized as an internal or external command, operable program or batch file
When I build my project in netbeans me it shows:
```
'cmd' is not recognized as an internal or external command,
operable program or batch file.`
```
I'm using jdk 8 and maven 3.3. My path system variable is:
```
%SystemRo... | So far I understand this is not your **IDE** issue.Check your "system32" is correctly defined in the PATH environment variable .
```
Path = %SystemRoot%\system32;
``` |
51867874 | Run command with drag and drop onto batch file | 12 | 2018-08-15 23:49:44 | <p>I want to drag and drop a file onto a batch file in order to run the below command on it. How do I go about running the command on the dropped file?</p>
<pre><code>PotreeConverter.exe <dropped file> -o C:/output -p index
</code></pre>
| 31,662 | 7,165,921 | 2025-02-03 03:30:28 | 51,867,900 | 22 | 2018-08-15 23:55:53 | 2,414,894 | 2025-02-03 03:30:28 | https://stackoverflow.com/q/51867874 | https://stackoverflow.com/a/51867900 | <p>The <code>path</code> of the file, when you drop it on the <code>BAT</code>file, will be returned as a normal <code>%1</code> argument.</p>
<p>so :</p>
<pre><code>@echo off
PotreeConverter.exe "%~1" -o C:/output -p index
</code></pre>
<p>You can use <code>%*</code> if you drop more than one file</p>
<p>Exa... | <p>The <code>path</code> of the file, when you drop it on the <code>BAT</code>file, will be returned as a normal <code>%1</code> argument.</p> <p>so :</p> <pre><code>@echo off PotreeConverter.exe "%~1" -o C:/output -p index </code></pre> <p>You can use <code>%*</code> if you drop more than one file</p> <p>Exa... | 2631, 7002 | batch-file, cmd | <h1>Run command with drag and drop onto batch file</h1>
<p>I want to drag and drop a file onto a batch file in order to run the below command on it. How do I go about running the command on the dropped file?</p>
<pre><code>PotreeConverter.exe <dropped file> -o C:/output -p index
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,852 | cmd | # Run command with drag and drop onto batch file
I want to drag and drop a file onto a batch file in order to run the below command on it. How do I go about running the command on the dropped file?
```
PotreeConverter.exe <dropped file> -o C:/output -p index
``` | The `path` of the file, when you drop it on the `BAT`file, will be returned as a normal `%1` argument.
so :
```
@echo off
PotreeConverter.exe "%~1" -o C:/output -p index
```
You can use `%*` if you drop more than one file
Example that handles several files:
```
@echo off
for %%a in (%*) do echo [%%a] was dropped ... |
16831232 | Command are ignored after ant command in batch file | 12 | 2013-05-30 08:22:57 | <p>Following is the bat script code block on which i am working on:</p>
<pre><code>ECHO off
IF NOT EXIST "%ANT_HOME%" (
SET ANT_HOME=%~dp0%build\apache-ant-1.8.2
SET ANT_BIN=%~dp0%build\apache-ant-1.8.2\bin
SET PATH | FIND "%ANT_HOME%;%ANT_BIN%"
)
cd "build\Run"
ant -q
cd ../..
echo "Program Termin... | 5,240 | 1,923,575 | 2015-05-27 10:14:00 | 16,831,269 | 22 | 2013-05-30 08:25:10 | 14,860 | 2013-05-30 08:25:10 | https://stackoverflow.com/q/16831232 | https://stackoverflow.com/a/16831269 | <p>You may find that the <code>ant</code> being run is a batch file itself, in which case it simply chains to it (no return).</p>
<p>You should try this instead:</p>
<pre><code>call ant -q
</code></pre>
<p>Calling a batch file (as opposed to chaining) will correctly return to the point after which you called it.</p>... | <p>You may find that the <code>ant</code> being run is a batch file itself, in which case it simply chains to it (no return).</p> <p>You should try this instead:</p> <pre><code>call ant -q </code></pre> <p>Calling a batch file (as opposed to chaining) will correctly return to the point after which you called it.</p>... | 142, 7002 | ant, batch-file | <h1>Command are ignored after ant command in batch file</h1>
<p>Following is the bat script code block on which i am working on:</p>
<pre><code>ECHO off
IF NOT EXIST "%ANT_HOME%" (
SET ANT_HOME=%~dp0%build\apache-ant-1.8.2
SET ANT_BIN=%~dp0%build\apache-ant-1.8.2\bin
SET PATH | FIND "%ANT_HOME%;%ANT... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,854 | cmd | # Command are ignored after ant command in batch file
Following is the bat script code block on which i am working on:
```
ECHO off
IF NOT EXIST "%ANT_HOME%" (
SET ANT_HOME=%~dp0%build\apache-ant-1.8.2
SET ANT_BIN=%~dp0%build\apache-ant-1.8.2\bin
SET PATH | FIND "%ANT_HOME%;%ANT_BIN%"
)
cd "build\R... | You may find that the `ant` being run is a batch file itself, in which case it simply chains to it (no return).
You should try this instead:
```
call ant -q
```
Calling a batch file (as opposed to chaining) will correctly return to the point after which you called it. |
7805510 | Set variable in "if" block | 12 | 2011-10-18 10:05:10 | <p>The following program always echoes "machine-abc" in the end:</p>
<pre><code>@echo Off
set dropLoc=machine-abc
IF %computername% == "xyz" (
%dropLoc% = machine-xyz
)
echo %dropLoc%
</code></pre>
<p>Is this a scope issue? Does the dropLoc variable in the if statement have a different scope? I have tried the follo... | 57,258 | 46,279 | 2016-12-28 18:41:57 | 7,805,538 | 22 | 2011-10-18 10:07:34 | 596,781 | 2011-10-18 10:18:07 | https://stackoverflow.com/q/7805510 | https://stackoverflow.com/a/7805538 | <p>You got the <code>SET</code> syntax right the first time, how come you decided to write something else the second time round? Also, you have to add the quotation marks on both sides of the comparison. Unlike in other script interpreters, quotation marks aren't special for the batch interpreter.</p>
<pre><code>@echo... | <p>You got the <code>SET</code> syntax right the first time, how come you decided to write something else the second time round? Also, you have to add the quotation marks on both sides of the comparison. Unlike in other script interpreters, quotation marks aren't special for the batch interpreter.</p> <pre><code>@echo... | 64, 2631, 2773, 7002 | batch-file, cmd, if-statement, windows | <h1>Set variable in "if" block</h1>
<p>The following program always echoes "machine-abc" in the end:</p>
<pre><code>@echo Off
set dropLoc=machine-abc
IF %computername% == "xyz" (
%dropLoc% = machine-xyz
)
echo %dropLoc%
</code></pre>
<p>Is this a scope issue? Does the dropLoc variable in the if statement have a dif... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,855 | cmd | # Set variable in "if" block
The following program always echoes "machine-abc" in the end:
```
@echo Off
set dropLoc=machine-abc
IF %computername% == "xyz" (
%dropLoc% = machine-xyz
)
echo %dropLoc%
```
Is this a scope issue? Does the dropLoc variable in the if statement have a different scope? I have tried the fo... | You got the `SET` syntax right the first time, how come you decided to write something else the second time round? Also, you have to add the quotation marks on both sides of the comparison. Unlike in other script interpreters, quotation marks aren't special for the batch interpreter.
```
@echo off
rem Change this for... |
3904750 | How to run Windows command in chain | 12 | 2010-10-11 08:50:28 | <p>I found the bat file from here:</p>
<p><a href="http://www.dostips.com/DtCodeBatchFiles.php#Batch.FindAndReplace" rel="nofollow noreferrer">http://www.dostips.com/DtCodeBatchFiles.php#Batch.FindAndReplace</a></p>
<p>I want to run another command after this bat, but it doesn't work. I guess there must be something wr... | 14,047 | 143,480 | 2020-10-20 18:29:25 | 3,904,760 | 22 | 2010-10-11 08:52:21 | 48,387 | 2010-10-11 08:52:21 | https://stackoverflow.com/q/3904750 | https://stackoverflow.com/a/3904760 | <p>You can chain commands in dos using the && for example</p>
<pre><code>echo hello&&echo world
</code></pre>
| <p>You can chain commands in dos using the && for example</p> <pre><code>echo hello&&echo world </code></pre> | 64, 2631, 7002 | batch-file, cmd, windows | <h1>How to run Windows command in chain</h1>
<p>I found the bat file from here:</p>
<p><a href="http://www.dostips.com/DtCodeBatchFiles.php#Batch.FindAndReplace" rel="nofollow noreferrer">http://www.dostips.com/DtCodeBatchFiles.php#Batch.FindAndReplace</a></p>
<p>I want to run another command after this bat, but it doe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,856 | cmd | # How to run Windows command in chain
I found the bat file from here:
<http://www.dostips.com/DtCodeBatchFiles.php#Batch.FindAndReplace>
I want to run another command after this bat, but it doesn't work. I guess there must be something wrong the the code the site provides. Anyone can give me a clue? | You can chain commands in dos using the && for example
```
echo hello&&echo world
``` |
34867023 | Windows Batch file launch a gui with buttons | 11 | 2016-01-19 01:23:51 | <p>How can I create a window with multiple buttons in which do not go away apon clicking them. I'm trying to make a simple Windowed Box with buttons that can open programs. I've been using WBox.exe for my gui, however it closes the window before the program launches when you press any button.
HTML crossed my mind, but ... | 56,537 | 5,786,856 | 2025-09-25 07:05:39 | 34,870,295 | 22 | 2016-01-19 06:54:20 | 778,560 | 2016-01-19 06:54:20 | https://stackoverflow.com/q/34867023 | https://stackoverflow.com/a/34870295 | <p>You may do that in a relatively simple way via a Batch-HTA <em>hybrid file</em>; this is an example:</p>
<pre><code><!-- :: Batch section
@echo off
setlocal
echo Select an option:
for /F "delims=" %%a in ('mshta.exe "%~F0"') do set "HTAreply=%%a"
echo End of HTA window, reply: "%HTAreply%"
goto :EOF
-->
&l... | <p>You may do that in a relatively simple way via a Batch-HTA <em>hybrid file</em>; this is an example:</p> <pre><code><!-- :: Batch section @echo off setlocal echo Select an option: for /F "delims=" %%a in ('mshta.exe "%~F0"') do set "HTAreply=%%a" echo End of HTA window, reply: "%HTAreply%" goto :EOF --> &l... | 64, 865, 5052, 7002, 9002 | batch-file, button, menu, user-interface, windows | <h1>Windows Batch file launch a gui with buttons</h1>
<p>How can I create a window with multiple buttons in which do not go away apon clicking them. I'm trying to make a simple Windowed Box with buttons that can open programs. I've been using WBox.exe for my gui, however it closes the window before the program launches... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,858 | cmd | # Windows Batch file launch a gui with buttons
How can I create a window with multiple buttons in which do not go away apon clicking them. I'm trying to make a simple Windowed Box with buttons that can open programs. I've been using WBox.exe for my gui, however it closes the window before the program launches when you... | You may do that in a relatively simple way via a Batch-HTA *hybrid file*; this is an example:
```
<!-- :: Batch section
@echo off
setlocal
echo Select an option:
for /F "delims=" %%a in ('mshta.exe "%~F0"') do set "HTAreply=%%a"
echo End of HTA window, reply: "%HTAreply%"
goto :EOF
-->
<HTML>
<HEAD>
<HTA:APPLICATIO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.