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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7021873 | Check if JAVA_HOME is present in environment using batch script | 13 | 2011-08-11 06:44:10 | <p>I want to check whether JAVA_HOME is present in environment or not
So I wrote the below script <code>a.bat</code></p>
<pre><code>if "%JAVA_HOME%" == ""
(
echo Enter path to JAVA_HOME:
set /p javahome=
)
if not "%JAVA_HOME%" == ""
(
echo %JAVA_HOME%
)
</code></pre>
<p>It shows "The syntax of the command is incorr... | 88,328 | 707,414 | 2011-08-27 07:13:49 | 7,021,916 | 19 | 2011-08-11 06:49:22 | 128,660 | 2011-08-11 06:49:22 | https://stackoverflow.com/q/7021873 | https://stackoverflow.com/a/7021916 | <p>Try this:</p>
<pre><code>@echo off
IF "%JAVA_HOME%" == "" (
echo Enter path to JAVA_HOME:
set /p JAVA_HOME=
) ELSE (
echo %JAVA_HOME%
)
</code></pre>
| <p>Try this:</p> <pre><code>@echo off IF "%JAVA_HOME%" == "" ( echo Enter path to JAVA_HOME: set /p JAVA_HOME= ) ELSE ( echo %JAVA_HOME% ) </code></pre> | 64, 531, 7002 | batch-file, scripting, windows | <h1>Check if JAVA_HOME is present in environment using batch script</h1>
<p>I want to check whether JAVA_HOME is present in environment or not
So I wrote the below script <code>a.bat</code></p>
<pre><code>if "%JAVA_HOME%" == ""
(
echo Enter path to JAVA_HOME:
set /p javahome=
)
if not "%JAVA_HOME%" == ""
(
echo %JAV... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,968 | cmd | # Check if JAVA_HOME is present in environment using batch script
I want to check whether JAVA_HOME is present in environment or not
So I wrote the below script `a.bat`
```
if "%JAVA_HOME%" == ""
(
echo Enter path to JAVA_HOME:
set /p javahome=
)
if not "%JAVA_HOME%" == ""
(
echo %JAVA_HOME%
)
```
It shows "The sy... | Try this:
```
@echo off
IF "%JAVA_HOME%" == "" (
echo Enter path to JAVA_HOME:
set /p JAVA_HOME=
) ELSE (
echo %JAVA_HOME%
)
``` |
34820685 | Want to use VBScript to run .bat file in a different folder | 12 | 2016-01-15 22:07:09 | <p>I'm trying to run a .bat file using VBScript. I can get the VBScript to work when executed within the same folder as the .bat, however, I can't figure out how to make it successfully run when outside the folder.</p>
<pre><code>Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run "C:\Users\js\Desktop\creat... | 73,868 | 5,749,745 | 2020-07-22 03:03:50 | 34,833,831 | 19 | 2016-01-17 00:40:59 | 1,630,171 | 2016-01-17 00:40:59 | https://stackoverflow.com/q/34820685 | https://stackoverflow.com/a/34833831 | <p>Going out on a limb I would suspect that the batch script requires its own parent folder to be the working directory. You can set the working directory accordingly by changing your code to this:</p>
<pre><code>Set shell = CreateObject("WScript.Shell")
shell.CurrentDirectory = "C:\Users\js\Desktop\createIndex"
shell... | <p>Going out on a limb I would suspect that the batch script requires its own parent folder to be the working directory. You can set the working directory accordingly by changing your code to this:</p> <pre><code>Set shell = CreateObject("WScript.Shell") shell.CurrentDirectory = "C:\Users\js\Desktop\createIndex" shell... | 494, 7002 | batch-file, vbscript | <h1>Want to use VBScript to run .bat file in a different folder</h1>
<p>I'm trying to run a .bat file using VBScript. I can get the VBScript to work when executed within the same folder as the .bat, however, I can't figure out how to make it successfully run when outside the folder.</p>
<pre><code>Dim shell
Set shell... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,970 | cmd | # Want to use VBScript to run .bat file in a different folder
I'm trying to run a .bat file using VBScript. I can get the VBScript to work when executed within the same folder as the .bat, however, I can't figure out how to make it successfully run when outside the folder.
```
Dim shell
Set shell = CreateObject("WScr... | Going out on a limb I would suspect that the batch script requires its own parent folder to be the working directory. You can set the working directory accordingly by changing your code to this:
```
Set shell = CreateObject("WScript.Shell")
shell.CurrentDirectory = "C:\Users\js\Desktop\createIndex"
shell.Run "createin... |
29509074 | Reading line breaks in CSV which are quoted in the file in FlatfileItemReader of spring batch | 12 | 2015-04-08 08:00:22 | <p>I am trying to parse a CSV file with FlatFileItemReader. This CSV contains some quoted newline characters as shown below.</p>
<pre><code>email, name
abc@z.com, "NEW NAME
ABC"
</code></pre>
<p>But this parsing is failing with required fields are 2 but actual is 1.</p>
<p>What I am missing in my FlatFileReader con... | 7,596 | 1,486,762 | 2022-12-01 14:19:31 | 29,524,404 | 19 | 2015-04-08 20:09:42 | 62,201 | 2015-04-09 05:44:19 | https://stackoverflow.com/q/29509074 | https://stackoverflow.com/a/29524404 | <p>out of the box the FlatFileItemReader uses a <a href="http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/file/separator/SimpleRecordSeparatorPolicy.html">SimpleRecordSeparatorPolicy</a>, for your usecase </p>
<ul>
<li>commented part goes over 2 or more lines</li>
</ul>
<p>you need to s... | <p>out of the box the FlatFileItemReader uses a <a href="http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/file/separator/SimpleRecordSeparatorPolicy.html">SimpleRecordSeparatorPolicy</a>, for your usecase </p> <ul> <li>commented part goes over 2 or more lines</li> </ul> <p>you need to s... | 17, 73, 1211, 41895 | csv, java, spring, spring-batch | <h1>Reading line breaks in CSV which are quoted in the file in FlatfileItemReader of spring batch</h1>
<p>I am trying to parse a CSV file with FlatFileItemReader. This CSV contains some quoted newline characters as shown below.</p>
<pre><code>email, name
abc@z.com, "NEW NAME
ABC"
</code></pre>
<p>But this parsing is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,971 | cmd | # Reading line breaks in CSV which are quoted in the file in FlatfileItemReader of spring batch
I am trying to parse a CSV file with FlatFileItemReader. This CSV contains some quoted newline characters as shown below.
```
email, name
abc@z.com, "NEW NAME
ABC"
```
But this parsing is failing with required fields are... | out of the box the FlatFileItemReader uses a [SimpleRecordSeparatorPolicy](http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/file/separator/SimpleRecordSeparatorPolicy.html), for your usecase
- commented part goes over 2 or more lines
you need to set the [DefaultRecordSeparatorPolicy](ht... |
26989312 | forfiles without cmd /c | 12 | 2014-11-18 08:01:48 | <p>I can run a <a href="http://ss64.com/nt/forfiles.html"><code>forfiles</code></a> command with
<code>cmd /c</code>, as expected</p>
<pre>
C:\>forfiles /c "cmd /c ping /a"
IP address must be specified.
</pre>
<p>However if I remove the <code>cmd /c</code>, it no longer recognizes any arguments, only
the base command... | 3,494 | 1,002,260 | 2019-11-14 14:43:38 | 26,990,159 | 19 | 2014-11-18 08:55:06 | 2,861,476 | 2019-11-14 14:43:38 | https://stackoverflow.com/q/26989312 | https://stackoverflow.com/a/26990159 | <p><em>This is the original answer. Please read below the line for a complete analysis of the problem and a better way to solve it</em></p>
<p>Place two spaces between the command and its arguments</p>
<pre><code>forfiles /c "ping /a"
</code></pre>
<hr>
<p><strong>edited</strong> While the posted solution works fo... | <p><em>This is the original answer. Please read below the line for a complete analysis of the problem and a better way to solve it</em></p> <p>Place two spaces between the command and its arguments</p> <pre><code>forfiles /c "ping /a" </code></pre> <hr> <p><strong>edited</strong> While the posted solution works fo... | 2631, 136758 | cmd, forfiles | <h1>forfiles without cmd /c</h1>
<p>I can run a <a href="http://ss64.com/nt/forfiles.html"><code>forfiles</code></a> command with
<code>cmd /c</code>, as expected</p>
<pre>
C:\>forfiles /c "cmd /c ping /a"
IP address must be specified.
</pre>
<p>However if I remove the <code>cmd /c</code>, it no longer recognizes any... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,972 | cmd | # forfiles without cmd /c
I can run a [`forfiles`](http://ss64.com/nt/forfiles.html) command with
`cmd /c`, as expected
```
C:\>forfiles /c "cmd /c ping /a"
IP address must be specified.
```
However if I remove the `cmd /c`, it no longer recognizes any arguments, only
the base command
```
C:\>forfiles /c "ping /a"
... | *This is the original answer. Please read below the line for a complete analysis of the problem and a better way to solve it*
Place two spaces between the command and its arguments
```
forfiles /c "ping /a"
```
---
**edited** While the posted solution works for the OP question, it is not a complete answer, as ther... |
21281354 | java.io.IOException: Cannot run program "dir": CreateProcess error=2, Das System | 12 | 2014-01-22 11:14:42 | <p>Hello I try to run the following cmd code in eclipse:</p>
<pre><code> "DIR \""+DEV_HOME+"\\src\"\\*.java /b /s >> \""+DEV_HOME+"\\bin\\javaFiles.txt\""
</code></pre>
<p>In clear it looks like this:</p>
<pre><code>DIR "D:\Thomas\Dokumente\Daten\workspace\WBRLight\src"\*.java /b /s >> "D:\Thomas\Dokumen... | 25,437 | 2,889,693 | 2021-12-01 13:29:12 | 21,281,570 | 19 | 2014-01-22 11:23:41 | 1,619,462 | 2021-12-01 13:29:12 | https://stackoverflow.com/q/21281354 | https://stackoverflow.com/a/21281570 | <p>Add <code>"cmd.exe /c"</code> at the beginning of your command string, that should do the trick.</p>
<p>The <code>/c</code> parameter will make the <code>cmd</code> finish and return it to the Java process.<br />
Without it, the process will hang.</p>
| <p>Add <code>"cmd.exe /c"</code> at the beginning of your command string, that should do the trick.</p> <p>The <code>/c</code> parameter will make the <code>cmd</code> finish and return it to the Java process.<br /> Without it, the process will hang.</p> | 17, 53, 2631, 15431 | cmd, eclipse, ioexception, java | <h1>java.io.IOException: Cannot run program "dir": CreateProcess error=2, Das System</h1>
<p>Hello I try to run the following cmd code in eclipse:</p>
<pre><code> "DIR \""+DEV_HOME+"\\src\"\\*.java /b /s >> \""+DEV_HOME+"\\bin\\javaFiles.txt\""
</code></pre>
<p>In clear it looks like this:</p>
<pre><code>DIR "... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,973 | cmd | # java.io.IOException: Cannot run program "dir": CreateProcess error=2, Das System
Hello I try to run the following cmd code in eclipse:
```
"DIR \""+DEV_HOME+"\\src\"\\*.java /b /s >> \""+DEV_HOME+"\\bin\\javaFiles.txt\""
```
In clear it looks like this:
```
DIR "D:\Thomas\Dokumente\Daten\workspace\WBRLight\src"\... | Add `"cmd.exe /c"` at the beginning of your command string, that should do the trick.
The `/c` parameter will make the `cmd` finish and return it to the Java process.
Without it, the process will hang. |
16536743 | Make a line break when requesting user input (/P) in batch? | 12 | 2013-05-14 06:46:03 | <p>Is it possible to create a line break after a <code>set /P</code> command? I would like the user to be able to type on a new (blank) line instead of next to the existing prompt. For example:</p>
<pre><code>set /P test=type now
echo %test%
</code></pre>
<p>This code simply lets the user type next to the prompt.</p... | 12,326 | 2,380,196 | 2013-05-14 06:51:15 | 16,536,823 | 19 | 2013-05-14 06:51:15 | 14,860 | 2013-05-14 06:51:15 | https://stackoverflow.com/q/16536743 | https://stackoverflow.com/a/16536823 | <p>If you want input on the following line, just use:</p>
<pre><code>echo type now
set /p test=
echo %test%
</code></pre>
<p>The <code>echo</code> will output the prompt including the newline, then you just use <code>set /p</code> with <em>no</em> prompt.</p>
| <p>If you want input on the following line, just use:</p> <pre><code>echo type now set /p test= echo %test% </code></pre> <p>The <code>echo</code> will output the prompt including the newline, then you just use <code>set /p</code> with <em>no</em> prompt.</p> | 64, 3222, 3705, 7002, 9313 | batch-file, line-breaks, newline, user-input, windows | <h1>Make a line break when requesting user input (/P) in batch?</h1>
<p>Is it possible to create a line break after a <code>set /P</code> command? I would like the user to be able to type on a new (blank) line instead of next to the existing prompt. For example:</p>
<pre><code>set /P test=type now
echo %test%
</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,974 | cmd | # Make a line break when requesting user input (/P) in batch?
Is it possible to create a line break after a `set /P` command? I would like the user to be able to type on a new (blank) line instead of next to the existing prompt. For example:
```
set /P test=type now
echo %test%
```
This code simply lets the user ty... | If you want input on the following line, just use:
```
echo type now
set /p test=
echo %test%
```
The `echo` will output the prompt including the newline, then you just use `set /p` with *no* prompt. |
15025843 | How to call Run() with parameters | 12 | 2013-02-22 02:53:45 | <p>I've got this working line of code in Windows Batch</p>
<pre><code>start "" /wait /i "C:\Program Files\Sandboxie\Start.exe" /box:NetBeans /wait "C:\Program Files\NetBeans 7.3\bin\netbeans64.exe"
</code></pre>
<p>I would like to run it via VBScript. But I don't know how to pass the path in parameter which has a spa... | 86,526 | 1,459,951 | 2020-12-27 09:10:41 | 15,025,844 | 19 | 2013-02-22 03:19:52 | null | 2013-02-22 03:19:52 | https://stackoverflow.com/q/15025843 | https://stackoverflow.com/a/15025844 | <p>Within a literal string, a single double-quote character is represented by two double-quote characters. So try the following instead:</p>
<pre><code>Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run """C:\Program Files\Sandboxie\Start.exe"" /box:NetBeans /wait ""C:\Program Files\NetBeans 7.3\bin\net... | <p>Within a literal string, a single double-quote character is represented by two double-quote characters. So try the following instead:</p> <pre><code>Set objShell = WScript.CreateObject("WScript.Shell") objShell.Run """C:\Program Files\Sandboxie\Start.exe"" /box:NetBeans /wait ""C:\Program Files\NetBeans 7.3\bin\net... | 360, 494, 7002 | batch-file, parameters, vbscript | <h1>How to call Run() with parameters</h1>
<p>I've got this working line of code in Windows Batch</p>
<pre><code>start "" /wait /i "C:\Program Files\Sandboxie\Start.exe" /box:NetBeans /wait "C:\Program Files\NetBeans 7.3\bin\netbeans64.exe"
</code></pre>
<p>I would like to run it via VBScript. But I don't know how to... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,975 | cmd | # How to call Run() with parameters
I've got this working line of code in Windows Batch
```
start "" /wait /i "C:\Program Files\Sandboxie\Start.exe" /box:NetBeans /wait "C:\Program Files\NetBeans 7.3\bin\netbeans64.exe"
```
I would like to run it via VBScript. But I don't know how to pass the path in parameter which... | Within a literal string, a single double-quote character is represented by two double-quote characters. So try the following instead:
```
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run """C:\Program Files\Sandboxie\Start.exe"" /box:NetBeans /wait ""C:\Program Files\NetBeans 7.3\bin\netbeans64.exe"""... |
6357515 | Batch Files - Using ping to test network connectivity | 12 | 2011-06-15 12:14:03 | <p>Using a batch file would it be possible to do something like:</p>
<p>ping google.com</p>
<p>if return success do ECHO You are connected to the internet</p>
<p>else return ECHO You are not connected to the internet</p>
| 100,161 | 798,560 | 2024-11-27 00:35:51 | 6,357,629 | 19 | 2011-06-15 12:23:13 | 390,177 | 2011-06-15 12:23:13 | https://stackoverflow.com/q/6357515 | https://stackoverflow.com/a/6357629 | <p>You can use following snippet:</p>
<pre><code>@echo off
Ping www.google.de -n 1 -w 1000
if errorlevel 1 echo Not connected
</code></pre>
| <p>You can use following snippet:</p> <pre><code>@echo off Ping www.google.de -n 1 -w 1000 if errorlevel 1 echo Not connected </code></pre> | 64, 5310, 7002 | batch-file, file, windows | <h1>Batch Files - Using ping to test network connectivity</h1>
<p>Using a batch file would it be possible to do something like:</p>
<p>ping google.com</p>
<p>if return success do ECHO You are connected to the internet</p>
<p>else return ECHO You are not connected to the internet</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,976 | cmd | # Batch Files - Using ping to test network connectivity
Using a batch file would it be possible to do something like:
ping google.com
if return success do ECHO You are connected to the internet
else return ECHO You are not connected to the internet | You can use following snippet:
```
@echo off
Ping www.google.de -n 1 -w 1000
if errorlevel 1 echo Not connected
``` |
57906720 | extracting multiple files with 7zip & creating a folder for each | 11 | 2019-09-12 12:27:21 | <p>I have like 300 zip files (but may get other kind of archives in the future) in a folder and I need to unzip each one in a subfolder of the archive name.</p>
<p>I've tried native 7zip options in command line but nothing worked yet, did not get any luck in the 7zip FAQ either. Finally tried "forfiles" in batch and t... | 19,788 | 12,058,176 | 2025-05-12 05:58:03 | 57,907,078 | 19 | 2019-09-12 12:47:12 | 1,410,246 | 2025-05-12 05:58:03 | https://stackoverflow.com/q/57906720 | https://stackoverflow.com/a/57907078 | <p>There is a built in command for this in <em>7-Zip</em>.</p>
<p>This command line with the <em>7-Zip</em> command <code>x</code> extracts all ZIP files in the current directory (<code>*.zip</code>) to directories with names of archives (<code>-o*</code>).</p>
<p>Better option using default installation path on Window... | <p>There is a built in command for this in <em>7-Zip</em>.</p> <p>This command line with the <em>7-Zip</em> command <code>x</code> extracts all ZIP files in the current directory (<code>*.zip</code>) to directories with names of archives (<code>-o*</code>).</p> <p>Better option using default installation path on Window... | 5680, 7002 | 7zip, batch-file | <h1>extracting multiple files with 7zip & creating a folder for each</h1>
<p>I have like 300 zip files (but may get other kind of archives in the future) in a folder and I need to unzip each one in a subfolder of the archive name.</p>
<p>I've tried native 7zip options in command line but nothing worked yet, did not ge... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,979 | cmd | # extracting multiple files with 7zip & creating a folder for each
I have like 300 zip files (but may get other kind of archives in the future) in a folder and I need to unzip each one in a subfolder of the archive name.
I've tried native 7zip options in command line but nothing worked yet, did not get any luck in th... | There is a built in command for this in *7-Zip*.
This command line with the *7-Zip* command `x` extracts all ZIP files in the current directory (`*.zip`) to directories with names of archives (`-o*`).
Better option using default installation path on Windows (works in Terminal etc.):
```
"C:\Program Files\7-Zip\7z.ex... |
32559614 | How can I get return value ( string ) from called Python by BatchFile | 11 | 2015-09-14 07:46:26 | <p>I need to have some help.</p>
<p>I used python33 on Windows OS.</p>
<p>I want result it.</p>
<p>Call Python in Batch File.
( <code>python Testing.py %arg1% %arg2%</code> )</p>
<p>python is do return string value.
( <code>return('END') or exit('END')</code> )</p>
<p>and I want set BatchFile Variable
( <code>SET... | 24,668 | 4,049,295 | 2015-09-14 08:37:17 | 32,560,443 | 19 | 2015-09-14 08:37:17 | 2,382,792 | 2015-09-14 08:37:17 | https://stackoverflow.com/q/32559614 | https://stackoverflow.com/a/32560443 | <p>As far I have understood your question. You would like to execute a python script from a batch file and then would like to save the output of the python script to a variable in the batch file.</p>
<p>Here is my way (there could be a better way to do this). I am simply executing the python script <code>test2.py</cod... | <p>As far I have understood your question. You would like to execute a python script from a batch file and then would like to save the output of the python script to a variable in the batch file.</p> <p>Here is my way (there could be a better way to do this). I am simply executing the python script <code>test2.py</cod... | 16, 7002 | batch-file, python | <h1>How can I get return value ( string ) from called Python by BatchFile</h1>
<p>I need to have some help.</p>
<p>I used python33 on Windows OS.</p>
<p>I want result it.</p>
<p>Call Python in Batch File.
( <code>python Testing.py %arg1% %arg2%</code> )</p>
<p>python is do return string value.
( <code>return('END')... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,980 | cmd | # How can I get return value ( string ) from called Python by BatchFile
I need to have some help.
I used python33 on Windows OS.
I want result it.
Call Python in Batch File.
( `python Testing.py %arg1% %arg2%` )
python is do return string value.
( `return('END') or exit('END')` )
and I want set BatchFile Variable... | As far I have understood your question. You would like to execute a python script from a batch file and then would like to save the output of the python script to a variable in the batch file.
Here is my way (there could be a better way to do this). I am simply executing the python script `test2.py` from my batch file... |
29213106 | How to securely escape command line arguments for the cmd.exe shell on Windows? | 11 | 2015-03-23 14:40:32 | <p>Ok, I have a some command wich MUST be executed in <code>shell=True</code> mode.</p>
<p><code>os.system</code> or <code>subprocess.Popen(..., shell=True)</code></p>
<p>And this command contain string substitution like: <code>cmd = "some_secret_command {0}".format(string_from_user)</code></p>
<p>I want escape <cod... | 6,802 | 941,020 | 2022-05-09 23:32:53 | 29,215,357 | 19 | 2015-03-23 16:27:03 | 421,705 | 2022-05-09 23:32:53 | https://stackoverflow.com/q/29213106 | https://stackoverflow.com/a/29215357 | <p>The problem with quoting command lines for windows is that there are two layered parsing engines affected by your quotes. At first, there is the Shell (e.g. <code>cmd.exe</code>) which interprets some special characters. Then, there is the called program parsing the command line. This often happens with the <code>Co... | <p>The problem with quoting command lines for windows is that there are two layered parsing engines affected by your quotes. At first, there is the Shell (e.g. <code>cmd.exe</code>) which interprets some special characters. Then, there is the called program parsing the command line. This often happens with the <code>Co... | 16, 64, 2631 | cmd, python, windows | <h1>How to securely escape command line arguments for the cmd.exe shell on Windows?</h1>
<p>Ok, I have a some command wich MUST be executed in <code>shell=True</code> mode.</p>
<p><code>os.system</code> or <code>subprocess.Popen(..., shell=True)</code></p>
<p>And this command contain string substitution like: <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,981 | cmd | # How to securely escape command line arguments for the cmd.exe shell on Windows?
Ok, I have a some command wich MUST be executed in `shell=True` mode.
`os.system` or `subprocess.Popen(..., shell=True)`
And this command contain string substitution like: `cmd = "some_secret_command {0}".format(string_from_user)`
I w... | The problem with quoting command lines for windows is that there are two layered parsing engines affected by your quotes. At first, there is the Shell (e.g. `cmd.exe`) which interprets some special characters. Then, there is the called program parsing the command line. This often happens with the `CommandLineToArgvW` f... |
25044725 | Is there a Spring Batch 3 Upgrade Script for MySQL? | 11 | 2014-07-30 18:54:19 | <p>I haven't seen a script to do the DDL modification necessary to go from Spring Batch 2 -> 3 in MySQL. Curious if one exists?</p>
| 10,406 | 1,325,237 | 2016-12-22 17:29:58 | 25,044,930 | 19 | 2014-07-30 19:06:02 | 1,325,237 | 2014-07-30 19:06:02 | https://stackoverflow.com/q/25044725 | https://stackoverflow.com/a/25044930 | <p>After running a quick comparison of the schemas, these appear to be the changes for upgrading from Spring Batch 2.2.7.RELEASE -> 3.0.1.RELEASE on MySQL.</p>
<pre><code>ALTER TABLE `BATCH_JOB_EXECUTION` MODIFY COLUMN `EXIT_CODE` varchar(2500) DEFAULT NULL;
ALTER TABLE `BATCH_JOB_EXECUTION` ADD COLUMN `JOB_CONFIGURAT... | <p>After running a quick comparison of the schemas, these appear to be the changes for upgrading from Spring Batch 2.2.7.RELEASE -> 3.0.1.RELEASE on MySQL.</p> <pre><code>ALTER TABLE `BATCH_JOB_EXECUTION` MODIFY COLUMN `EXIT_CODE` varchar(2500) DEFAULT NULL; ALTER TABLE `BATCH_JOB_EXECUTION` ADD COLUMN `JOB_CONFIGURAT... | 17, 21, 1211, 41895 | java, mysql, spring, spring-batch | <h1>Is there a Spring Batch 3 Upgrade Script for MySQL?</h1>
<p>I haven't seen a script to do the DDL modification necessary to go from Spring Batch 2 -> 3 in MySQL. Curious if one exists?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,982 | cmd | # Is there a Spring Batch 3 Upgrade Script for MySQL?
I haven't seen a script to do the DDL modification necessary to go from Spring Batch 2 -> 3 in MySQL. Curious if one exists? | After running a quick comparison of the schemas, these appear to be the changes for upgrading from Spring Batch 2.2.7.RELEASE -> 3.0.1.RELEASE on MySQL.
```
ALTER TABLE `BATCH_JOB_EXECUTION` MODIFY COLUMN `EXIT_CODE` varchar(2500) DEFAULT NULL;
ALTER TABLE `BATCH_JOB_EXECUTION` ADD COLUMN `JOB_CONFIGURATION_LOCATION` ... |
24044966 | Batch File Exits After Running One Node Application Script | 11 | 2014-06-04 18:32:23 | <p>I need to run several UglifyJS2 scripts with Node. I've added the command I want to run to a bat file and it runs OK.</p>
<p>When I add a second command, like "cd ..", the command isn't executed! Very confusing.</p>
<pre><code>cd go somewhere
uglifyjs ..\somescript -o ..\somefile.min.js --source-map ..\somemap.js.... | 1,757 | 684,966 | 2014-06-04 18:58:23 | 24,045,449 | 19 | 2014-06-04 18:58:23 | 2,861,476 | 2014-06-04 18:58:23 | https://stackoverflow.com/q/24044966 | https://stackoverflow.com/a/24045449 | <p>I am not sure about your install, but probably you are calling a <code>uglifyjs.cmd</code> or <code>uglifyjs.bat</code>, and when you call a batch file from inside another batch file, the execution is transfered to the called file and it does not return to the caller. </p>
<p>If you want to call a second batch and ... | <p>I am not sure about your install, but probably you are calling a <code>uglifyjs.cmd</code> or <code>uglifyjs.bat</code>, and when you call a batch file from inside another batch file, the execution is transfered to the called file and it does not return to the caller. </p> <p>If you want to call a second batch and ... | 64, 7002, 46426, 67085, 88560 | batch-file, node.js, uglifyjs, uglifyjs2, windows | <h1>Batch File Exits After Running One Node Application Script</h1>
<p>I need to run several UglifyJS2 scripts with Node. I've added the command I want to run to a bat file and it runs OK.</p>
<p>When I add a second command, like "cd ..", the command isn't executed! Very confusing.</p>
<pre><code>cd go somewhere
ugli... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,983 | cmd | # Batch File Exits After Running One Node Application Script
I need to run several UglifyJS2 scripts with Node. I've added the command I want to run to a bat file and it runs OK.
When I add a second command, like "cd ..", the command isn't executed! Very confusing.
```
cd go somewhere
uglifyjs ..\somescript -o ..\so... | I am not sure about your install, but probably you are calling a `uglifyjs.cmd` or `uglifyjs.bat`, and when you call a batch file from inside another batch file, the execution is transfered to the called file and it does not return to the caller.
If you want to call a second batch and that, when if finishes, execution... |
11952108 | Set title for Java window when running tomcat | 11 | 2012-08-14 12:16:41 | <p>I'm writing a script to start up several tomcat servers, like so</p>
<pre><code>cd "F:\...\apache-tomcat-5.5.33\bin"
call "cmd /c startup.bat"
cd "F:\...\apache-tomcat-5.5.33\bin"
call "cmd /c startup.bat"
etc
</code></pre>
<p>which I have working but each one opens in a java window that just says 'tomcat' at the ... | 6,631 | 1,111,284 | 2013-04-19 09:40:17 | 11,952,226 | 19 | 2012-08-14 12:24:07 | 343,955 | 2012-08-14 12:30:32 | https://stackoverflow.com/q/11952108 | https://stackoverflow.com/a/11952226 | <p>You'll have to set an environment variable. Read the last one that says <code>TITLE</code>. I found this inside <code>catalina.bat</code>.</p>
<pre><code>rem ---------------------------------------------------------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prerequ... | <p>You'll have to set an environment variable. Read the last one that says <code>TITLE</code>. I found this inside <code>catalina.bat</code>.</p> <pre><code>rem --------------------------------------------------------------------------- rem Start/Stop Script for the CATALINA Server rem rem Environment Variable Prerequ... | 17, 2631 | cmd, java | <h1>Set title for Java window when running tomcat</h1>
<p>I'm writing a script to start up several tomcat servers, like so</p>
<pre><code>cd "F:\...\apache-tomcat-5.5.33\bin"
call "cmd /c startup.bat"
cd "F:\...\apache-tomcat-5.5.33\bin"
call "cmd /c startup.bat"
etc
</code></pre>
<p>which I have working but each one... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,985 | cmd | # Set title for Java window when running tomcat
I'm writing a script to start up several tomcat servers, like so
```
cd "F:\...\apache-tomcat-5.5.33\bin"
call "cmd /c startup.bat"
cd "F:\...\apache-tomcat-5.5.33\bin"
call "cmd /c startup.bat"
etc
```
which I have working but each one opens in a java window that just... | You'll have to set an environment variable. Read the last one that says `TITLE`. I found this inside `catalina.bat`.
```
rem ---------------------------------------------------------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prerequisites
rem
rem Do not set the vari... |
5910573 | How to get CMD/console encoding in C# | 11 | 2011-05-06 11:13:31 | <p>I need to specify the correct codepage to pack the files with zip library. As I see, I need to specify console encoding (866 in my case).</p>
<pre><code> C:\Users\User>mode
Status for device CON:
----------------------
Lines: 300
Columns: 130
Keyboard rate: 31
Keyboard del... | 5,999 | 1,930,219 | 2019-08-27 17:07:28 | 5,911,430 | 19 | 2011-05-06 12:29:25 | 17,034 | 2011-05-06 12:29:25 | https://stackoverflow.com/q/5910573 | https://stackoverflow.com/a/5911430 | <p>The <em>default</em> code page for a console mode app is determined by the system locale. Control Panel + Region and Language, Administrative tab, Change System Locale. Your Windows code page is Cyrillic, so is your console code page so there's a reasonable chance that this code will work:</p>
<pre><code> ... | <p>The <em>default</em> code page for a console mode app is determined by the system locale. Control Panel + Region and Language, Administrative tab, Change System Locale. Your Windows code page is Cyrillic, so is your console code page so there's a reasonable chance that this code will work:</p> <pre><code> ... | 9, 488, 2631 | c#, cmd, console | <h1>How to get CMD/console encoding in C#</h1>
<p>I need to specify the correct codepage to pack the files with zip library. As I see, I need to specify console encoding (866 in my case).</p>
<pre><code> C:\Users\User>mode
Status for device CON:
----------------------
Lines: 300
Columns: ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,986 | cmd | # How to get CMD/console encoding in C#
I need to specify the correct codepage to pack the files with zip library. As I see, I need to specify console encoding (866 in my case).
```
C:\Users\User>mode
Status for device CON:
----------------------
Lines: 300
Columns: 130
Keyboard rat... | The *default* code page for a console mode app is determined by the system locale. Control Panel + Region and Language, Administrative tab, Change System Locale. Your Windows code page is Cyrillic, so is your console code page so there's a reasonable chance that this code will work:
```
int lcid = GetSystemDef... |
2190295 | %x was unexpected at this time. batch script | 11 | 2010-02-03 07:21:19 | <pre><code>@echo off
for /f "tokens=1,2 delims=," %%x in (my.csv) do (
if %M% LSS %%x set M=%%x
)
echo Max X Value= %M%
</code></pre>
<p>Sometimes it works fine, sometimes it fails with following error:</p>
<pre><code>%x was unexpected at this time.
</code></pre>
| 62,449 | 265,058 | 2013-03-29 14:42:18 | 2,190,397 | 19 | 2010-02-03 07:47:00 | 14,860 | 2010-04-23 00:05:16 | https://stackoverflow.com/q/2190295 | https://stackoverflow.com/a/2190397 | <p>The problem is that you're using <code>%m%</code> inside a <code>for</code> loop. This is evaluated when the loop is read (before any iterations at all). In other words, the entire loop, up to and including the closing parenthesis, is read and evaluated before executing. So <code>%m%</code> will always be it's initi... | <p>The problem is that you're using <code>%m%</code> inside a <code>for</code> loop. This is evaluated when the loop is read (before any iterations at all). In other words, the entire loop, up to and including the closing parenthesis, is read and evaluated before executing. So <code>%m%</code> will always be it's initi... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>%x was unexpected at this time. batch script</h1>
<pre><code>@echo off
for /f "tokens=1,2 delims=," %%x in (my.csv) do (
if %M% LSS %%x set M=%%x
)
echo Max X Value= %M%
</code></pre>
<p>Sometimes it works fine, sometimes it fails with following error:</p>
<pre><code>%x was unexpected at this time.
</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,987 | cmd | # %x was unexpected at this time. batch script
```
@echo off
for /f "tokens=1,2 delims=," %%x in (my.csv) do (
if %M% LSS %%x set M=%%x
)
echo Max X Value= %M%
```
Sometimes it works fine, sometimes it fails with following error:
```
%x was unexpected at this time.
``` | The problem is that you're using `%m%` inside a `for` loop. This is evaluated when the loop is read (before any iterations at all). In other words, the entire loop, up to and including the closing parenthesis, is read and evaluated before executing. So `%m%` will always be it's initial value no matter what you actually... |
56541522 | Jenkins Pipeline bat multiple lines | 10 | 2019-06-11 10:18:42 | <p>According to <a href="https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#bat-windows-batch-script" rel="nofollow noreferrer">the docs</a>, one can have multiple lines in the <code>script</code> paramater of <code>bat</code>.</p>
<p>However, I've tried the following in my stage steps and only the first... | 21,614 | 745,808 | 2022-09-19 23:17:18 | 56,541,892 | 19 | 2019-06-11 10:41:01 | 9,217,817 | 2022-09-19 23:13:37 | https://stackoverflow.com/q/56541522 | https://stackoverflow.com/a/56541892 | <p>You <a href="https://ss64.com/nt/call.html" rel="nofollow noreferrer">need</a> to add the keyword <code>call</code>, whereever you are invoking Windows batch scripts (<code>.bat</code> or <code>.cmd</code>), else the executed batch file won't return control. E.g.:</p>
<pre class="lang-groovy prettyprint-override"><c... | <p>You <a href="https://ss64.com/nt/call.html" rel="nofollow noreferrer">need</a> to add the keyword <code>call</code>, whereever you are invoking Windows batch scripts (<code>.bat</code> or <code>.cmd</code>), else the executed batch file won't return control. E.g.:</p> <pre class="lang-groovy prettyprint-override"><c... | 7002, 64999, 116724, 118285 | batch-file, jenkins, jenkins-groovy, jenkins-pipeline | <h1>Jenkins Pipeline bat multiple lines</h1>
<p>According to <a href="https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#bat-windows-batch-script" rel="nofollow noreferrer">the docs</a>, one can have multiple lines in the <code>script</code> paramater of <code>bat</code>.</p>
<p>However, I've tried the f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,988 | cmd | # Jenkins Pipeline bat multiple lines
According to [the docs](https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#bat-windows-batch-script), one can have multiple lines in the `script` paramater of `bat`.
However, I've tried the following in my stage steps and only the first line gets executed.
Declara... | You [need](https://ss64.com/nt/call.html) to add the keyword `call`, whereever you are invoking Windows batch scripts (`.bat` or `.cmd`), else the executed batch file won't return control. E.g.:
```
...
bat """
call c:\\path\\to\\conda activate my_env
cd c:\\path\\to\\scripts
call python myscript.py ${some... |
53344676 | java.lang.IllegalStateException: InputStream has already been read - do not use InputStreamResource if a stream needs to be read multiple times | 10 | 2018-11-16 20:08:03 | <p>I am trying to read a file from aws s3 bucket and set it as resource inside my spring batch reader class. When I test the application on aws lambda function I got below error. any suggestion experts? </p>
<pre><code> Caused by: java.lang.IllegalStateException: InputStream has already been read - do not use Input... | 18,340 | 10,443,925 | 2023-11-01 08:39:00 | 53,345,819 | 19 | 2018-11-16 21:42:18 | 1,364,747 | 2018-11-16 21:57:13 | https://stackoverflow.com/q/53344676 | https://stackoverflow.com/a/53345819 | <p>The docs suggest using ByteArrayResource to cache the content in memory, rather than InputStreamResource.</p>
<p><a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/InputStreamResource.html" rel="noreferrer">https://docs.spring.io/spring-framework/docs/current/javad... | <p>The docs suggest using ByteArrayResource to cache the content in memory, rather than InputStreamResource.</p> <p><a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/InputStreamResource.html" rel="noreferrer">https://docs.spring.io/spring-framework/docs/current/javad... | 17, 41895, 95875, 108737 | aws-lambda, java, spring-batch, spring-boot | <h1>java.lang.IllegalStateException: InputStream has already been read - do not use InputStreamResource if a stream needs to be read multiple times</h1>
<p>I am trying to read a file from aws s3 bucket and set it as resource inside my spring batch reader class. When I test the application on aws lambda function I got b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,989 | cmd | # java.lang.IllegalStateException: InputStream has already been read - do not use InputStreamResource if a stream needs to be read multiple times
I am trying to read a file from aws s3 bucket and set it as resource inside my spring batch reader class. When I test the application on aws lambda function I got below erro... | The docs suggest using ByteArrayResource to cache the content in memory, rather than InputStreamResource.
<https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/InputStreamResource.html>
Just change the returns part like this:
```
//As suggested by berzerk
byte[] content = IOUt... |
51275463 | AWS batch - how to limit number of concurrent jobs | 10 | 2018-07-11 00:05:42 | <p>I am looking for a way to limit the number of batch jobs that are running by holding the remaining jobs in the queue. Is it possible with aws batch?</p>
| 10,325 | 3,415,962 | 2018-08-31 19:19:17 | 52,121,551 | 19 | 2018-08-31 19:19:17 | 1,267,765 | 2018-08-31 19:19:17 | https://stackoverflow.com/q/51275463 | https://stackoverflow.com/a/52121551 | <p>Limiting the <a href="https://docs.aws.amazon.com/batch/latest/userguide/compute_environment_parameters.html#compute_environment_compute_resources" rel="noreferrer">maximum number of vcpus</a> of the managed compute environment the queue is tied to will effectively limit the number of batch jobs running concurrently... | <p>Limiting the <a href="https://docs.aws.amazon.com/batch/latest/userguide/compute_environment_parameters.html#compute_environment_compute_resources" rel="noreferrer">maximum number of vcpus</a> of the managed compute environment the queue is tied to will effectively limit the number of batch jobs running concurrently... | 33388, 124227 | amazon-web-services, aws-batch | <h1>AWS batch - how to limit number of concurrent jobs</h1>
<p>I am looking for a way to limit the number of batch jobs that are running by holding the remaining jobs in the queue. Is it possible with aws batch?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,990 | cmd | # AWS batch - how to limit number of concurrent jobs
I am looking for a way to limit the number of batch jobs that are running by holding the remaining jobs in the queue. Is it possible with aws batch? | Limiting the [maximum number of vcpus](https://docs.aws.amazon.com/batch/latest/userguide/compute_environment_parameters.html#compute_environment_compute_resources) of the managed compute environment the queue is tied to will effectively limit the number of batch jobs running concurrently on that queue.
However, this ... |
39731879 | WMIC product where "name like..." - "no instances available" if run in batch file | 10 | 2016-09-27 18:28:44 | <p>I want to find what version of Outlook is running on specific workstations. If I manually run </p>
<pre><code>wmic /node:"hostname" product where "Name like '%Office Outlook%'" get Name
</code></pre>
<p>in a command line, it works. But if I run it from a batch file, it returns "No instance(s) available". I've eve... | 90,684 | 2,132,386 | 2024-06-17 13:05:28 | 39,735,569 | 19 | 2016-09-27 22:55:06 | 3,439,404 | 2022-08-29 15:09:30 | https://stackoverflow.com/q/39731879 | https://stackoverflow.com/a/39735569 | <p>In a batch script file, escape your <code>%</code>s by prefacing each with another <code>%</code> as follows:</p>
<pre><code>wmic /node:"hostname" product where "Name like '%%Office Outlook%%'" get Name
</code></pre>
<p><strong>For proof</strong>, try next in your batch file:</p>
<pre><code>echo ... | <p>In a batch script file, escape your <code>%</code>s by prefacing each with another <code>%</code> as follows:</p> <pre><code>wmic /node:"hostname" product where "Name like '%%Office Outlook%%'" get Name </code></pre> <p><strong>For proof</strong>, try next in your batch file:</p> <pre><code>echo ... | 7002, 61774 | batch-file, wmic | <h1>WMIC product where "name like..." - "no instances available" if run in batch file</h1>
<p>I want to find what version of Outlook is running on specific workstations. If I manually run </p>
<pre><code>wmic /node:"hostname" product where "Name like '%Office Outlook%'" get Name
</code></pre>
<p>in a command line, it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,991 | cmd | # WMIC product where "name like..." - "no instances available" if run in batch file
I want to find what version of Outlook is running on specific workstations. If I manually run
```
wmic /node:"hostname" product where "Name like '%Office Outlook%'" get Name
```
in a command line, it works. But if I run it from a bat... | In a batch script file, escape your `%`s by prefacing each with another `%` as follows:
```
wmic /node:"hostname" product where "Name like '%%Office Outlook%%'" get Name
```
**For proof**, try next in your batch file:
```
echo ON
wmic /node:"hostname" product where "Name like '%%Office Outlook%%'" get Name
pause
```... |
29810186 | Is there a "one-liner" for submitting many jobs to SLURM (similar to LSF)? | 10 | 2015-04-22 22:37:56 | <p>Can I submit "one-liners" to SLURM?</p>
<p>Using <code>bsub</code> from LSF and the standard Linux utility <code>xargs</code>, I can easily submit a separate job for uncompressing all of the files in a directory:</p>
<pre><code>ls *.gz | sed 's/.gz$//g' | xargs -I {} bsub 'gunzip -c {}.gz > {}'
</code></pre>
<... | 13,211 | 215,487 | 2021-12-21 23:54:38 | 29,819,952 | 19 | 2015-04-23 09:56:28 | 2,471,963 | 2021-12-21 23:54:38 | https://stackoverflow.com/q/29810186 | https://stackoverflow.com/a/29819952 | <p>Try using the wrap option of <a href="https://slurm.schedmd.com/sbatch.html" rel="noreferrer"><code>sbatch</code></a>. Something like the following:</p>
<pre><code>ls *.gz | sed 's/.gz$//g' | xargs -I {} sbatch --wrap="gunzip -c {}.gz > {}"
</code></pre>
<BR>
From the man page for `sbatch`:
<pre><code>... | <p>Try using the wrap option of <a href="https://slurm.schedmd.com/sbatch.html" rel="noreferrer"><code>sbatch</code></a>. Something like the following:</p> <pre><code>ls *.gz | sed 's/.gz$//g' | xargs -I {} sbatch --wrap="gunzip -c {}.gz > {}" </code></pre> <BR> From the man page for `sbatch`: <pre><code>... | 74362, 97759, 105553 | lsf, sbatch, slurm | <h1>Is there a "one-liner" for submitting many jobs to SLURM (similar to LSF)?</h1>
<p>Can I submit "one-liners" to SLURM?</p>
<p>Using <code>bsub</code> from LSF and the standard Linux utility <code>xargs</code>, I can easily submit a separate job for uncompressing all of the files in a directory:</p>
<pre><code>ls ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,992 | cmd | # Is there a "one-liner" for submitting many jobs to SLURM (similar to LSF)?
Can I submit "one-liners" to SLURM?
Using `bsub` from LSF and the standard Linux utility `xargs`, I can easily submit a separate job for uncompressing all of the files in a directory:
```
ls *.gz | sed 's/.gz$//g' | xargs -I {} bsub 'gunzip... | Try using the wrap option of [`sbatch`](https://slurm.schedmd.com/sbatch.html). Something like the following:
```
ls *.gz | sed 's/.gz$//g' | xargs -I {} sbatch --wrap="gunzip -c {}.gz > {}"
```
From the man page for `sbatch`:
```
--wrap=<command string>
Sbatch will wrap the specified command string in a... |
28157076 | How to dir without showing extension (batch) | 10 | 2015-01-26 19:13:54 | <p>For example, I have the folder d:\temp\ and four word document files in it (.doc)</p>
<p>I know that</p>
<pre><code>dir /b "d:\temp"
</code></pre>
<p>will give me</p>
<pre><code>File1.doc
File2.doc
File3.doc
File4.doc
</code></pre>
<p>But how can I do it so that there are only file names without extensions?</p>... | 24,945 | 4,440,806 | 2018-10-16 11:14:46 | 28,157,145 | 19 | 2015-01-26 19:18:05 | 388,389 | 2015-01-26 19:55:09 | https://stackoverflow.com/q/28157076 | https://stackoverflow.com/a/28157145 | <pre><code>for %a in ("d:\temp\*") do @echo %~na
</code></pre>
<p>or for batch file:</p>
<pre><code>for %%a in ("d:\temp\*") do @echo %%~na
</code></pre>
<p>to display also directories you can use:</p>
<pre><code>for /f "delims=" %%a in (' dir /f "d:\temp\*"') do @echo %%~na
</code></pre>
| <pre><code>for %a in ("d:\temp\*") do @echo %~na </code></pre> <p>or for batch file:</p> <pre><code>for %%a in ("d:\temp\*") do @echo %%~na </code></pre> <p>to display also directories you can use:</p> <pre><code>for /f "delims=" %%a in (' dir /f "d:\temp\*"') do @echo %%~na </code></pre> | 7002, 14208 | batch-file, dir | <h1>How to dir without showing extension (batch)</h1>
<p>For example, I have the folder d:\temp\ and four word document files in it (.doc)</p>
<p>I know that</p>
<pre><code>dir /b "d:\temp"
</code></pre>
<p>will give me</p>
<pre><code>File1.doc
File2.doc
File3.doc
File4.doc
</code></pre>
<p>But how can I do it so ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,993 | cmd | # How to dir without showing extension (batch)
For example, I have the folder d:\temp\ and four word document files in it (.doc)
I know that
```
dir /b "d:\temp"
```
will give me
```
File1.doc
File2.doc
File3.doc
File4.doc
```
But how can I do it so that there are only file names without extensions?
like
```
Fi... | ```
for %a in ("d:\temp\*") do @echo %~na
```
or for batch file:
```
for %%a in ("d:\temp\*") do @echo %%~na
```
to display also directories you can use:
```
for /f "delims=" %%a in (' dir /f "d:\temp\*"') do @echo %%~na
``` |
8463790 | Delete both: hidden and normal files with cmd | 10 | 2011-12-11 12:01:07 | <p>Following line recursively deletes only HIDDEN files with .mta extension</p>
<pre><code>del /S /A:H <folder_name> *.mta
</code></pre>
<p>What I want to do is, to delete both: hidden and normal files with .mta extension. How to do it?</p>
| 33,499 | 800,639 | 2024-04-22 06:12:15 | 8,463,821 | 19 | 2011-12-11 12:07:43 | 291,641 | 2011-12-11 12:07:43 | https://stackoverflow.com/q/8463790 | https://stackoverflow.com/a/8463821 | <p>Use /a on its own: <code>del /s /a *.mta</code></p>
<p>eg:</p>
<pre><code>C:\temp\z>attrib *
A H C:\temp\z\hidden
A C:\temp\z\normal
C:\temp\z>del /s /a *
C:\temp\z\*, Are you sure (Y/N)? y
Deleted file - C:\temp\z\hidden
Deleted file - C:\temp\z\normal
</code></pre>
| <p>Use /a on its own: <code>del /s /a *.mta</code></p> <p>eg:</p> <pre><code>C:\temp\z>attrib * A H C:\temp\z\hidden A C:\temp\z\normal C:\temp\z>del /s /a * C:\temp\z\*, Are you sure (Y/N)? y Deleted file - C:\temp\z\hidden Deleted file - C:\temp\z\normal </code></pre> | 2631, 5310, 7002, 37510 | batch-file, cmd, delete-file, file | <h1>Delete both: hidden and normal files with cmd</h1>
<p>Following line recursively deletes only HIDDEN files with .mta extension</p>
<pre><code>del /S /A:H <folder_name> *.mta
</code></pre>
<p>What I want to do is, to delete both: hidden and normal files with .mta extension. How to 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,994 | cmd | # Delete both: hidden and normal files with cmd
Following line recursively deletes only HIDDEN files with .mta extension
```
del /S /A:H <folder_name> *.mta
```
What I want to do is, to delete both: hidden and normal files with .mta extension. How to do it? | Use /a on its own: `del /s /a *.mta`
eg:
```
C:\temp\z>attrib *
A H C:\temp\z\hidden
A C:\temp\z\normal
C:\temp\z>del /s /a *
C:\temp\z\*, Are you sure (Y/N)? y
Deleted file - C:\temp\z\hidden
Deleted file - C:\temp\z\normal
``` |
6852833 | Running a batch script by right clicking any file | 10 | 2011-07-28 00:25:31 | <p>The idea is to right click any file and then select "backup" in a drop down that just copies the file and adds a date time to the end of its name, then possibly moves that copy to another drive. </p>
<p>I would like a method of running a batch script by right clicking on a file and either passing that in as an argu... | 23,159 | 866,502 | 2014-01-10 08:55:43 | 6,854,941 | 19 | 2011-07-28 06:38:00 | 30,447 | 2014-01-10 08:55:43 | https://stackoverflow.com/q/6852833 | https://stackoverflow.com/a/6854941 | <p>you can add your bat to the "Send To" menu. See <a href="http://support.microsoft.com/kb/310270">http://support.microsoft.com/kb/310270</a></p>
<p>In brief, just copy your .bat file into the user SendTo folder.</p>
<pre><code>COPY MYBACKUP.BAT "%USERPROFILE%\SendTo"
</code></pre>
<p>the user invokes your bat sele... | <p>you can add your bat to the "Send To" menu. See <a href="http://support.microsoft.com/kb/310270">http://support.microsoft.com/kb/310270</a></p> <p>In brief, just copy your .bat file into the user SendTo folder.</p> <pre><code>COPY MYBACKUP.BAT "%USERPROFILE%\SendTo" </code></pre> <p>the user invokes your bat sele... | 263, 7002, 7130 | batch-file, click, registry | <h1>Running a batch script by right clicking any file</h1>
<p>The idea is to right click any file and then select "backup" in a drop down that just copies the file and adds a date time to the end of its name, then possibly moves that copy to another drive. </p>
<p>I would like a method of running a batch script by rig... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,995 | cmd | # Running a batch script by right clicking any file
The idea is to right click any file and then select "backup" in a drop down that just copies the file and adds a date time to the end of its name, then possibly moves that copy to another drive.
I would like a method of running a batch script by right clicking on a ... | you can add your bat to the "Send To" menu. See <http://support.microsoft.com/kb/310270>
In brief, just copy your .bat file into the user SendTo folder.
```
COPY MYBACKUP.BAT "%USERPROFILE%\SendTo"
```
the user invokes your bat selecting the option of the "Send To" menu item.
for more sophisticated parametrization,... |
3238433 | Batch file - Write list of files to variable | 10 | 2010-07-13 14:56:21 | <p>I'd like to get a list of all files (including their absolute path) into a variable, separated by spaces. My Google-fu seems to be weak in this regard, because I keep running into issues.</p>
<p>I have a base directory stored in <code>%baseDir%</code>, and would like to parse it for files (not recursing or includin... | 22,891 | 74,562 | 2020-12-04 13:21:50 | 3,238,461 | 19 | 2010-07-13 14:59:06 | 73,070 | 2010-07-13 16:32:00 | https://stackoverflow.com/q/3238433 | https://stackoverflow.com/a/3238461 | <p>Pretty simple:</p>
<pre><code>setlocal enabledelayedexpansion enableextensions
set LIST=
for %%x in (%baseDir%\*) do set LIST=!LIST! %%x
set LIST=%LIST:~1%
</code></pre>
<p>In fact, you find this very example also in the help for the <code>set</code> command, accessible via <code>help set</code>, complete with an ... | <p>Pretty simple:</p> <pre><code>setlocal enabledelayedexpansion enableextensions set LIST= for %%x in (%baseDir%\*) do set LIST=!LIST! %%x set LIST=%LIST:~1% </code></pre> <p>In fact, you find this very example also in the help for the <code>set</code> command, accessible via <code>help set</code>, complete with an ... | 218, 7002 | batch-file, directory | <h1>Batch file - Write list of files to variable</h1>
<p>I'd like to get a list of all files (including their absolute path) into a variable, separated by spaces. My Google-fu seems to be weak in this regard, because I keep running into issues.</p>
<p>I have a base directory stored in <code>%baseDir%</code>, and would... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,996 | cmd | # Batch file - Write list of files to variable
I'd like to get a list of all files (including their absolute path) into a variable, separated by spaces. My Google-fu seems to be weak in this regard, because I keep running into issues.
I have a base directory stored in `%baseDir%`, and would like to parse it for files... | Pretty simple:
```
setlocal enabledelayedexpansion enableextensions
set LIST=
for %%x in (%baseDir%\*) do set LIST=!LIST! %%x
set LIST=%LIST:~1%
```
In fact, you find this very example also in the help for the `set` command, accessible via `help set`, complete with an explanation why the naïve approach won't work.
T... |
2172122 | bat file: get parent pathname | 10 | 2010-01-31 15:02:17 | <p>The following mostly works. 'Mostly', because the use of the SOMETHING..\tasks\ pathname confuses Spring when a context XML file tries to include another by relative pathname. So, what I seem to need is a way, in a BAT file, of setting a variable to the parent directory of a pathname.</p>
<pre><code>set ROOT=%~dp0
... | 12,714 | 131,433 | 2013-07-16 16:19:25 | 2,172,378 | 19 | 2010-01-31 16:22:52 | 152,522 | 2010-01-31 16:22:52 | https://stackoverflow.com/q/2172122 | https://stackoverflow.com/a/2172378 | <p>To resolve a relative path name you can utilize a sub routine call.
At the end of your batch file place the following lines:</p>
<pre><code>GOTO :EOF
:RESOLVE
SET %2=%~f1
GOTO :EOF
</code></pre>
<p>This is a sub routine that resolves its first parameter to a full path (<code>%~f1</code>) and stores the result to... | <p>To resolve a relative path name you can utilize a sub routine call. At the end of your batch file place the following lines:</p> <pre><code>GOTO :EOF :RESOLVE SET %2=%~f1 GOTO :EOF </code></pre> <p>This is a sub routine that resolves its first parameter to a full path (<code>%~f1</code>) and stores the result to... | 2631, 7002, 48847 | batch-file, cmd, pathname | <h1>bat file: get parent pathname</h1>
<p>The following mostly works. 'Mostly', because the use of the SOMETHING..\tasks\ pathname confuses Spring when a context XML file tries to include another by relative pathname. So, what I seem to need is a way, in a BAT file, of setting a variable to the parent directory of a pa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,997 | cmd | # bat file: get parent pathname
The following mostly works. 'Mostly', because the use of the SOMETHING..\tasks\ pathname confuses Spring when a context XML file tries to include another by relative pathname. So, what I seem to need is a way, in a BAT file, of setting a variable to the parent directory of a pathname.
... | To resolve a relative path name you can utilize a sub routine call.
At the end of your batch file place the following lines:
```
GOTO :EOF
:RESOLVE
SET %2=%~f1
GOTO :EOF
```
This is a sub routine that resolves its first parameter to a full path (`%~f1`) and stores the result to the (global) variable named by the 2n... |
1978088 | batch file fails to set variable in IF clause | 10 | 2009-12-30 02:25:18 | <p>The following code is not updating Run to equal N even though the match occurs. this means I'm not dropping into the CALL code. Am i missing something here?</p>
<pre><code>SET Run=Y
REM Check current files date/time information and establish if the file has been present too long in the directory
REM Skip first 4 l... | 11,776 | 239,841 | 2010-03-07 18:11:35 | 1,978,129 | 19 | 2009-12-30 02:39:53 | 14,860 | 2009-12-30 02:47:04 | https://stackoverflow.com/q/1978088 | https://stackoverflow.com/a/1978129 | <p>You need to use the delayed expansion option of cmd.exe.</p>
<p>At the top of your script, put:</p>
<pre><code>setlocal enableextensions enabledelayedexpansion
</code></pre>
<p>and then put:</p>
<pre><code>endlocal
</code></pre>
<p>at the bottom.</p>
<p>Then you need to use <code>!Run!</code> instead of <code>... | <p>You need to use the delayed expansion option of cmd.exe.</p> <p>At the top of your script, put:</p> <pre><code>setlocal enableextensions enabledelayedexpansion </code></pre> <p>and then put:</p> <pre><code>endlocal </code></pre> <p>at the bottom.</p> <p>Then you need to use <code>!Run!</code> instead of <code>... | 276, 7002, 8470 | batch-file, set, variables | <h1>batch file fails to set variable in IF clause</h1>
<p>The following code is not updating Run to equal N even though the match occurs. this means I'm not dropping into the CALL code. Am i missing something here?</p>
<pre><code>SET Run=Y
REM Check current files date/time information and establish if the file has be... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,998 | cmd | # batch file fails to set variable in IF clause
The following code is not updating Run to equal N even though the match occurs. this means I'm not dropping into the CALL code. Am i missing something here?
```
SET Run=Y
REM Check current files date/time information and establish if the file has been present too long ... | You need to use the delayed expansion option of cmd.exe.
At the top of your script, put:
```
setlocal enableextensions enabledelayedexpansion
```
and then put:
```
endlocal
```
at the bottom.
Then you need to use `!Run!` instead of `%Run%`.
The reason your code is not working is that the *entire* FOR statement (... |
43332506 | How do you check if environment variables are defined in windows batch scripting | 9 | 2017-04-10 20:38:21 | <p>I am trying to create a batch file to check if the environment variables are defined or undefined and gives a certain output statement if it is or not. This is what I have and I can't seem to get the program to tell me that any argument is defined.</p>
<pre><code>if not defined "%MyVar%" (
echo MyVar is NOT def... | 14,014 | 3,705,776 | 2017-12-04 16:03:33 | 43,332,583 | 19 | 2017-04-10 20:43:48 | 2,102,693 | 2017-04-11 16:22:18 | https://stackoverflow.com/q/43332506 | https://stackoverflow.com/a/43332583 | <p>I think you mean to write:</p>
<pre><code>if not defined MyVar (
echo MyVar is NOT defined
)
</code></pre>
<p>and</p>
<pre><code>if defined MyVar (
echo MyVar IS defined
)
</code></pre>
<p>This is because cmd.exe will expand the reference to the <em>content</em> of the variable if you enclose it within <cod... | <p>I think you mean to write:</p> <pre><code>if not defined MyVar ( echo MyVar is NOT defined ) </code></pre> <p>and</p> <pre><code>if defined MyVar ( echo MyVar IS defined ) </code></pre> <p>This is because cmd.exe will expand the reference to the <em>content</em> of the variable if you enclose it within <cod... | 64, 7002, 9013 | batch-file, environment-variables, windows | <h1>How do you check if environment variables are defined in windows batch scripting</h1>
<p>I am trying to create a batch file to check if the environment variables are defined or undefined and gives a certain output statement if it is or not. This is what I have and I can't seem to get the program to tell me that any... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,001 | cmd | # How do you check if environment variables are defined in windows batch scripting
I am trying to create a batch file to check if the environment variables are defined or undefined and gives a certain output statement if it is or not. This is what I have and I can't seem to get the program to tell me that any argument... | I think you mean to write:
```
if not defined MyVar (
echo MyVar is NOT defined
)
```
and
```
if defined MyVar (
echo MyVar IS defined
)
```
This is because cmd.exe will expand the reference to the *content* of the variable if you enclose it within `%` characters. (You want to know if the variable *itself* is ... |
9077793 | HOW to EXIT using "start" in batch files of MSDOS | 9 | 2012-01-31 10:16:35 | <p>I want to copy some files into diffent USB disks, and want to use START to open several consoles as follows:</p>
<pre><code>start copy a.txt h:
start copy a.txt i:
start copy a.txt j:
</code></pre>
<p>But everytime I run the batch file, there are 3 consoles without exiting.
How can I realize this EXIT function <st... | 16,918 | 1,179,910 | 2012-01-31 11:53:43 | 9,078,495 | 19 | 2012-01-31 11:09:21 | 3,501 | 2012-01-31 11:09:21 | https://stackoverflow.com/q/9077793 | https://stackoverflow.com/a/9078495 | <p>You need to escape && so it becomes part of the command executed by start and not the parent batch file.</p>
<pre><code>start copy a.txt h: ^&^& exit
</code></pre>
<p>To close the new console even if there are errors you can do:</p>
<pre><code>start "" "%comspec%" /c copy a.txt h:
</code></pre>
| <p>You need to escape && so it becomes part of the command executed by start and not the parent batch file.</p> <pre><code>start copy a.txt h: ^&^& exit </code></pre> <p>To close the new console even if there are errors you can do:</p> <pre><code>start "" "%comspec%" /c copy a.txt h: </code></pre> | 7002, 10871 | batch-file, exit | <h1>HOW to EXIT using "start" in batch files of MSDOS</h1>
<p>I want to copy some files into diffent USB disks, and want to use START to open several consoles as follows:</p>
<pre><code>start copy a.txt h:
start copy a.txt i:
start copy a.txt j:
</code></pre>
<p>But everytime I run the batch file, there are 3 console... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,002 | cmd | # HOW to EXIT using "start" in batch files of MSDOS
I want to copy some files into diffent USB disks, and want to use START to open several consoles as follows:
```
start copy a.txt h:
start copy a.txt i:
start copy a.txt j:
```
But everytime I run the batch file, there are 3 consoles without exiting.
How can I real... | You need to escape && so it becomes part of the command executed by start and not the parent batch file.
```
start copy a.txt h: ^&^& exit
```
To close the new console even if there are errors you can do:
```
start "" "%comspec%" /c copy a.txt h:
``` |
8811992 | DOS batch FOR loop with FIND.exe is stripping out blank lines? | 9 | 2012-01-10 23:17:26 | <p>This DOS batch script is stripping out the blank lines and not showing the blank lines in the file even though I am using the TYPE.exe command to convert the file to make sure the file is ASCII so that the FIND command is compatible with the file. Can anyone tell me how to make this script include blank lines?</p... | 19,308 | 118,228 | 2015-02-09 13:10:28 | 8,812,434 | 19 | 2012-01-11 00:09:41 | 1,012,053 | 2015-02-09 13:10:28 | https://stackoverflow.com/q/8811992 | https://stackoverflow.com/a/8812434 | <p>That is the designed behavior of FOR /F - it never returns blank lines. The work around is to use FIND or FINDSTR to prefix the line with the line number. If you can guarantee no lines start with the line number delimiter, then you simply set the appropriate delimiter and keep tokens 1* but use only the 2nd token.</... | <p>That is the designed behavior of FOR /F - it never returns blank lines. The work around is to use FIND or FINDSTR to prefix the line with the line number. If you can guarantee no lines start with the line number delimiter, then you simply set the appropriate delimiter and keep tokens 1* but use only the 2nd token.</... | 2631, 5370, 7002 | batch-file, cmd, dos | <h1>DOS batch FOR loop with FIND.exe is stripping out blank lines?</h1>
<p>This DOS batch script is stripping out the blank lines and not showing the blank lines in the file even though I am using the TYPE.exe command to convert the file to make sure the file is ASCII so that the FIND command is compatible with the fi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,003 | cmd | # DOS batch FOR loop with FIND.exe is stripping out blank lines?
This DOS batch script is stripping out the blank lines and not showing the blank lines in the file even though I am using the TYPE.exe command to convert the file to make sure the file is ASCII so that the FIND command is compatible with the file. Can an... | That is the designed behavior of FOR /F - it never returns blank lines. The work around is to use FIND or FINDSTR to prefix the line with the line number. If you can guarantee no lines start with the line number delimiter, then you simply set the appropriate delimiter and keep tokens 1* but use only the 2nd token.
```... |
5375609 | Wait for executable to finish running | 8 | 2011-03-21 09:10:33 | <p>Can you run two executables in a batch file and wait for the first process to end before starting the next?</p>
| 51,627 | 576,921 | 2015-10-22 14:28:50 | 5,375,658 | 19 | 2011-03-21 09:16:18 | 431,646 | 2011-03-22 09:25:03 | https://stackoverflow.com/q/5375609 | https://stackoverflow.com/a/5375658 | <p>Use start /wait:</p>
<pre><code>:NOTEPAD
start /wait notepad.exe
IF %ERRORLEVEL% == 0 goto NEXTITEM1
else goto QUIT
:NEXTITEM1
start /wait mplayer.exe
IF %ERRORLEVEL% == 0 goto NEXTITEM2
else goto QUIT
:NEXTITEM2
start /wait explorer.exe
IF %ERRORLEVEL% == 0 goto NEXTITEM3
else goto QUIT
:NEXTITEM3
REM You get t... | <p>Use start /wait:</p> <pre><code>:NOTEPAD start /wait notepad.exe IF %ERRORLEVEL% == 0 goto NEXTITEM1 else goto QUIT :NEXTITEM1 start /wait mplayer.exe IF %ERRORLEVEL% == 0 goto NEXTITEM2 else goto QUIT :NEXTITEM2 start /wait explorer.exe IF %ERRORLEVEL% == 0 goto NEXTITEM3 else goto QUIT :NEXTITEM3 REM You get t... | 64, 7002 | batch-file, windows | <h1>Wait for executable to finish running</h1>
<p>Can you run two executables in a batch file and wait for the first process to end before starting the next?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,004 | cmd | # Wait for executable to finish running
Can you run two executables in a batch file and wait for the first process to end before starting the next? | Use start /wait:
```
:NOTEPAD
start /wait notepad.exe
IF %ERRORLEVEL% == 0 goto NEXTITEM1
else goto QUIT
:NEXTITEM1
start /wait mplayer.exe
IF %ERRORLEVEL% == 0 goto NEXTITEM2
else goto QUIT
:NEXTITEM2
start /wait explorer.exe
IF %ERRORLEVEL% == 0 goto NEXTITEM3
else goto QUIT
:NEXTITEM3
REM You get the idea...
:Q... |
35685721 | Batch scripting: What's the difference between %0 and %~f0? | 7 | 2016-02-28 17:22:04 | <p>I have a Batch script in which I want to get the full path to the script. I'm curious, is there any difference between this:</p>
<pre><code>set scriptpath=%0
</code></pre>
<p>and this:</p>
<pre><code>set scriptpath=%~f0
</code></pre>
<p>Thanks for helping.</p>
| 30,776 | 4,077,294 | 2022-04-11 19:34:51 | 35,686,107 | 19 | 2016-02-28 17:54:31 | 3,074,564 | 2021-12-16 09:35:49 | https://stackoverflow.com/q/35685721 | https://stackoverflow.com/a/35686107 | <p><code>%0</code> references argument 0 – the name of the batch file – always exactly as specified on command line or in another batch file.</p>
<p>So if a batch file named <code>Test.bat</code> stored in <code>C:\Temp</code> is started for example from within a command prompt window with current directory being <code... | <p><code>%0</code> references argument 0 – the name of the batch file – always exactly as specified on command line or in another batch file.</p> <p>So if a batch file named <code>Test.bat</code> stored in <code>C:\Temp</code> is started for example from within a command prompt window with current directory being <code... | 64, 2631, 7002, 9938, 107329 | batch-file, cmd, command-prompt, windows, windows-10 | <h1>Batch scripting: What's the difference between %0 and %~f0?</h1>
<p>I have a Batch script in which I want to get the full path to the script. I'm curious, is there any difference between this:</p>
<pre><code>set scriptpath=%0
</code></pre>
<p>and this:</p>
<pre><code>set scriptpath=%~f0
</code></pre>
<p>Thanks ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,005 | cmd | # Batch scripting: What's the difference between %0 and %~f0?
I have a Batch script in which I want to get the full path to the script. I'm curious, is there any difference between this:
```
set scriptpath=%0
```
and this:
```
set scriptpath=%~f0
```
Thanks for helping. | `%0` references argument 0 – the name of the batch file – always exactly as specified on command line or in another batch file.
So if a batch file named `Test.bat` stored in `C:\Temp` is started for example from within a command prompt window with current directory being `C:\` with an execution of `temp\test`, then `%... |
24428597 | Task Scheduler - Access non-local drives while running task not logged in | 7 | 2014-06-26 10:54:50 | <p>I had a task in win scheduler that runs every minute. The task runs a .bat file which SVN updates a series of folders then executes a perl script (which in turn will run off several others). The output/'log' of the perl script (tagged by date/time) is sent to a shared drive, not local to the machine the task runs on... | 35,225 | 3,699,720 | 2017-03-23 13:20:53 | 24,439,849 | 19 | 2014-06-26 20:41:53 | 3,074,564 | 2015-09-29 08:25:53 | https://stackoverflow.com/q/24428597 | https://stackoverflow.com/a/24439849 | <p><a href="https://stackoverflow.com/users/3724689/phd443322">phd443322</a> has given already the right answer.</p>
<p>Mappings of a shared folders to drive letters are saved per <strong>user account</strong> in Windows registry if the network connection was made with default settings. Therefore every user using a co... | <p><a href="https://stackoverflow.com/users/3724689/phd443322">phd443322</a> has given already the right answer.</p> <p>Mappings of a shared folders to drive letters are saved per <strong>user account</strong> in Windows registry if the network connection was made with default settings. Therefore every user using a co... | 7002, 7672, 9056, 9299 | batch-file, drive, scheduled-tasks, scheduler | <h1>Task Scheduler - Access non-local drives while running task not logged in</h1>
<p>I had a task in win scheduler that runs every minute. The task runs a .bat file which SVN updates a series of folders then executes a perl script (which in turn will run off several others). The output/'log' of the perl script (tagged... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,006 | cmd | # Task Scheduler - Access non-local drives while running task not logged in
I had a task in win scheduler that runs every minute. The task runs a .bat file which SVN updates a series of folders then executes a perl script (which in turn will run off several others). The output/'log' of the perl script (tagged by date/... | [phd443322](https://stackoverflow.com/users/3724689/phd443322) has given already the right answer.
Mappings of a shared folders to drive letters are saved per **user account** in Windows registry if the network connection was made with default settings. Therefore every user using a computer can have different network ... |
15890856 | Difference between "%~dp0" and ".\"? | 7 | 2013-04-08 23:32:41 | <p>Let's say I'm using a batch file and want it to direct to a folder located in the same directory of the batch. If I'm not wrong you would write "%~dp0\whateverfoldername". But can't the same done by just writing ".\whateverfoldername"? If so, what is the difference and/or advantage of the respective command?</p>
| 38,722 | 2,259,606 | 2013-04-09 00:04:09 | 15,891,127 | 19 | 2013-04-09 00:04:09 | 2,093,352 | 2013-04-09 00:04:09 | https://stackoverflow.com/q/15890856 | https://stackoverflow.com/a/15891127 | <pre><code>pushd %~dp0
</code></pre>
<p>is often used to change to the original directory from which the batch was started.
This is very useful in newer OS's when the user may 'Run as administrator' which changes the current directory for you! Try it sometime. Just make a simple bat</p>
<pre><code>@echo off
echo.CD... | <pre><code>pushd %~dp0 </code></pre> <p>is often used to change to the original directory from which the batch was started. This is very useful in newer OS's when the user may 'Run as administrator' which changes the current directory for you! Try it sometime. Just make a simple bat</p> <pre><code>@echo off echo.CD... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>Difference between "%~dp0" and ".\"?</h1>
<p>Let's say I'm using a batch file and want it to direct to a folder located in the same directory of the batch. If I'm not wrong you would write "%~dp0\whateverfoldername". But can't the same done by just writing ".\whateverfoldername"? If so, what is the difference and/o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,007 | cmd | # Difference between "%~dp0" and ".\"?
Let's say I'm using a batch file and want it to direct to a folder located in the same directory of the batch. If I'm not wrong you would write "%~dp0\whateverfoldername". But can't the same done by just writing ".\whateverfoldername"? If so, what is the difference and/or advanta... | ```
pushd %~dp0
```
is often used to change to the original directory from which the batch was started.
This is very useful in newer OS's when the user may 'Run as administrator' which changes the current directory for you! Try it sometime. Just make a simple bat
```
@echo off
echo.CD=%CD%
pushd %~dp0
echo.CD=%CD%
pa... |
13219628 | batch: replace a line in a text file | 7 | 2012-11-04 14:56:35 | <p><br />
I'm trying to replace this line:<br /></p>
<pre><code># forward-socks5 / 127.0.0.1:9050 .
</code></pre>
<p>with this one:</p>
<pre><code> forward-socks5 / 127.0.0.1:9050 .
</code></pre>
<p>this line belongs to a config file that has to be enabled (UN-commented... | 41,591 | 1,798,141 | 2017-12-23 07:31:52 | 13,221,000 | 19 | 2012-11-04 17:26:26 | 1,012,053 | 2012-11-05 17:33:40 | https://stackoverflow.com/q/13219628 | https://stackoverflow.com/a/13221000 | <p>Lines containing <code>!</code> are corrupted because delayed expansion occurs after FOR variable (<code>%%A</code>) expansion. That could be solved by starting out with delayed expansion disabled. Within the loop you save the value of <code>%%A</code> in a variable, and then toggle delayed expansion on, process the... | <p>Lines containing <code>!</code> are corrupted because delayed expansion occurs after FOR variable (<code>%%A</code>) expansion. That could be solved by starting out with delayed expansion disabled. Within the loop you save the value of <code>%%A</code> in a variable, and then toggle delayed expansion on, process the... | 2498, 7002, 9325, 17938 | batch-file, line, replace, text-files | <h1>batch: replace a line in a text file</h1>
<p><br />
I'm trying to replace this line:<br /></p>
<pre><code># forward-socks5 / 127.0.0.1:9050 .
</code></pre>
<p>with this one:</p>
<pre><code> forward-socks5 / 127.0.0.1:9050 .
</code></pre>
<p>this line belongs to a co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,008 | cmd | # batch: replace a line in a text file
I'm trying to replace this line:
```
# forward-socks5 / 127.0.0.1:9050 .
```
with this one:
```
forward-socks5 / 127.0.0.1:9050 .
```
this line belongs to a config file that has to be enabled (UN-commented) by deleting the # sign... | Lines containing `!` are corrupted because delayed expansion occurs after FOR variable (`%%A`) expansion. That could be solved by starting out with delayed expansion disabled. Within the loop you save the value of `%%A` in a variable, and then toggle delayed expansion on, process the line, and then toggle it back off.
... |
3213574 | Get Value of Registry Key | 7 | 2010-07-09 14:29:20 | <p>I have a batch script that checks if a registry key exists and if it does exist then open Internet explorer. What I now want to do is get the value of that registery key and put it in the URL. How can I do this?</p>
<pre><code>@echo off
reg query HKLM\Software\Test\Monitor\Settings
if errorlevel 1 goto not_exist
go... | 42,913 | 51,649 | 2013-09-11 22:52:19 | 3,214,966 | 19 | 2010-07-09 17:12:21 | 92,692 | 2010-07-09 17:12:21 | https://stackoverflow.com/q/3213574 | https://stackoverflow.com/a/3214966 | <p>Here you go, should be self explanatory with comments. Let me know if you have any questions.</p>
<pre><code>@echo off
set THEME_REGKEY=HKLM\Software\Microsoft\Windows\CurrentVersion\Themes
set THEME_REGVAL=ThemeName
REM Check for presence of key first.
reg query %THEME_REGKEY% /v %THEME_REGVAL% 2>nul || (echo... | <p>Here you go, should be self explanatory with comments. Let me know if you have any questions.</p> <pre><code>@echo off set THEME_REGKEY=HKLM\Software\Microsoft\Windows\CurrentVersion\Themes set THEME_REGVAL=ThemeName REM Check for presence of key first. reg query %THEME_REGKEY% /v %THEME_REGVAL% 2>nul || (echo... | 5370, 7002, 9938 | batch-file, command-prompt, dos | <h1>Get Value of Registry Key</h1>
<p>I have a batch script that checks if a registry key exists and if it does exist then open Internet explorer. What I now want to do is get the value of that registery key and put it in the URL. How can I do this?</p>
<pre><code>@echo off
reg query HKLM\Software\Test\Monitor\Setting... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,009 | cmd | # Get Value of Registry Key
I have a batch script that checks if a registry key exists and if it does exist then open Internet explorer. What I now want to do is get the value of that registery key and put it in the URL. How can I do this?
```
@echo off
reg query HKLM\Software\Test\Monitor\Settings
if errorlevel 1 go... | Here you go, should be self explanatory with comments. Let me know if you have any questions.
```
@echo off
set THEME_REGKEY=HKLM\Software\Microsoft\Windows\CurrentVersion\Themes
set THEME_REGVAL=ThemeName
REM Check for presence of key first.
reg query %THEME_REGKEY% /v %THEME_REGVAL% 2>nul || (echo No theme name pr... |
51196367 | How to update multiple cells via the Google Sheets API? | 6 | 2018-07-05 16:44:49 | <p>I'm trying to update and get some results from google sheets, it's working but slow. I need to <code>batchUpdate</code> and get the data.</p>
<p>This is my script</p>
<pre><code>foreach ($import_cels as $celu => $valoare) {
$range_ins = $celu;
$valueRange->setValues(["values" => [$valoare]]);
... | 13,137 | 1,446,619 | 2021-08-25 19:05:49 | 57,704,132 | 19 | 2019-08-29 06:21:53 | 9,093,850 | 2019-08-29 07:00:56 | https://stackoverflow.com/q/51196367 | https://stackoverflow.com/a/57704132 | <p>Please create your request in below format</p>
<pre class="lang-js prettyprint-override"><code>var resources = {
auth: "auth key",
spreadsheetId: "spread sheet id",
resource:{
valueInputOption: "RAW",
data:[
{
range: "Sheet1!A5", // Update single cell
values: [["A5"]]
}, {
... | <p>Please create your request in below format</p> <pre class="lang-js prettyprint-override"><code>var resources = { auth: "auth key", spreadsheetId: "spread sheet id", resource:{ valueInputOption: "RAW", data:[ { range: "Sheet1!A5", // Update single cell values: [["A5"]] }, { ... | 35561, 85480, 119837 | batch-updates, google-api-php-client, google-sheets-api | <h1>How to update multiple cells via the Google Sheets API?</h1>
<p>I'm trying to update and get some results from google sheets, it's working but slow. I need to <code>batchUpdate</code> and get the data.</p>
<p>This is my script</p>
<pre><code>foreach ($import_cels as $celu => $valoare) {
$range_ins = $celu;... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,010 | cmd | # How to update multiple cells via the Google Sheets API?
I'm trying to update and get some results from google sheets, it's working but slow. I need to `batchUpdate` and get the data.
This is my script
```
foreach ($import_cels as $celu => $valoare) {
$range_ins = $celu;
$valueRange->setValues(["values" => ... | Please create your request in below format
```
var resources = {
auth: "auth key",
spreadsheetId: "spread sheet id",
resource:{
valueInputOption: "RAW",
data:[
{
range: "Sheet1!A5", // Update single cell
values: [["A5"]]
}, {
range: "Sheet1!B4:B6", // Update a column
... |
7024657 | How to get today's date in Windows batch environment? | 6 | 2011-08-11 10:58:28 | <p>I would like to get today's date in the format of YYYYMMDD in Windows batch environment, but don't know where to start or what to do.</p>
<p>Any code or direction is appreciated.</p>
| 28,959 | 93,558 | 2017-04-24 09:00:04 | 7,024,695 | 19 | 2011-08-11 11:01:53 | 246,342 | 2011-08-11 11:01:53 | https://stackoverflow.com/q/7024657 | https://stackoverflow.com/a/7024695 | <p>On my system, where <code>echo %date%</code> returns <code>dd/mm/yyyy</code>:</p>
<pre><code>set now=%date:~6,4%%date:~3,2%%date:~0,2%
echo.%now%
</code></pre>
<p>The syntax used is <code>%date:~S,L%</code> where <code>S</code> is a character offset and <code>L</code> is the length to read from the value returned ... | <p>On my system, where <code>echo %date%</code> returns <code>dd/mm/yyyy</code>:</p> <pre><code>set now=%date:~6,4%%date:~3,2%%date:~0,2% echo.%now% </code></pre> <p>The syntax used is <code>%date:~S,L%</code> where <code>S</code> is a character offset and <code>L</code> is the length to read from the value returned ... | 7002 | batch-file | <h1>How to get today's date in Windows batch environment?</h1>
<p>I would like to get today's date in the format of YYYYMMDD in Windows batch environment, but don't know where to start or what to do.</p>
<p>Any code or direction is appreciated.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,011 | cmd | # How to get today's date in Windows batch environment?
I would like to get today's date in the format of YYYYMMDD in Windows batch environment, but don't know where to start or what to do.
Any code or direction is appreciated. | On my system, where `echo %date%` returns `dd/mm/yyyy`:
```
set now=%date:~6,4%%date:~3,2%%date:~0,2%
echo.%now%
```
The syntax used is `%date:~S,L%` where `S` is a character offset and `L` is the length to read from the value returned by `%date%`. |
1695188 | How do I make Perl scripts recognize command-line parameters in the Win32 cmd console? | 6 | 2009-11-08 02:47:20 | <p>When I invoke my Perl scripts in the Windows environment without invoking <code>perl</code> first, the parameters are not passed to my script.</p>
<p>For example,</p>
<pre class="lang-none prettyprint-override"><code>C:\my-perl-scripts\foo.pl bar
</code></pre>
<p>invokes <code>foo.pl</code>, but it doesn't recognize... | 12,165 | 109,826 | 2025-10-15 22:03:31 | 1,695,459 | 19 | 2009-11-08 05:22:56 | 109,826 | 2024-01-01 15:14:27 | https://stackoverflow.com/q/1695188 | https://stackoverflow.com/a/1695459 | <p>I found out what the problem was. Although the ftype and the assoc values were set as suggested, the actual behavior on my system seems to be determined by the registry key</p>
<pre class="lang-none prettyprint-override"><code>HKEY_CLASSES_ROOT\Applications\perl.exe\shell\open\command
</code></pre>
<p>It should have... | <p>I found out what the problem was. Although the ftype and the assoc values were set as suggested, the actual behavior on my system seems to be determined by the registry key</p> <pre class="lang-none prettyprint-override"><code>HKEY_CLASSES_ROOT\Applications\perl.exe\shell\open\command </code></pre> <p>It should have... | 531, 580, 889, 2631 | cmd, perl, scripting, winapi | <h1>How do I make Perl scripts recognize command-line parameters in the Win32 cmd console?</h1>
<p>When I invoke my Perl scripts in the Windows environment without invoking <code>perl</code> first, the parameters are not passed to my script.</p>
<p>For example,</p>
<pre class="lang-none prettyprint-override"><code>C:\m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,012 | cmd | # How do I make Perl scripts recognize command-line parameters in the Win32 cmd console?
When I invoke my Perl scripts in the Windows environment without invoking `perl` first, the parameters are not passed to my script.
For example,
```
C:\my-perl-scripts\foo.pl bar
```
invokes `foo.pl`, but it doesn't recognize `... | I found out what the problem was. Although the ftype and the assoc values were set as suggested, the actual behavior on my system seems to be determined by the registry key
```
HKEY_CLASSES_ROOT\Applications\perl.exe\shell\open\command
```
It should have a `(Default)` string value of `"C:\Perl\bin\perl.exe" "%1" %*`
... |
13212033 | Get Windows version in a batch file | 34 | 2012-11-03 18:11:00 | <p>I need to get the OS version with a batch file. I 've seen a lot of examples online, many uses something like this code:</p>
<pre><code>@echo off
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexit
systeminfo | find "OS Name" > %TEMP%\o... | 136,306 | 1,583,301 | 2025-04-15 17:52:29 | 13,212,088 | 18 | 2012-11-03 18:17:00 | 1,151,078 | 2013-07-25 10:53:37 | https://stackoverflow.com/q/13212033 | https://stackoverflow.com/a/13212088 | <p>Have you tried using the <code>wmic</code> commands?</p>
<p>Try
<code>wmic os get version</code></p>
<p>This will give you the version number in a command line, then you just need to integrate into the batch file.</p>
| <p>Have you tried using the <code>wmic</code> commands?</p> <p>Try <code>wmic os get version</code></p> <p>This will give you the version number in a command line, then you just need to integrate into the batch file.</p> | 64, 1987, 7002 | batch-file, operating-system, windows | <h1>Get Windows version in a batch file</h1>
<p>I need to get the OS version with a batch file. I 've seen a lot of examples online, many uses something like this code:</p>
<pre><code>@echo off
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenex... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,013 | cmd | # Get Windows version in a batch file
I need to get the OS version with a batch file. I 've seen a lot of examples online, many uses something like this code:
```
@echo off
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexit
systeminfo | find "... | Have you tried using the `wmic` commands?
Try
`wmic os get version`
This will give you the version number in a command line, then you just need to integrate into the batch file. |
26032929 | Does 'docker start' execute the CMD command? | 23 | 2014-09-25 07:26:51 | <p>Let's say a docker container has been run with <code>docker run</code> and then stopped with <code>docker stop</code>. Will the <code>CMD</code> command be executed after a <code>docker start</code>?</p>
| 18,221 | 1,860,357 | 2024-04-24 18:24:03 | 26,539,514 | 18 | 2014-10-24 00:06:14 | 105,562 | 2020-11-24 17:55:37 | https://stackoverflow.com/q/26032929 | https://stackoverflow.com/a/26539514 | <p>I believe @jripoll is incorrect, it appears to run the command that was first run with <code>docker run</code> on <code>docker start</code> too.</p>
<p>Here's a simple example to test:</p>
<p>First create a shell script to run called <code>tmp.sh</code>:</p>
<pre><code>echo "hello yo!"
</code></pre>
<p>The... | <p>I believe @jripoll is incorrect, it appears to run the command that was first run with <code>docker run</code> on <code>docker start</code> too.</p> <p>Here's a simple example to test:</p> <p>First create a shell script to run called <code>tmp.sh</code>:</p> <pre><code>echo "hello yo!" </code></pre> <p>The... | 90304, 164539 | docker, docker-cmd | <h1>Does 'docker start' execute the CMD command?</h1>
<p>Let's say a docker container has been run with <code>docker run</code> and then stopped with <code>docker stop</code>. Will the <code>CMD</code> command be executed after a <code>docker start</code>?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,014 | cmd | # Does 'docker start' execute the CMD command?
Let's say a docker container has been run with `docker run` and then stopped with `docker stop`. Will the `CMD` command be executed after a `docker start`? | I believe @jripoll is incorrect, it appears to run the command that was first run with `docker run` on `docker start` too.
Here's a simple example to test:
First create a shell script to run called `tmp.sh`:
```
echo "hello yo!"
```
Then run:
```
docker run --name yo -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp ub... |
13734142 | Different Java version showing on command line | 18 | 2012-12-05 23:04:59 | <p>I have recently checked on my Java version. I ran the command <code>java -version</code> and I found out that I was using <code>java version 1.7.0_09</code>. But when I tried to check on <code>C:\Program Files\Java\</code> directory, I don't seem to find the same version. I only see the following: </p>
<ul>
<li>j2r... | 96,154 | 880,135 | 2024-01-10 12:30:21 | 13,734,429 | 18 | 2012-12-05 23:31:13 | 25,122 | 2023-05-04 01:54:29 | https://stackoverflow.com/q/13734142 | https://stackoverflow.com/a/13734429 | <p>It's possible to have many JRE side-by-side on a computer.</p>
<p>If the JRE is properly installed on Windows, informations about each version are stored in the registry. The installation process installs a <strong>special java.exe</strong> in the system PATH (<strong>%SYSTEMROOT%\System32</strong>). So you don't ne... | <p>It's possible to have many JRE side-by-side on a computer.</p> <p>If the JRE is properly installed on Windows, informations about each version are stored in the registry. The installation process installs a <strong>special java.exe</strong> in the system PATH (<strong>%SYSTEMROOT%\System32</strong>). So you don't ne... | 17, 2631, 5792 | cmd, java, version | <h1>Different Java version showing on command line</h1>
<p>I have recently checked on my Java version. I ran the command <code>java -version</code> and I found out that I was using <code>java version 1.7.0_09</code>. But when I tried to check on <code>C:\Program Files\Java\</code> directory, I don't seem to find the sa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,015 | cmd | # Different Java version showing on command line
I have recently checked on my Java version. I ran the command `java -version` and I found out that I was using `java version 1.7.0_09`. But when I tried to check on `C:\Program Files\Java\` directory, I don't seem to find the same version. I only see the following:
- j... | It's possible to have many JRE side-by-side on a computer.
If the JRE is properly installed on Windows, informations about each version are stored in the registry. The installation process installs a **special java.exe** in the system PATH (**%SYSTEMROOT%\System32**). So you don't need to alter you PATH because this s... |
14183446 | Use spaces in bat script, without quotes | 17 | 2013-01-06 15:11:15 | <p>I need to run</p>
<pre><code>start cmd.exe /k "C:\Program Files (x86)\Mozilla Firefox\sdk\bin\activate & cd d:\home\name\addon\ & cfx run"
</code></pre>
<p>The problem is that first path has spaces (<code>Program Files</code>). I can't use quotes, because they are used for full command already.</p>
<p>How... | 87,301 | 159,982 | 2018-07-04 22:22:08 | 14,184,116 | 18 | 2013-01-06 16:25:28 | 1,012,053 | 2013-01-06 16:25:28 | https://stackoverflow.com/q/14183446 | https://stackoverflow.com/a/14184116 | <p>Who says you can't add quotes around the exe path when the /C command is already quoted? It works fine ! :-)</p>
<pre><code>start cmd.exe /k ""C:\Program Files (x86)\Mozilla Firefox\sdk\bin\activate" & cd d:\home\name\addon\ & cfx run"
</code></pre>
<p>The outer quotes around the /C command are removed pri... | <p>Who says you can't add quotes around the exe path when the /C command is already quoted? It works fine ! :-)</p> <pre><code>start cmd.exe /k ""C:\Program Files (x86)\Mozilla Firefox\sdk\bin\activate" & cd d:\home\name\addon\ & cfx run" </code></pre> <p>The outer quotes around the /C command are removed pri... | 7002 | batch-file | <h1>Use spaces in bat script, without quotes</h1>
<p>I need to run</p>
<pre><code>start cmd.exe /k "C:\Program Files (x86)\Mozilla Firefox\sdk\bin\activate & cd d:\home\name\addon\ & cfx run"
</code></pre>
<p>The problem is that first path has spaces (<code>Program Files</code>). I can't use quotes, because t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,016 | cmd | # Use spaces in bat script, without quotes
I need to run
```
start cmd.exe /k "C:\Program Files (x86)\Mozilla Firefox\sdk\bin\activate & cd d:\home\name\addon\ & cfx run"
```
The problem is that first path has spaces (`Program Files`). I can't use quotes, because they are used for full command already.
How can I us... | Who says you can't add quotes around the exe path when the /C command is already quoted? It works fine ! :-)
```
start cmd.exe /k ""C:\Program Files (x86)\Mozilla Firefox\sdk\bin\activate" & cd d:\home\name\addon\ & cfx run"
```
The outer quotes around the /C command are removed prior to execution, leaving only the q... |
8698444 | Batch copy only modified files | 17 | 2012-01-02 07:31:46 | <p>I have two folders (say Source and Working). Now within these, there are 100s of other files/folders.</p>
<p>Now, the folder Source gets updated periodically (i.e. some files/folders may change or get added). I am trying to keep both the folders in sync.</p>
<p>So I need a batch command such that only the files/fold... | 27,738 | 485,743 | 2021-09-28 22:30:35 | 8,698,464 | 18 | 2012-01-02 07:35:53 | 856,777 | 2017-10-09 13:30:21 | https://stackoverflow.com/q/8698444 | https://stackoverflow.com/a/8698464 | <p>You do not need a bat file. Just use the <a href="http://www.computerhope.com/xcopyhlp.htm" rel="noreferrer">xcopy</a> with some parameters. Try:</p>
<pre><code>xcopy <path to source> <path to destination> /D /E /C /Q /H /R /Y /K
source Specifies the file(s) to copy.
destination Specifies the locat... | <p>You do not need a bat file. Just use the <a href="http://www.computerhope.com/xcopyhlp.htm" rel="noreferrer">xcopy</a> with some parameters. Try:</p> <pre><code>xcopy <path to source> <path to destination> /D /E /C /Q /H /R /Y /K source Specifies the file(s) to copy. destination Specifies the locat... | 5370, 7002 | batch-file, dos | <h1>Batch copy only modified files</h1>
<p>I have two folders (say Source and Working). Now within these, there are 100s of other files/folders.</p>
<p>Now, the folder Source gets updated periodically (i.e. some files/folders may change or get added). I am trying to keep both the folders in sync.</p>
<p>So I need a bat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,017 | cmd | # Batch copy only modified files
I have two folders (say Source and Working). Now within these, there are 100s of other files/folders.
Now, the folder Source gets updated periodically (i.e. some files/folders may change or get added). I am trying to keep both the folders in sync.
So I need a batch command such that ... | You do not need a bat file. Just use the [xcopy](http://www.computerhope.com/xcopyhlp.htm) with some parameters. Try:
```
xcopy <path to source> <path to destination> /D /E /C /Q /H /R /Y /K
source Specifies the file(s) to copy.
destination Specifies the location or name of new files.
/A Copies only files with t... |
14620709 | How to split string without for loop in batch file | 16 | 2013-01-31 07:38:39 | <p>I want to split a string in two parts, without using any for loop.</p>
<p>For example, I have the string in a variable:</p>
<pre><code>str=45:abc
</code></pre>
<p>I want to get <code>45</code> in a variable and <code>abc</code> in another variable. Is it possible in batch file?</p>
<p>pattern is like somenumber:... | 39,742 | 1,511,510 | 2022-06-15 10:29:56 | 14,621,732 | 18 | 2013-01-31 08:52:05 | 463,115 | 2013-06-14 11:59:23 | https://stackoverflow.com/q/14620709 | https://stackoverflow.com/a/14621732 | <p>You could split the str with different ways.</p>
<p>The for loop, you don't want use it. </p>
<p>The trailing part is easy with the <code>*</code> (match anything until ...)<br>
<code>set "var2=%str:*:=%"</code></p>
<p>The leading part can be done with a nasty trick<br>
<code>set "var1=%str::="^&REM #%</code... | <p>You could split the str with different ways.</p> <p>The for loop, you don't want use it. </p> <p>The trailing part is easy with the <code>*</code> (match anything until ...)<br> <code>set "var2=%str:*:=%"</code></p> <p>The leading part can be done with a nasty trick<br> <code>set "var1=%str::="^&REM #%</code... | 7002 | batch-file | <h1>How to split string without for loop in batch file</h1>
<p>I want to split a string in two parts, without using any for loop.</p>
<p>For example, I have the string in a variable:</p>
<pre><code>str=45:abc
</code></pre>
<p>I want to get <code>45</code> in a variable and <code>abc</code> in another variable. Is it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,018 | cmd | # How to split string without for loop in batch file
I want to split a string in two parts, without using any for loop.
For example, I have the string in a variable:
```
str=45:abc
```
I want to get `45` in a variable and `abc` in another variable. Is it possible in batch file?
pattern is like somenumber:somestrin... | You could split the str with different ways.
The for loop, you don't want use it.
The trailing part is easy with the `*` (match anything until ...)
`set "var2=%str:*:=%"`
The leading part can be done with a nasty trick
`set "var1=%str::="^&REM #%`
The caret is needed to escape the ampersand,
so effectivly the... |
44526763 | How to perform tf.image.per_image_standardization on a batch of images in tensorflow | 14 | 2017-06-13 16:17:30 | <p>I would like to know how to perform image whitening on a batch of images. </p>
<p>According to the documentation in <a href="https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization" rel="noreferrer">https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization</a>, it is said t... | 7,564 | 7,886,651 | 2017-06-13 18:05:20 | 44,528,576 | 18 | 2017-06-13 18:05:20 | 7,886,651 | 2017-06-13 18:05:20 | https://stackoverflow.com/q/44526763 | https://stackoverflow.com/a/44528576 | <p>This is how to perform this operation on a batch of images.</p>
<p><code>tf.map_fn(lambda frame: tf.image.per_image_standardization(frame), frames)</code></p>
| <p>This is how to perform this operation on a batch of images.</p> <p><code>tf.map_fn(lambda frame: tf.image.per_image_standardization(frame), frames)</code></p> | 30645, 115813, 124123 | batch-processing, image-whitening, tensorflow | <h1>How to perform tf.image.per_image_standardization on a batch of images in tensorflow</h1>
<p>I would like to know how to perform image whitening on a batch of images. </p>
<p>According to the documentation in <a href="https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization" rel="noreferrer">h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,021 | cmd | # How to perform tf.image.per_image_standardization on a batch of images in tensorflow
I would like to know how to perform image whitening on a batch of images.
According to the documentation in <https://www.tensorflow.org/api_docs/python/tf/image/per_image_standardization>, it is said that `tf.image.per_image_standa... | This is how to perform this operation on a batch of images.
`tf.map_fn(lambda frame: tf.image.per_image_standardization(frame), frames)` |
24949892 | reduce image size using imagemagick for batch of images | 14 | 2014-07-25 07:04:59 | <p>I need to convert batch of .jpg images filesize using image magick. am able to convert a single file using the following code</p>
<pre><code> convert -strip -interlace Plane -gaussian-blur 0.05 -quality 65% 1.jpg result.jpg
</code></pre>
<p>I need to do this convert for a batch of images. i tried this but it is n... | 12,101 | 552,995 | 2017-02-21 09:16:57 | 24,951,597 | 18 | 2014-07-25 08:44:01 | 2,384,416 | 2014-07-25 08:44:01 | https://stackoverflow.com/q/24949892 | https://stackoverflow.com/a/24951597 | <p>Use this command to convert your batch of images under a folder</p>
<pre><code> mogrify -path imagepath -strip -quality 50% *.jpg
</code></pre>
| <p>Use this command to convert your batch of images under a folder</p> <pre><code> mogrify -path imagepath -strip -quality 50% *.jpg </code></pre> | 6554, 7002 | batch-file, imagemagick | <h1>reduce image size using imagemagick for batch of images</h1>
<p>I need to convert batch of .jpg images filesize using image magick. am able to convert a single file using the following code</p>
<pre><code> convert -strip -interlace Plane -gaussian-blur 0.05 -quality 65% 1.jpg result.jpg
</code></pre>
<p>I need t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,022 | cmd | # reduce image size using imagemagick for batch of images
I need to convert batch of .jpg images filesize using image magick. am able to convert a single file using the following code
```
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 65% 1.jpg result.jpg
```
I need to do this convert for a batch of ... | Use this command to convert your batch of images under a folder
```
mogrify -path imagepath -strip -quality 50% *.jpg
``` |
16665748 | VBScript to loop through all files in a folder | 14 | 2013-05-21 08:48:43 | <p>I have the code to carry out the process on a single file, could anyone alter this script so it loops through all files in the directory "H:\Letter Display\Letters" with the file type "<em>.LTR</em>" and saves them all:</p>
<pre><code> Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scriptin... | 93,514 | 2,214,968 | 2019-03-30 00:35:29 | 16,669,895 | 18 | 2013-05-21 12:21:40 | 2,282,445 | 2013-05-21 13:26:33 | https://stackoverflow.com/q/16665748 | https://stackoverflow.com/a/16669895 | <p>Maybe this will clear things up. (Or confuse you more, )</p>
<pre><code>Const ForReading = 1
Const ForWriting = 2
sFolder = "H:\Letter Display\Letters\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
For Each oFile In oFSO.GetFolder(sFolder).Files
If UCase(oFSO.GetExtensionName(oFile.Name)) = "LTR" Then
... | <p>Maybe this will clear things up. (Or confuse you more, )</p> <pre><code>Const ForReading = 1 Const ForWriting = 2 sFolder = "H:\Letter Display\Letters\" Set oFSO = CreateObject("Scripting.FileSystemObject") For Each oFile In oFSO.GetFolder(sFolder).Files If UCase(oFSO.GetExtensionName(oFile.Name)) = "LTR" Then ... | 73, 494, 7002 | batch-file, csv, vbscript | <h1>VBScript to loop through all files in a folder</h1>
<p>I have the code to carry out the process on a single file, could anyone alter this script so it loops through all files in the directory "H:\Letter Display\Letters" with the file type "<em>.LTR</em>" and saves them all:</p>
<pre><code> Const ForReading = 1
Co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,023 | cmd | # VBScript to loop through all files in a folder
I have the code to carry out the process on a single file, could anyone alter this script so it loops through all files in the directory "H:\Letter Display\Letters" with the file type "*.LTR*" and saves them all:
```
Const ForReading = 1
Const ForWriting = 2
Set ob... | Maybe this will clear things up. (Or confuse you more, )
```
Const ForReading = 1
Const ForWriting = 2
sFolder = "H:\Letter Display\Letters\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
For Each oFile In oFSO.GetFolder(sFolder).Files
If UCase(oFSO.GetExtensionName(oFile.Name)) = "LTR" Then
ProcessFil... |
45718888 | Spring batch - running multiple jobs in parallel | 13 | 2017-08-16 16:38:32 | <p>I am new to Spring batch and couldn't figure out how to do this..</p>
<p>Basically I have a spring file poller which runs every N mins to look for files with some name (ex: A.txt & B.txt) in certain directory. At any moment in time, there could be max 2 files in this directory (A and B). Through Spring Batch Jo... | 54,495 | 7,810,933 | 2020-09-07 14:29:35 | 45,720,974 | 18 | 2017-08-16 18:52:51 | 520,359 | 2017-08-16 19:29:37 | https://stackoverflow.com/q/45718888 | https://stackoverflow.com/a/45720974 | <p>I believe that you can. Since you are new in spring batch (just like me) I would recommend that you go through <a href="http://docs.spring.io/spring-batch/4.0.x/reference/html/domain.html#domainLanguageOfBatch" rel="noreferrer">the domain language of a batch</a> if you haven't done so already.</p>
<p>Then you may s... | <p>I believe that you can. Since you are new in spring batch (just like me) I would recommend that you go through <a href="http://docs.spring.io/spring-batch/4.0.x/reference/html/domain.html#domainLanguageOfBatch" rel="noreferrer">the domain language of a batch</a> if you haven't done so already.</p> <p>Then you may s... | 353, 1211, 16537, 41895 | parallel-processing, spring, spring-batch, spring-integration | <h1>Spring batch - running multiple jobs in parallel</h1>
<p>I am new to Spring batch and couldn't figure out how to do this..</p>
<p>Basically I have a spring file poller which runs every N mins to look for files with some name (ex: A.txt & B.txt) in certain directory. At any moment in time, there could be max 2 ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,024 | cmd | # Spring batch - running multiple jobs in parallel
I am new to Spring batch and couldn't figure out how to do this..
Basically I have a spring file poller which runs every N mins to look for files with some name (ex: A.txt & B.txt) in certain directory. At any moment in time, there could be max 2 files in this direct... | I believe that you can. Since you are new in spring batch (just like me) I would recommend that you go through [the domain language of a batch](http://docs.spring.io/spring-batch/4.0.x/reference/html/domain.html#domainLanguageOfBatch) if you haven't done so already.
Then you may start by configuring your own *asynchro... |
24126448 | Batch - If not defined a variable | 13 | 2014-06-09 18:23:16 | <p>What can I do if I want to echo a warning if the variable <code>favnum</code> is not filled?</p>
<p>I already tried this:</p>
<pre><code>echo What's your favorite color?
echo.
set /p favnum=">"
if not defined favnum(
goto nope
)
</code></pre>
| 50,655 | null | 2021-08-18 17:59:20 | 24,126,630 | 18 | 2014-06-09 18:34:41 | 2,152,082 | 2021-08-18 17:59:20 | https://stackoverflow.com/q/24126448 | https://stackoverflow.com/a/24126630 | <p>give it a space between <code>favnum</code> and <code>(</code></p>
<p>As you wrote it, <code>if</code> checks for a variable named <code>favnum(</code>. It then misses a command to execute and spits a syntax error.</p>
| <p>give it a space between <code>favnum</code> and <code>(</code></p> <p>As you wrote it, <code>if</code> checks for a variable named <code>favnum(</code>. It then misses a command to execute and spits a syntax error.</p> | 276, 2631, 7002 | batch-file, cmd, variables | <h1>Batch - If not defined a variable</h1>
<p>What can I do if I want to echo a warning if the variable <code>favnum</code> is not filled?</p>
<p>I already tried this:</p>
<pre><code>echo What's your favorite color?
echo.
set /p favnum=">"
if not defined favnum(
goto nope
)
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,025 | cmd | # Batch - If not defined a variable
What can I do if I want to echo a warning if the variable `favnum` is not filled?
I already tried this:
```
echo What's your favorite color?
echo.
set /p favnum=">"
if not defined favnum(
goto nope
)
``` | give it a space between `favnum` and `(`
As you wrote it, `if` checks for a variable named `favnum(`. It then misses a command to execute and spits a syntax error. |
11759007 | Copy only existing files with robocopy | 13 | 2012-08-01 12:16:36 | <p>a service is running on many servers and on some machines I need another set of plugins than on other machines for this service.</p>
<p>On all those hosts there is already the folder with some plugin files needed for that host. Now I need to update those from one single source.</p>
<p>It is important that robocopy... | 7,692 | 1,277,098 | 2020-03-17 05:23:31 | 12,618,664 | 18 | 2012-09-27 09:53:25 | 1,277,098 | 2012-09-27 09:53:25 | https://stackoverflow.com/q/11759007 | https://stackoverflow.com/a/12618664 | <p>Okay, the German translation is a little bit bad. The original English help from robocopy tells me exactly what to use:</p>
<pre><code>/XL : eXclude "Lonely" files and dirs (present in source but not destination)
This will prevent any new files being added to the destination.
</code></pre>
<p>(In the German ... | <p>Okay, the German translation is a little bit bad. The original English help from robocopy tells me exactly what to use:</p> <pre><code>/XL : eXclude "Lonely" files and dirs (present in source but not destination) This will prevent any new files being added to the destination. </code></pre> <p>(In the German ... | 7002, 11635 | batch-file, robocopy | <h1>Copy only existing files with robocopy</h1>
<p>a service is running on many servers and on some machines I need another set of plugins than on other machines for this service.</p>
<p>On all those hosts there is already the folder with some plugin files needed for that host. Now I need to update those from one sing... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,026 | cmd | # Copy only existing files with robocopy
a service is running on many servers and on some machines I need another set of plugins than on other machines for this service.
On all those hosts there is already the folder with some plugin files needed for that host. Now I need to update those from one single source.
It i... | Okay, the German translation is a little bit bad. The original English help from robocopy tells me exactly what to use:
```
/XL : eXclude "Lonely" files and dirs (present in source but not destination)
This will prevent any new files being added to the destination.
```
(In the German translation the very helpfu... |
10383021 | How do I run a .bat file from CMake? | 13 | 2012-04-30 11:35:40 | <p>How do I run a .bat file from CMake in a pre-link or a post-build event?</p>
| 19,651 | 1,358,899 | 2018-11-03 23:10:12 | 10,383,442 | 18 | 2012-04-30 12:08:00 | 2,556,117 | 2012-09-27 13:44:21 | https://stackoverflow.com/q/10383021 | https://stackoverflow.com/a/10383442 | <p>You could use <code>add_custom_command</code>, e.g.</p>
<pre><code>if(WIN32)
add_custom_command(TARGET <Your target>
POST_BUILD
COMMAND cmd //C <path to .bat file> <ARGS> )
endif()
</code></pre>
<p><br/>
For full details about <code>add_custom_comm... | <p>You could use <code>add_custom_command</code>, e.g.</p> <pre><code>if(WIN32) add_custom_command(TARGET <Your target> POST_BUILD COMMAND cmd //C <path to .bat file> <ARGS> ) endif() </code></pre> <p><br/> For full details about <code>add_custom_comm... | 7002, 8822 | batch-file, cmake | <h1>How do I run a .bat file from CMake?</h1>
<p>How do I run a .bat file from CMake in a pre-link or a post-build event?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,027 | cmd | # How do I run a .bat file from CMake?
How do I run a .bat file from CMake in a pre-link or a post-build event? | You could use `add_custom_command`, e.g.
```
if(WIN32)
add_custom_command(TARGET <Your target>
POST_BUILD
COMMAND cmd //C <path to .bat file> <ARGS> )
endif()
```
For full details about `add_custom_command` run
```
cmake --help-command add_custom_command
``` |
10071300 | How to create a batch file which work for both Program Files and Program Files(x86)? | 13 | 2012-04-09 09:27:11 | <p>I have created a batch file which automatically copy a .sql file to the path of installed Jasper server(it could be any software installation directory).</p>
<p>This is my batch script--</p>
<p>C:\PROGRA~2\JASPER~1.0\mysql\bin\mysql.exe -u root -proot < create_database.sql</p>
<p>that is working when jasper i... | 60,155 | 1,105,809 | 2015-06-28 04:01:47 | 10,071,403 | 18 | 2012-04-09 09:36:24 | 34,148 | 2012-04-09 09:42:54 | https://stackoverflow.com/q/10071300 | https://stackoverflow.com/a/10071403 | <p>You want to use environment variables to look up things like this. On 32bit Windows, <code>%ProgramFiles%</code> is your friend.</p>
<p>On 64bit Windows, things are a little more complicated, as application can be installed both in <code>%ProgramFiles%</code> and <code>%ProgramFiles(x86)%</code>.</p>
<p>If you can... | <p>You want to use environment variables to look up things like this. On 32bit Windows, <code>%ProgramFiles%</code> is your friend.</p> <p>On 64bit Windows, things are a little more complicated, as application can be installed both in <code>%ProgramFiles%</code> and <code>%ProgramFiles(x86)%</code>.</p> <p>If you can... | 4313, 7002, 30645, 32643 | 32bit-64bit, batch-file, batch-processing, nsis | <h1>How to create a batch file which work for both Program Files and Program Files(x86)?</h1>
<p>I have created a batch file which automatically copy a .sql file to the path of installed Jasper server(it could be any software installation directory).</p>
<p>This is my batch script--</p>
<p>C:\PROGRA~2\JASPER~1.0\mysq... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,028 | cmd | # How to create a batch file which work for both Program Files and Program Files(x86)?
I have created a batch file which automatically copy a .sql file to the path of installed Jasper server(it could be any software installation directory).
This is my batch script--
C:\PROGRA~2\JASPER~1.0\mysql\bin\mysql.exe -u root... | You want to use environment variables to look up things like this. On 32bit Windows, `%ProgramFiles%` is your friend.
On 64bit Windows, things are a little more complicated, as application can be installed both in `%ProgramFiles%` and `%ProgramFiles(x86)%`.
If you cannot look up the location of Jasper some other way ... |
7937963 | Batch file to upload .txt to FTP | 13 | 2011-10-29 09:13:50 | <p>I have setup a separate FTP account for this. </p>
<p>Here is the info:</p>
<pre><code>FTP Username: ahk@proflightsimulatoreview.com
FTP Server: ftp.proflightsimulatoreview.com
FTP Server Port: 21
FTP Password: ahktest
</code></pre>
<p>Text file I want to upload: <code>C:\Users\Kyle\Desktop\ftptest\thetest.txt</c... | 94,516 | 1,019,588 | 2020-05-14 17:48:20 | 7,938,073 | 18 | 2011-10-29 09:35:09 | 246,342 | 2011-10-29 10:18:15 | https://stackoverflow.com/q/7937963 | https://stackoverflow.com/a/7938073 | <p>I just put HELLO.TXT in your ftp root by;</p>
<p><strong>1</strong>. Saving this as <code>MYFTP.bat</code>:</p>
<pre><code>@echo off
echo user ahk@proflightsimulatoreview.com> ftpcmd.dat
echo ahktest>> ftpcmd.dat
echo put %1>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat ftp.profligh... | <p>I just put HELLO.TXT in your ftp root by;</p> <p><strong>1</strong>. Saving this as <code>MYFTP.bat</code>:</p> <pre><code>@echo off echo user ahk@proflightsimulatoreview.com> ftpcmd.dat echo ahktest>> ftpcmd.dat echo put %1>> ftpcmd.dat echo quit>> ftpcmd.dat ftp -n -s:ftpcmd.dat ftp.profligh... | 64, 261, 2631, 7002 | batch-file, cmd, ftp, windows | <h1>Batch file to upload .txt to FTP</h1>
<p>I have setup a separate FTP account for this. </p>
<p>Here is the info:</p>
<pre><code>FTP Username: ahk@proflightsimulatoreview.com
FTP Server: ftp.proflightsimulatoreview.com
FTP Server Port: 21
FTP Password: ahktest
</code></pre>
<p>Text file I want to upload: <code>C:... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,029 | cmd | # Batch file to upload .txt to FTP
I have setup a separate FTP account for this.
Here is the info:
```
FTP Username: ahk@proflightsimulatoreview.com
FTP Server: ftp.proflightsimulatoreview.com
FTP Server Port: 21
FTP Password: ahktest
```
Text file I want to upload: `C:\Users\Kyle\Desktop\ftptest\thetest.txt`
Plea... | I just put HELLO.TXT in your ftp root by;
**1**. Saving this as `MYFTP.bat`:
```
@echo off
echo user ahk@proflightsimulatoreview.com> ftpcmd.dat
echo ahktest>> ftpcmd.dat
echo put %1>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat ftp.proflightsimulatoreview.com
del ftpcmd.dat
```
**2**. From the command li... |
6500217 | Random variable not changing in "for" loop in windows batch file | 13 | 2011-06-27 23:51:34 | <p>I'm trying to print out a Random number multiple times but in the for loop I use, it doesn't reset the variable. Here's my code.</p>
<pre><code>@echo off
for %%i in (*.txt) do (
set checker=%Random%
echo %checker%
echo %%i% >> backupF
)
echo Complete
</code></pre>
<p>There are 5 text files and so I... | 13,126 | 818,291 | 2022-10-16 08:29:50 | 6,500,797 | 18 | 2011-06-28 01:58:39 | 297,408 | 2011-06-28 19:20:17 | https://stackoverflow.com/q/6500217 | https://stackoverflow.com/a/6500797 | <p>I'm not sure how you've been able to have it print even one random number. In your case, <code>%checker%</code> should evaluate to an empty string, unless you run your script more than once from the same <code>cmd</code> session.</p>
<p>Basically, the reason your script doesn't work as intended is because the varia... | <p>I'm not sure how you've been able to have it print even one random number. In your case, <code>%checker%</code> should evaluate to an empty string, unless you run your script more than once from the same <code>cmd</code> session.</p> <p>Basically, the reason your script doesn't work as intended is because the varia... | 64, 197, 2531, 7002 | batch-file, for-loop, random, windows | <h1>Random variable not changing in "for" loop in windows batch file</h1>
<p>I'm trying to print out a Random number multiple times but in the for loop I use, it doesn't reset the variable. Here's my code.</p>
<pre><code>@echo off
for %%i in (*.txt) do (
set checker=%Random%
echo %checker%
echo %%i% >> backup... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,030 | cmd | # Random variable not changing in "for" loop in windows batch file
I'm trying to print out a Random number multiple times but in the for loop I use, it doesn't reset the variable. Here's my code.
```
@echo off
for %%i in (*.txt) do (
set checker=%Random%
echo %checker%
echo %%i% >> backupF
)
echo Complete
`... | I'm not sure how you've been able to have it print even one random number. In your case, `%checker%` should evaluate to an empty string, unless you run your script more than once from the same `cmd` session.
Basically, the reason your script doesn't work as intended is because the variables in the loop body are parsed... |
5170627 | Is it possible to pass a variable into a Windows FTP script file? | 13 | 2011-03-02 16:46:32 | <p>I have a batch script that dynamically creates some files and generates four files with somewhat random filenames based on the time, date, etc. It then needs to upload that file to a server via FTP. </p>
<p>As of right now, my .bat file has a line like "ftp -s:ftp.txt". Ftp.txt contains some fairly straightforward ... | 27,768 | 332,544 | 2016-03-30 12:21:34 | 5,170,759 | 18 | 2011-03-02 16:58:31 | 7,059 | 2016-03-30 12:21:34 | https://stackoverflow.com/q/5170627 | https://stackoverflow.com/a/5170759 | <p>You could generate the ftp.txt file on the fly with your bat file. Simply do something like : </p>
<pre><code>echo ftp.myserver.com>ftp.txt
echo username>>ftp.txt
echo password>>ftp.txt
echo put filename1.dat>>ftp.txt
echo put filename2.dat>>ftp.txt
echo put filename3.dat>>ftp.txt
e... | <p>You could generate the ftp.txt file on the fly with your bat file. Simply do something like : </p> <pre><code>echo ftp.myserver.com>ftp.txt echo username>>ftp.txt echo password>>ftp.txt echo put filename1.dat>>ftp.txt echo put filename2.dat>>ftp.txt echo put filename3.dat>>ftp.txt e... | 64, 261, 7002 | batch-file, ftp, windows | <h1>Is it possible to pass a variable into a Windows FTP script file?</h1>
<p>I have a batch script that dynamically creates some files and generates four files with somewhat random filenames based on the time, date, etc. It then needs to upload that file to a server via FTP. </p>
<p>As of right now, my .bat file has ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,031 | cmd | # Is it possible to pass a variable into a Windows FTP script file?
I have a batch script that dynamically creates some files and generates four files with somewhat random filenames based on the time, date, etc. It then needs to upload that file to a server via FTP.
As of right now, my .bat file has a line like "ftp ... | You could generate the ftp.txt file on the fly with your bat file. Simply do something like :
```
echo ftp.myserver.com>ftp.txt
echo username>>ftp.txt
echo password>>ftp.txt
echo put filename1.dat>>ftp.txt
echo put filename2.dat>>ftp.txt
echo put filename3.dat>>ftp.txt
echo put filename4.dat>>ftp.txt
ftp -s:ftp.txt
``... |
50555929 | Get only PID from tasklist using cmd title | 12 | 2018-05-27 19:51:47 | <p>Desired output:</p>
<pre><code>1234
</code></pre>
<p>Just the PID. Nothing else - no other characters, numbers, or symbols.</p>
<p>I'm trying to run <code>tasklist</code> so it gives me only the PID of a named or titled process.</p>
<p><code>tasklist | findstr /i "cmd.exe"</code> is the closest I've gotten, but ... | 51,405 | 981,552 | 2021-09-28 19:06:29 | 50,561,117 | 18 | 2018-05-28 07:23:42 | 5,047,996 | 2018-05-28 08:54:48 | https://stackoverflow.com/q/50555929 | https://stackoverflow.com/a/50561117 |
<p>The difficult thing with <code>tasklist</code> is its default output format. For example, when command line:</p>
<pre class="lang-cmd prettyprint-override"><code>tasklist /FI "ImageName eq cmd.exe" /FI "Status eq Running"
</code></pre>
<p>is executed, we get:</p>
<blockquote>
<pre class="lang-cmd prettyprint-ov... | <p>The difficult thing with <code>tasklist</code> is its default output format. For example, when command line:</p> <pre class="lang-cmd prettyprint-override"><code>tasklist /FI "ImageName eq cmd.exe" /FI "Status eq Running" </code></pre> <p>is executed, we get:</p> <blockquote> <pre class="lang-cmd prettyprint-ov... | 64, 2631, 3300, 9402, 9647 | cmd, pid, tasklist, title, windows | <h1>Get only PID from tasklist using cmd title</h1>
<p>Desired output:</p>
<pre><code>1234
</code></pre>
<p>Just the PID. Nothing else - no other characters, numbers, or symbols.</p>
<p>I'm trying to run <code>tasklist</code> so it gives me only the PID of a named or titled process.</p>
<p><code>tasklist | findstr ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,032 | cmd | # Get only PID from tasklist using cmd title
Desired output:
```
1234
```
Just the PID. Nothing else - no other characters, numbers, or symbols.
I'm trying to run `tasklist` so it gives me only the PID of a named or titled process.
`tasklist | findstr /i "cmd.exe"` is the closest I've gotten, but the result is too... | The difficult thing with `tasklist` is its default output format. For example, when command line:
```
tasklist /FI "ImageName eq cmd.exe" /FI "Status eq Running"
```
is executed, we get:
> ```
> Image Name PID Session Name Session# Mem Usage
> ========================= ======== ========... |
9799763 | ( was unexpected at this time - batch script | 12 | 2012-03-21 06:42:58 | <p>I'm using the batch script below and get an error </p>
<blockquote>
<p>( was unexpected at this time.</p>
</blockquote>
<p>I know that the problem is in the first line but I don't understand what is wrong.
Any ideas ?</p>
<p>script:</p>
<pre><code>IF [%1]==[] (
:LOOP1
SET /P isDefault=Value Missing, do... | 35,963 | 1,265,682 | 2017-11-14 08:17:54 | 9,799,998 | 18 | 2012-03-21 07:04:08 | 179,715 | 2014-10-27 07:23:06 | https://stackoverflow.com/q/9799763 | https://stackoverflow.com/a/9799998 | <p>Actually, the problem is <em>not</em> on the first line. </p>
<p>The problem is that <code>cmd</code> does variable substitution immediately when it parses the <code>IF</code> statement, including its body. Therefore the line:</p>
<pre><code>IF %isDefault%==y (
</code></pre>
<p>is problematic because <code>isDe... | <p>Actually, the problem is <em>not</em> on the first line. </p> <p>The problem is that <code>cmd</code> does variable substitution immediately when it parses the <code>IF</code> statement, including its body. Therefore the line:</p> <pre><code>IF %isDefault%==y ( </code></pre> <p>is problematic because <code>isDe... | 531, 7002 | batch-file, scripting | <h1>( was unexpected at this time - batch script</h1>
<p>I'm using the batch script below and get an error </p>
<blockquote>
<p>( was unexpected at this time.</p>
</blockquote>
<p>I know that the problem is in the first line but I don't understand what is wrong.
Any ideas ?</p>
<p>script:</p>
<pre><code>IF [%1]==... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,033 | cmd | # ( was unexpected at this time - batch script
I'm using the batch script below and get an error
> ( was unexpected at this time.
I know that the problem is in the first line but I don't understand what is wrong.
Any ideas ?
script:
```
IF [%1]==[] (
:LOOP1
SET /P isDefault=Value Missing, do you want to us... | Actually, the problem is *not* on the first line.
The problem is that `cmd` does variable substitution immediately when it parses the `IF` statement, including its body. Therefore the line:
```
IF %isDefault%==y (
```
is problematic because `isDefault` isn't set when the outer `IF` statement is parsed, so it becomes... |
48450527 | Conda cannot remove environment called "tensorflow" | 11 | 2018-01-25 19:30:45 | <p>I just run the following command to create a Conda environment:</p>
<pre><code>conda create -n tensorflow python=3.5
</code></pre>
<p>However, I want to delete it now. When I try doing:</p>
<pre><code>conda remove -n tensorflow
</code></pre>
<p>or </p>
<pre><code>conda remove --name tensorflow
</code></pre>
<p... | 11,951 | 6,435,921 | 2018-01-25 19:35:47 | 48,450,600 | 18 | 2018-01-25 19:35:47 | 5,014,455 | 2018-01-25 19:35:47 | https://stackoverflow.com/q/48450527 | https://stackoverflow.com/a/48450600 | <p>I would try:</p>
<pre><code>conda env remove --name tensorflow
</code></pre>
<p>Which forces <code>conda</code> to only consider environments, since a </p>
<pre><code>conda remove
</code></pre>
<p>command can also be used to remove packages. I suspect <code>conda</code> is being tripped up by the fact that <code... | <p>I would try:</p> <pre><code>conda env remove --name tensorflow </code></pre> <p>Which forces <code>conda</code> to only consider environments, since a </p> <pre><code>conda remove </code></pre> <p>command can also be used to remove packages. I suspect <code>conda</code> is being tripped up by the fact that <code... | 16, 2631, 60010, 92746, 96537 | anaconda, cmd, conda, python, python-3.x | <h1>Conda cannot remove environment called "tensorflow"</h1>
<p>I just run the following command to create a Conda environment:</p>
<pre><code>conda create -n tensorflow python=3.5
</code></pre>
<p>However, I want to delete it now. When I try doing:</p>
<pre><code>conda remove -n tensorflow
</code></pre>
<p>or </p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,035 | cmd | # Conda cannot remove environment called "tensorflow"
I just run the following command to create a Conda environment:
```
conda create -n tensorflow python=3.5
```
However, I want to delete it now. When I try doing:
```
conda remove -n tensorflow
```
or
```
conda remove --name tensorflow
```
I get the following ... | I would try:
```
conda env remove --name tensorflow
```
Which forces `conda` to only consider environments, since a
```
conda remove
```
command can also be used to remove packages. I suspect `conda` is being tripped up by the fact that `tensorflow` is a package name *and* an environment name. |
38000901 | Loop through ASCII codes in batch file | 11 | 2016-06-23 20:08:53 | <p>How do I loop through ASCII values (here, alphabets) and work on them?</p>
<p>I want to echo A to Z without having to type every character manually like
<code>for %%J in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do echo %%J</code></p>
<p>So I was wondering if I can cycle through ASCII codes. Something... | 6,922 | 4,427,870 | 2020-02-17 16:04:08 | 38,003,356 | 18 | 2016-06-23 23:17:12 | 5,047,996 | 2016-06-24 09:11:06 | https://stackoverflow.com/q/38000901 | https://stackoverflow.com/a/38003356 | <p>Surprisingly, there is a solution that makes use of an undocumented <a href="http://ss64.com/nt/syntax-variables.html" rel="noreferrer">built-in environment variable</a> named <code>=ExitCodeAscii</code>, which holds the ASCII character of the current exit code<sup>1</sup> (<code>ErrorLevel</code>):</p>
<pre><code>... | <p>Surprisingly, there is a solution that makes use of an undocumented <a href="http://ss64.com/nt/syntax-variables.html" rel="noreferrer">built-in environment variable</a> named <code>=ExitCodeAscii</code>, which holds the ASCII character of the current exit code<sup>1</sup> (<code>ErrorLevel</code>):</p> <pre><code>... | 1843, 2531, 2631, 7002 | ascii, batch-file, cmd, for-loop | <h1>Loop through ASCII codes in batch file</h1>
<p>How do I loop through ASCII values (here, alphabets) and work on them?</p>
<p>I want to echo A to Z without having to type every character manually like
<code>for %%J in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do echo %%J</code></p>
<p>So I was wonderi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,036 | cmd | # Loop through ASCII codes in batch file
How do I loop through ASCII values (here, alphabets) and work on them?
I want to echo A to Z without having to type every character manually like
`for %%J in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do echo %%J`
So I was wondering if I can cycle through ASCII cod... | Surprisingly, there is a solution that makes use of an undocumented [built-in environment variable](http://ss64.com/nt/syntax-variables.html) named `=ExitCodeAscii`, which holds the ASCII character of the current exit code1 (`ErrorLevel`):
```
@echo off
for /L %%A in (65,1,90) do (
cmd /C exit %%A
call echo %%... |
36645648 | Spring batch corePoolSize VS throttle-limit | 11 | 2016-04-15 11:14:37 | <p>I'd like to know the difference between <strong>corePoolSize</strong> and <strong>throttle-limit</strong> as Spring Batch attributes defining multi threading configuration.</p>
<p>I've got the difference between corePoolSize and maxPoolSize thanks to this post <a href="https://stackoverflow.com/a/1879487/1529015">"... | 23,265 | 1,529,015 | 2019-02-18 10:28:45 | 36,894,781 | 18 | 2016-04-27 15:49:40 | 192,444 | 2016-04-27 15:49:40 | https://stackoverflow.com/q/36645648 | https://stackoverflow.com/a/36894781 | <p>The core pool size says a thread pool executor will start with <code>N</code> number of threads. A throttle-limit <code>T</code> says that, regardless of the number of threads available in the thread pool, only use <code>T</code> of those threads for a tasklet. </p>
<p>So you can have a thread pool with a core pool... | <p>The core pool size says a thread pool executor will start with <code>N</code> number of threads. A throttle-limit <code>T</code> says that, regardless of the number of threads available in the thread pool, only use <code>T</code> of those threads for a tasklet. </p> <p>So you can have a thread pool with a core pool... | 17, 1211, 1381, 41895 | java, multithreading, spring, spring-batch | <h1>Spring batch corePoolSize VS throttle-limit</h1>
<p>I'd like to know the difference between <strong>corePoolSize</strong> and <strong>throttle-limit</strong> as Spring Batch attributes defining multi threading configuration.</p>
<p>I've got the difference between corePoolSize and maxPoolSize thanks to this post <a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,037 | cmd | # Spring batch corePoolSize VS throttle-limit
I'd like to know the difference between **corePoolSize** and **throttle-limit** as Spring Batch attributes defining multi threading configuration.
I've got the difference between corePoolSize and maxPoolSize thanks to this post ["What is the difference between corePoolSiz... | The core pool size says a thread pool executor will start with `N` number of threads. A throttle-limit `T` says that, regardless of the number of threads available in the thread pool, only use `T` of those threads for a tasklet.
So you can have a thread pool with a core pool size of 8 and two tasklets with throttle li... |
21226980 | cURL output to file | 11 | 2014-01-20 05:43:50 | <p>Is it possible to direct this output from cURL into a file?</p>
<pre><code> % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1354 100 1354 0 0 17358 0 --:--:-- --:--:-- --:--:-- 17358
100 ... | 49,921 | 1,727,487 | 2017-02-18 18:03:30 | 21,229,786 | 18 | 2014-01-20 08:59:09 | 2,861,476 | 2014-01-20 08:59:09 | https://stackoverflow.com/q/21226980 | https://stackoverflow.com/a/21229786 | <p>This output is sent to stderr. So, to get it all you need is redirect stream 2 (stderr) to a file as </p>
<pre><code>curl -o responseFile.html http://www.somewhere.com 2> informationFile.txt
</code></pre>
<p>But, as your capture shows, times are not always included. </p>
<p>The better option to know if the req... | <p>This output is sent to stderr. So, to get it all you need is redirect stream 2 (stderr) to a file as </p> <pre><code>curl -o responseFile.html http://www.somewhere.com 2> informationFile.txt </code></pre> <p>But, as your capture shows, times are not always included. </p> <p>The better option to know if the req... | 64, 942, 1554, 2631 | cmd, curl, logging, windows | <h1>cURL output to file</h1>
<p>Is it possible to direct this output from cURL into a file?</p>
<pre><code> % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1354 100 1354 0 0 17358 0 --:--:--... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,038 | cmd | # cURL output to file
Is it possible to direct this output from cURL into a file?
```
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1354 100 1354 0 0 17358 0 --:--:-- --:--:-- --:--:-- 1... | This output is sent to stderr. So, to get it all you need is redirect stream 2 (stderr) to a file as
```
curl -o responseFile.html http://www.somewhere.com 2> informationFile.txt
```
But, as your capture shows, times are not always included.
The better option to know if the request succeded and how long it took is t... |
4193413 | Windows batch: Unicode parameters for (robo) copy command | 11 | 2010-11-16 10:57:06 | <p>I need to copy multiple files in a single batch file. The files have Unicode names that map to different codepages.</p>
<p><strong>Example:</strong></p>
<pre><code>set ArabicFile=ڊڌڵڲڛشس
set CyrillicFile=щЖЛдЉи
set GermanFile=Bücher
copy %ArabicFile% SomePlaceElse
copy %CyrillicFile% SomePlaceElse
copy %GermanFil... | 21,976 | 234,152 | 2016-08-03 04:06:32 | 4,193,680 | 18 | 2010-11-16 11:35:19 | 3,496 | 2010-11-16 12:08:01 | https://stackoverflow.com/q/4193413 | https://stackoverflow.com/a/4193680 | <p>If</p>
<ul>
<li>I add <code>CHCP 65001</code> as the first line of your batch file,</li>
<li>save the file as UTF-8 without BOM, and</li>
<li>set my console font to something else than "Raster Fonts" (on my Win7 box I can choose Consolas or Lucida Console),</li>
</ul>
<p>it works. Simple, no? :-)</p>
<p>(The font... | <p>If</p> <ul> <li>I add <code>CHCP 65001</code> as the first line of your batch file,</li> <li>save the file as UTF-8 without BOM, and</li> <li>set my console font to something else than "Raster Fonts" (on my Win7 box I can choose Consolas or Lucida Console),</li> </ul> <p>it works. Simple, no? :-)</p> <p>(The font... | 64, 279, 1062, 7002 | batch-file, filenames, unicode, windows | <h1>Windows batch: Unicode parameters for (robo) copy command</h1>
<p>I need to copy multiple files in a single batch file. The files have Unicode names that map to different codepages.</p>
<p><strong>Example:</strong></p>
<pre><code>set ArabicFile=ڊڌڵڲڛشس
set CyrillicFile=щЖЛдЉи
set GermanFile=Bücher
copy %ArabicFi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,039 | cmd | # Windows batch: Unicode parameters for (robo) copy command
I need to copy multiple files in a single batch file. The files have Unicode names that map to different codepages.
**Example:**
```
set ArabicFile=ڊڌڵڲڛشس
set CyrillicFile=щЖЛдЉи
set GermanFile=Bücher
copy %ArabicFile% SomePlaceElse
copy %CyrillicFile% So... | If
- I add `CHCP 65001` as the first line of your batch file,
- save the file as UTF-8 without BOM, and
- set my console font to something else than "Raster Fonts" (on my Win7 box I can choose Consolas or Lucida Console),
it works. Simple, no? :-)
(The font change is actually not necessary, provided you're not writi... |
41383336 | CURL doesn't encode UTF-8 | 10 | 2016-12-29 16:12:56 | <p>I'm using <em>Windows 10</em> and <em>curl 7.52.1</em>.
When I try to <code>POST</code> data to a WEBSERVICE, <em>curl</em> isn't encoding the characters to <code>UTF-8</code> (I need to display <strong>pt-BR</strong> characters, like <strong>àáçÇãõ</strong> etc)</p>
<p>Yes, I have already checked <a href="https://... | 33,950 | 4,421,125 | 2018-09-19 14:20:29 | 41,384,903 | 18 | 2016-12-29 17:58:01 | 4,421,125 | 2016-12-29 17:58:01 | https://stackoverflow.com/q/41383336 | https://stackoverflow.com/a/41384903 | <p>After a discussion with @Dekel and a suggestion coming from @Phylogenesis I could resolve the problem partially, but effectively. There are 2 ways:</p>
<ul>
<li><code>charset=ISO-8859-1</code></li>
<li>encoding a file and sending as binary-data</li>
</ul>
<p>The server could receive the correct letter using <code>... | <p>After a discussion with @Dekel and a suggestion coming from @Phylogenesis I could resolve the problem partially, but effectively. There are 2 ways:</p> <ul> <li><code>charset=ISO-8859-1</code></li> <li>encoding a file and sending as binary-data</li> </ul> <p>The server could receive the correct letter using <code>... | 820, 1124, 1554, 2631, 8944 | cmd, curl, encoding, jquery, utf-8 | <h1>CURL doesn't encode UTF-8</h1>
<p>I'm using <em>Windows 10</em> and <em>curl 7.52.1</em>.
When I try to <code>POST</code> data to a WEBSERVICE, <em>curl</em> isn't encoding the characters to <code>UTF-8</code> (I need to display <strong>pt-BR</strong> characters, like <strong>àáçÇãõ</strong> etc)</p>
<p>Yes, I hav... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,040 | cmd | # CURL doesn't encode UTF-8
I'm using *Windows 10* and *curl 7.52.1*.
When I try to `POST` data to a WEBSERVICE, *curl* isn't encoding the characters to `UTF-8` (I need to display **pt-BR** characters, like **àáçÇãõ** etc)
Yes, I have already checked [this](https://stackoverflow.com/questions/388490/unicode-character... | After a discussion with @Dekel and a suggestion coming from @Phylogenesis I could resolve the problem partially, but effectively. There are 2 ways:
- `charset=ISO-8859-1`
- encoding a file and sending as binary-data
The server could receive the correct letter using `charset=ISO-8859-1`. Even the response data from se... |
37549227 | Executing Command line .exe with parameters in C# | 10 | 2016-05-31 15:01:27 | <p>I'm trying to execute a command line program with parameters from C#. I would have imagined that standing this up and making this happen would be trivial in C# but its proving challenging even with all the resources available on the this site and beyond. I'm at a loss so I will provide as much detail as possible.</p... | 41,227 | 426,746 | 2023-09-20 09:46:14 | 37,549,273 | 18 | 2016-05-31 15:03:33 | 2,319,407 | 2018-04-30 16:43:58 | https://stackoverflow.com/q/37549227 | https://stackoverflow.com/a/37549273 | <p>Wait for the process to end (<em>let it do</em> its work):</p>
<pre><code>ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
// wrap IDisposable into using (in order... | <p>Wait for the process to end (<em>let it do</em> its work):</p> <pre><code>ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command); procStartInfo.RedirectStandardOutput = true; procStartInfo.UseShellExecute = false; procStartInfo.CreateNoWindow = true; // wrap IDisposable into using (in order... | 9, 2631, 8614 | c#, cmd, keystore | <h1>Executing Command line .exe with parameters in C#</h1>
<p>I'm trying to execute a command line program with parameters from C#. I would have imagined that standing this up and making this happen would be trivial in C# but its proving challenging even with all the resources available on the this site and beyond. I'm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,041 | cmd | # Executing Command line .exe with parameters in C#
I'm trying to execute a command line program with parameters from C#. I would have imagined that standing this up and making this happen would be trivial in C# but its proving challenging even with all the resources available on the this site and beyond. I'm at a los... | Wait for the process to end (*let it do* its work):
```
ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
// wrap IDisposable into using (in order to release hProcess)... |
22509529 | JpaItemWriter: no transaction is in progress | 10 | 2014-03-19 14:47:35 | <p>I'd like to use JpaItemWriter to batch persist entities. But when I use the following code to persist, I'm told:</p>
<pre><code>Hibernate:
select
nextval ('hibernate_sequence')
[] 2014-03-19 15:46:02,237 ERROR : TransactionRequiredException: no transaction is in progress
</code></pre>
<p>How can I ena... | 13,298 | 1,194,415 | 2020-12-31 08:09:21 | 22,691,112 | 18 | 2014-03-27 14:46:16 | 1,625,740 | 2014-03-31 16:42:44 | https://stackoverflow.com/q/22509529 | https://stackoverflow.com/a/22691112 | <p>I agree with Michael Minella: Spring batch job repository does not like to share its transaction manager with others. The logic is simple, if you share your job transaction manager with your step transaction manager upon step failure it will rollback both the step and the data written to the job repository. This me... | <p>I agree with Michael Minella: Spring batch job repository does not like to share its transaction manager with others. The logic is simple, if you share your job transaction manager with your step transaction manager upon step failure it will rollback both the step and the data written to the job repository. This me... | 17, 1211, 2990, 41895 | java, jpa, spring, spring-batch | <h1>JpaItemWriter: no transaction is in progress</h1>
<p>I'd like to use JpaItemWriter to batch persist entities. But when I use the following code to persist, I'm told:</p>
<pre><code>Hibernate:
select
nextval ('hibernate_sequence')
[] 2014-03-19 15:46:02,237 ERROR : TransactionRequiredException: no tran... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,043 | cmd | # JpaItemWriter: no transaction is in progress
I'd like to use JpaItemWriter to batch persist entities. But when I use the following code to persist, I'm told:
```
Hibernate:
select
nextval ('hibernate_sequence')
[] 2014-03-19 15:46:02,237 ERROR : TransactionRequiredException: no transaction is in progre... | I agree with Michael Minella: Spring batch job repository does not like to share its transaction manager with others. The logic is simple, if you share your job transaction manager with your step transaction manager upon step failure it will rollback both the step and the data written to the job repository. This means ... |
5591491 | Conditional statements in batch files | 10 | 2011-04-08 06:52:18 | <p>Is it possible to have conditional statements in batch scripts?</p>
<p>For example:</p>
<p>I have two servers, S1 and S2.When the batch file is deployed in S1 then the output should be generated in location L1. Likewise if the batch file is deployed in S2 then output should be generated in location L2.</p>
<p>My ... | 23,666 | 685,618 | 2011-04-08 07:34:52 | 5,591,933 | 18 | 2011-04-08 07:34:52 | 463,115 | 2011-04-08 07:34:52 | https://stackoverflow.com/q/5591491 | https://stackoverflow.com/a/5591933 | <p>You compare the string ComputerName against S1 with the wrong if-else syntax</p>
<p>This should work</p>
<pre><code>if "%ComputerName%"=="S1" (
Set "SharedPath=//blah/blah"
) else (
Set "sharedPath=//some/path"
)
</code></pre>
| <p>You compare the string ComputerName against S1 with the wrong if-else syntax</p> <p>This should work</p> <pre><code>if "%ComputerName%"=="S1" ( Set "SharedPath=//blah/blah" ) else ( Set "sharedPath=//some/path" ) </code></pre> | 7002 | batch-file | <h1>Conditional statements in batch files</h1>
<p>Is it possible to have conditional statements in batch scripts?</p>
<p>For example:</p>
<p>I have two servers, S1 and S2.When the batch file is deployed in S1 then the output should be generated in location L1. Likewise if the batch file is deployed in S2 then output ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,044 | cmd | # Conditional statements in batch files
Is it possible to have conditional statements in batch scripts?
For example:
I have two servers, S1 and S2.When the batch file is deployed in S1 then the output should be generated in location L1. Likewise if the batch file is deployed in S2 then output should be generated in ... | You compare the string ComputerName against S1 with the wrong if-else syntax
This should work
```
if "%ComputerName%"=="S1" (
Set "SharedPath=//blah/blah"
) else (
Set "sharedPath=//some/path"
)
``` |
50927132 | Show balloon notifications from batch file | 9 | 2018-06-19 11:18:28 | <p>I would like to show balloon notifications from batches that run during long time.</p>
<p>I know <a href="https://stackoverflow.com/q/774175/6456701">you can show popups</a> (and some solutions are very imaginative), but it would be interesting to have this option too.</p>
<p>Is there a way you can show a balloon ... | 19,118 | 6,456,701 | 2022-05-31 11:31:39 | 51,079,409 | 18 | 2018-06-28 09:33:21 | 6,456,701 | 2018-06-28 09:47:27 | https://stackoverflow.com/q/50927132 | https://stackoverflow.com/a/51079409 | <h2>Using a PowerShell one-liner</h2>
<p>No need to create a file, it works no matter what execution policy is. Thanks to <strong>Mark Dodsons</strong> that <a href="https://stackoverflow.com/a/50970042/6456701">showed us the way</a> to do this with PS and to <strong>npocmaka</strong> for the icons list.</p>
<p>Save ... | <h2>Using a PowerShell one-liner</h2> <p>No need to create a file, it works no matter what execution policy is. Thanks to <strong>Mark Dodsons</strong> that <a href="https://stackoverflow.com/a/50970042/6456701">showed us the way</a> to do this with PS and to <strong>npocmaka</strong> for the icons list.</p> <p>Save ... | 64, 2631, 7002, 21355 | batch-file, cmd, popup-balloons, windows | <h1>Show balloon notifications from batch file</h1>
<p>I would like to show balloon notifications from batches that run during long time.</p>
<p>I know <a href="https://stackoverflow.com/q/774175/6456701">you can show popups</a> (and some solutions are very imaginative), but it would be interesting to have this option... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,045 | cmd | # Show balloon notifications from batch file
I would like to show balloon notifications from batches that run during long time.
I know [you can show popups](https://stackoverflow.com/q/774175/6456701) (and some solutions are very imaginative), but it would be interesting to have this option too.
Is there a way you c... | ## Using a PowerShell one-liner
No need to create a file, it works no matter what execution policy is. Thanks to **Mark Dodsons** that [showed us the way](https://stackoverflow.com/a/50970042/6456701) to do this with PS and to **npocmaka** for the icons list.
Save as, for example, `balloon.bat` (of course, you can in... |
33719747 | FlatFileParseException Parsing error - Spring Batch | 9 | 2015-11-15 12:38:41 | <p>I follow this <a href="https://spring.io/guides/gs/batch-processing/" rel="noreferrer">tutorial</a> and I'm getting <code>FlatFileParseException</code> error:</p>
<blockquote>
<p>org.springframework.batch.item.file.FlatFileParseException: Parsing
error at line: 1 in resource=[class path resource [country.csv]],... | 21,572 | 1,780,541 | 2023-02-09 02:28:19 | 33,722,146 | 18 | 2015-11-15 16:42:35 | 1,743,880 | 2015-11-15 16:42:35 | https://stackoverflow.com/q/33719747 | https://stackoverflow.com/a/33722146 | <p>The problem here is that you are missing a default no-arg constructor in your <code>Country</code> class.</p>
<p>You are using <a href="http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.html" rel="noreferrer"><code>BeanWrapperFieldSetMapper</code></a> t... | <p>The problem here is that you are missing a default no-arg constructor in your <code>Country</code> class.</p> <p>You are using <a href="http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.html" rel="noreferrer"><code>BeanWrapperFieldSetMapper</code></a> t... | 17, 1211, 41895, 95875 | java, spring, spring-batch, spring-boot | <h1>FlatFileParseException Parsing error - Spring Batch</h1>
<p>I follow this <a href="https://spring.io/guides/gs/batch-processing/" rel="noreferrer">tutorial</a> and I'm getting <code>FlatFileParseException</code> error:</p>
<blockquote>
<p>org.springframework.batch.item.file.FlatFileParseException: Parsing
erro... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,046 | cmd | # FlatFileParseException Parsing error - Spring Batch
I follow this [tutorial](https://spring.io/guides/gs/batch-processing/) and I'm getting `FlatFileParseException` error:
> org.springframework.batch.item.file.FlatFileParseException: Parsing
> error at line: 1 in resource=[class path resource [country.csv]],
> inpu... | The problem here is that you are missing a default no-arg constructor in your `Country` class.
You are using [`BeanWrapperFieldSetMapper`](http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/item/file/mapping/BeanWrapperFieldSetMapper.html) to map a [`FieldSet`](http://docs.spring.io/spring-batch/apid... |
31035636 | Batch - Store command output to a variable (multiple lines) | 9 | 2015-06-24 19:45:42 | <p>I know a way of doing this which is a bit like cheating but the code below creates a temporary file and then deletes it. I don't want that happen. So is there a proper or better way of doing it?</p>
<pre><code>command 2>> "temp"
set /p OUTPUT=<"temp"
del "temp"
echo %OUTPUT%
</code></pre>
<p>I know there ... | 18,857 | 2,999,851 | 2021-08-19 06:49:00 | 31,046,373 | 18 | 2015-06-25 09:30:17 | 463,115 | 2021-08-19 06:49:00 | https://stackoverflow.com/q/31035636 | https://stackoverflow.com/a/31046373 | <p>You can put it into a single variable with including linefeeds.</p>
<pre><code>setlocal EnableDelayedExpansion
set LF=^
REM The two empty lines are required here
set "output="
for /F "delims=" %%f in ('dir /b') do (
if defined output set "output=!output!!LF!"
set "output=... | <p>You can put it into a single variable with including linefeeds.</p> <pre><code>setlocal EnableDelayedExpansion set LF=^ REM The two empty lines are required here set "output=" for /F "delims=" %%f in ('dir /b') do ( if defined output set "output=!output!!LF!" set "output=... | 64, 1796, 7002 | batch-file, command, windows | <h1>Batch - Store command output to a variable (multiple lines)</h1>
<p>I know a way of doing this which is a bit like cheating but the code below creates a temporary file and then deletes it. I don't want that happen. So is there a proper or better way of doing it?</p>
<pre><code>command 2>> "temp"
set /p OUTPU... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,047 | cmd | # Batch - Store command output to a variable (multiple lines)
I know a way of doing this which is a bit like cheating but the code below creates a temporary file and then deletes it. I don't want that happen. So is there a proper or better way of doing it?
```
command 2>> "temp"
set /p OUTPUT=<"temp"
del "temp"
echo ... | You can put it into a single variable with including linefeeds.
```
setlocal EnableDelayedExpansion
set LF=^
REM The two empty lines are required here
set "output="
for /F "delims=" %%f in ('dir /b') do (
if defined output set "output=!output!!LF!"
set "output=!output!%%f"
)
echo !output!
```
But it can be ... |
11729562 | Disable 'pause' in windows bat script | 9 | 2012-07-30 21:04:55 | <p>In windows, I am running a bat script that currently ends with a 'pause' and prompts for the user to 'Press any key to continue...'</p>
<p>I am unable to edit the file in this scenario and I need the script to terminate instead of hang waiting for input that will never come. Is there a way I can run this that will ... | 8,839 | 505,912 | 2019-01-25 09:51:49 | 11,729,668 | 18 | 2012-07-30 21:13:07 | 1,405,560 | 2012-07-30 21:13:07 | https://stackoverflow.com/q/11729562 | https://stackoverflow.com/a/11729668 | <p>Try to execute <code>cmd.exe /c YourCmdFile < nul</code></p>
<p><code>YourCmdFile</code> - full path to your batch script</p>
| <p>Try to execute <code>cmd.exe /c YourCmdFile < nul</code></p> <p><code>YourCmdFile</code> - full path to your batch script</p> | 16, 64, 2631, 7002 | batch-file, cmd, python, windows | <h1>Disable 'pause' in windows bat script</h1>
<p>In windows, I am running a bat script that currently ends with a 'pause' and prompts for the user to 'Press any key to continue...'</p>
<p>I am unable to edit the file in this scenario and I need the script to terminate instead of hang waiting for input that will never... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,048 | cmd | # Disable 'pause' in windows bat script
In windows, I am running a bat script that currently ends with a 'pause' and prompts for the user to 'Press any key to continue...'
I am unable to edit the file in this scenario and I need the script to terminate instead of hang waiting for input that will never come. Is there ... | Try to execute `cmd.exe /c YourCmdFile < nul`
`YourCmdFile` - full path to your batch script |
4808169 | R command line passing a filename to script in arguments (Windows) | 9 | 2011-01-26 18:09:13 | <p>I'm having a hard time passing a filename to my R script. The file is a csv file with the batch parameters for multiple runs of the script. I am trying to include it here so that the user does not need to edit the R script in order to specify the location of that file.</p>
<p>My Windows command line syntax is:</p>
... | 24,468 | 483,620 | 2013-01-07 19:06:13 | 4,808,574 | 18 | 2011-01-26 18:44:57 | 271,616 | 2011-01-26 18:44:57 | https://stackoverflow.com/q/4808169 | https://stackoverflow.com/a/4808574 | <p>As I said in my comment, I would use <code>Rscript</code> instead of <code>R CMD BATCH</code>:</p>
<pre><code>Rscript myscript.R batch.csv
</code></pre>
<p>where myscript.R contains:</p>
<pre><code>args <- commandArgs(TRUE)
batch_args <- read.table(args[1], sep=",")
# loop over multiple runs
</code></pre>
| <p>As I said in my comment, I would use <code>Rscript</code> instead of <code>R CMD BATCH</code>:</p> <pre><code>Rscript myscript.R batch.csv </code></pre> <p>where myscript.R contains:</p> <pre><code>args <- commandArgs(TRUE) batch_args <- read.table(args[1], sep=",") # loop over multiple runs </code></pre> | 1231, 2313, 4452, 7002 | arguments, batch-file, command-line, r | <h1>R command line passing a filename to script in arguments (Windows)</h1>
<p>I'm having a hard time passing a filename to my R script. The file is a csv file with the batch parameters for multiple runs of the script. I am trying to include it here so that the user does not need to edit the R script in order to specif... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,049 | cmd | # R command line passing a filename to script in arguments (Windows)
I'm having a hard time passing a filename to my R script. The file is a csv file with the batch parameters for multiple runs of the script. I am trying to include it here so that the user does not need to edit the R script in order to specify the loc... | As I said in my comment, I would use `Rscript` instead of `R CMD BATCH`:
```
Rscript myscript.R batch.csv
```
where myscript.R contains:
```
args <- commandArgs(TRUE)
batch_args <- read.table(args[1], sep=",")
# loop over multiple runs
``` |
1522725 | CMD Script: How to close the CMD | 9 | 2009-10-05 22:26:16 | <p>I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code:</p>
<pre><code>"%ProgramFiles%\Internet
Explorer\iexplore.exe"
http://localhost/test.html
PAUSE
</code></pre>
<p>I ... | 77,436 | 51,649 | 2022-12-25 01:23:55 | 1,522,757 | 18 | 2009-10-05 22:35:06 | 40,347 | 2009-10-05 22:35:06 | https://stackoverflow.com/q/1522725 | https://stackoverflow.com/a/1522757 | <p>Use the <code>start</code> command:</p>
<pre><code>start "title" "%ProgramFiles%\Internet Explorer\iexplore.exe" http://www.example.com
</code></pre>
| <p>Use the <code>start</code> command:</p> <pre><code>start "title" "%ProgramFiles%\Internet Explorer\iexplore.exe" http://www.example.com </code></pre> | 64, 531, 1231, 2631 | cmd, command-line, scripting, windows | <h1>CMD Script: How to close the CMD</h1>
<p>I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code:</p>
<pre><code>"%ProgramFiles%\Internet
Explorer\iexplore.exe"
http://loca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,050 | cmd | # CMD Script: How to close the CMD
I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code:
```
"%ProgramFiles%\Internet
Explorer\iexplore.exe"
http://localhost/test.html
PAUS... | Use the `start` command:
```
start "title" "%ProgramFiles%\Internet Explorer\iexplore.exe" http://www.example.com
``` |
934030 | How to to terminate a Windows batch file from within a 'call'ed routine? | 9 | 2009-06-01 08:48:59 | <p>I've got a windows batch file, with a few sub-routines in it something like this:</p>
<pre><code>call :a
goto :eof
:a
call :b
goto :eof
:b
:: How do I directly exit here from here?
goto :eof
</code></pre>
<p>I'm running this in a cmd window on Vista.<br>
If I detect an error somewhere in the batch file, I want i... | 11,183 | 11,898 | 2025-08-06 08:37:22 | 934,114 | 18 | 2009-06-01 09:25:09 | 73,070 | 2009-06-01 10:09:45 | https://stackoverflow.com/q/934030 | https://stackoverflow.com/a/934114 | <p>You can call your subroutines like so:</p>
<pre><code>call :b||exit /b 1
</code></pre>
<p>which is equivalent to</p>
<pre><code>call :b
if errorlevel 1 exit /b 1
</code></pre>
<p>It's slightly shorter and saves you one line, but it's still not ideal, I agree.</p>
<p>Other than that I don't see a way.</p>
<p><s... | <p>You can call your subroutines like so:</p> <pre><code>call :b||exit /b 1 </code></pre> <p>which is equivalent to</p> <pre><code>call :b if errorlevel 1 exit /b 1 </code></pre> <p>It's slightly shorter and saves you one line, but it's still not ideal, I agree.</p> <p>Other than that I don't see a way.</p> <p><s... | 64, 7002 | batch-file, windows | <h1>How to to terminate a Windows batch file from within a 'call'ed routine?</h1>
<p>I've got a windows batch file, with a few sub-routines in it something like this:</p>
<pre><code>call :a
goto :eof
:a
call :b
goto :eof
:b
:: How do I directly exit here from here?
goto :eof
</code></pre>
<p>I'm running this in a c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,051 | cmd | # How to to terminate a Windows batch file from within a 'call'ed routine?
I've got a windows batch file, with a few sub-routines in it something like this:
```
call :a
goto :eof
:a
call :b
goto :eof
:b
:: How do I directly exit here from here?
goto :eof
```
I'm running this in a cmd window on Vista.
If I detect... | You can call your subroutines like so:
```
call :b||exit /b 1
```
which is equivalent to
```
call :b
if errorlevel 1 exit /b 1
```
It's slightly shorter and saves you one line, but it's still not ideal, I agree.
Other than that I don't see a way.
**EDIT:** Ok, I got a way, but it's Pure Evil™.
Misusing the maxim... |
19206183 | Windows batch files: how to compare command line argument to an integer | 8 | 2013-10-06 06:43:53 | <p>I am only very new to batch file programming and I have tried to find the solution online, but failed.
My batch file calls a c program passing it's own command line arguments to the program then does subsequent steps which depend on the value of the fourth argument (which is an integer).
I would like to do an extra ... | 10,095 | 2,851,154 | 2013-10-06 07:10:36 | 19,206,258 | 18 | 2013-10-06 06:58:01 | 1,335,032 | 2013-10-06 06:58:01 | https://stackoverflow.com/q/19206183 | https://stackoverflow.com/a/19206258 | <p>Change line:</p>
<pre><code>If ("%4"== "3") (echo testyes) Else (echo testno)
</code></pre>
<p>to:</p>
<pre><code>If "%4"=="3" (echo testyes) Else (echo testno)
</code></pre>
| <p>Change line:</p> <pre><code>If ("%4"== "3") (echo testyes) Else (echo testno) </code></pre> <p>to:</p> <pre><code>If "%4"=="3" (echo testyes) Else (echo testno) </code></pre> | 64, 2054, 2773, 7002, 31134 | batch-file, command-line-arguments, if-statement, integer, windows | <h1>Windows batch files: how to compare command line argument to an integer</h1>
<p>I am only very new to batch file programming and I have tried to find the solution online, but failed.
My batch file calls a c program passing it's own command line arguments to the program then does subsequent steps which depend on the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,052 | cmd | # Windows batch files: how to compare command line argument to an integer
I am only very new to batch file programming and I have tried to find the solution online, but failed.
My batch file calls a c program passing it's own command line arguments to the program then does subsequent steps which depend on the value of... | Change line:
```
If ("%4"== "3") (echo testyes) Else (echo testno)
```
to:
```
If "%4"=="3" (echo testyes) Else (echo testno)
``` |
17674255 | Why does windows START command not work with spaces in arguments AND path? | 8 | 2013-07-16 10:33:42 | <p>This command works</p>
<pre><code>START /b /wait "Dummy title" "C:\tmp\test runner2.bat" arg1 arg2
</code></pre>
<p>But both of these fails!</p>
<pre><code>START /b /wait "Dummy title" "C:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4
START /b /wait "Dummy title" "C:\tmp\test runner2.bat" arg1 arg2 "arg 3"
</code>... | 20,778 | 1,098,332 | 2017-05-12 08:26:53 | 17,682,046 | 18 | 2013-07-16 16:27:48 | 463,115 | 2016-01-11 14:33:31 | https://stackoverflow.com/q/17674255 | https://stackoverflow.com/a/17682046 | <p>It's a <em>known</em> bug of the START command.<br>
If you have spaces in both, the command and of the parameters and try to handle them with quotes, it fails. </p>
<p>First the START command check if the full command exists.<br>
But then it starts only the first part. </p>
<p>In your case it looks for <code>"C:... | <p>It's a <em>known</em> bug of the START command.<br> If you have spaces in both, the command and of the parameters and try to handle them with quotes, it fails. </p> <p>First the START command check if the full command exists.<br> But then it starts only the first part. </p> <p>In your case it looks for <code>"C:... | 64, 7002, 31134 | batch-file, command-line-arguments, windows | <h1>Why does windows START command not work with spaces in arguments AND path?</h1>
<p>This command works</p>
<pre><code>START /b /wait "Dummy title" "C:\tmp\test runner2.bat" arg1 arg2
</code></pre>
<p>But both of these fails!</p>
<pre><code>START /b /wait "Dummy title" "C:\tmp\test runner2.bat" arg1 arg2 "arg 3" a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,053 | cmd | # Why does windows START command not work with spaces in arguments AND path?
This command works
```
START /b /wait "Dummy title" "C:\tmp\test runner2.bat" arg1 arg2
```
But both of these fails!
```
START /b /wait "Dummy title" "C:\tmp\test runner2.bat" arg1 arg2 "arg 3" arg4
START /b /wait "Dummy title" "C:\tmp\tes... | It's a *known* bug of the START command.
If you have spaces in both, the command and of the parameters and try to handle them with quotes, it fails.
First the START command check if the full command exists.
But then it starts only the first part.
In your case it looks for `"C:\tmp\test runner2.bat"` but try to st... |
16619080 | Can't get the http response using telnet from the command line | 8 | 2013-05-17 23:06:45 | <p>I'm using Windows 7 (x64). I want to send an http request from a command line and to get a response. I use Telnet. I type in the command line: <code>telnet www.google.com 80</code>.
<img src="https://i.sstatic.net/l8Enj.png" alt="enter image description here">
After I press "enter" the screen becomes black (everyth... | 25,499 | 1,460,819 | 2013-05-17 23:36:23 | 16,619,172 | 18 | 2013-05-17 23:18:55 | 1,630,171 | 2013-05-17 23:36:23 | https://stackoverflow.com/q/16619080 | https://stackoverflow.com/a/16619172 | <p>The connection is established and waiting for you to enter a command. Type <code>GET / HTTP/1.0</code> and press <kbd>Enter</kbd> twice. The command is case-sensitive. It's not displayed as you type, because localecho is off by default. You can enable localecho like this:</p>
<pre><code>C:\><b>telnet</b>
Welcome to ... | <p>The connection is established and waiting for you to enter a command. Type <code>GET / HTTP/1.0</code> and press <kbd>Enter</kbd> twice. The command is case-sensitive. It's not displayed as you type, because localecho is off by default. You can enable localecho like this:</p> <pre><code>C:\><b>telnet</b> Welcome to ... | 1231, 2631, 6056, 34595 | cmd, command-line, telnet, windows-7 | <h1>Can't get the http response using telnet from the command line</h1>
<p>I'm using Windows 7 (x64). I want to send an http request from a command line and to get a response. I use Telnet. I type in the command line: <code>telnet www.google.com 80</code>.
<img src="https://i.sstatic.net/l8Enj.png" alt="enter image de... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,054 | cmd | # Can't get the http response using telnet from the command line
I'm using Windows 7 (x64). I want to send an http request from a command line and to get a response. I use Telnet. I type in the command line: `telnet www.google.com 80`.

After I press "ent... | The connection is established and waiting for you to enter a command. Type `GET / HTTP/1.0` and press `Enter` twice. The command is case-sensitive. It's not displayed as you type, because localecho is off by default. You can enable localecho like this:
```
C:\>telnet
Welcome to Microsoft Telnet Client
Escape Characte... |
9836796 | How to run a batch file keeping the console window hidden? | 8 | 2012-03-23 09:33:02 | <p>I want to start my successfully installed Java program after the installation finished. I know how to do it in principle:</p>
<pre><code>[Run]
FileName: "{app}\LaunchApp.bat"; Description: {cm:LaunchApp}; Flags: nowait postinstall skipifsilent
</code></pre>
<p>LaunchApp.bat:</p>
<pre><code>start javaw -jar MyJar... | 8,243 | 408,351 | 2013-01-29 00:49:06 | 9,837,406 | 18 | 2012-03-23 10:14:12 | 960,757 | 2013-01-29 00:45:37 | https://stackoverflow.com/q/9836796 | https://stackoverflow.com/a/9837406 | <p>Try to add the <a href="http://www.jrsoftware.org/ishelp/topic_runsection.htm#runhidden"><code>runhidden</code></a> flag. From the reference:</p>
<blockquote>
<p>If this flag is specified, it will launch the program in a hidden
window. Never use this flag when executing a program that may prompt
for user inpu... | <p>Try to add the <a href="http://www.jrsoftware.org/ishelp/topic_runsection.htm#runhidden"><code>runhidden</code></a> flag. From the reference:</p> <blockquote> <p>If this flag is specified, it will launch the program in a hidden window. Never use this flag when executing a program that may prompt for user inpu... | 3942, 7002 | batch-file, inno-setup | <h1>How to run a batch file keeping the console window hidden?</h1>
<p>I want to start my successfully installed Java program after the installation finished. I know how to do it in principle:</p>
<pre><code>[Run]
FileName: "{app}\LaunchApp.bat"; Description: {cm:LaunchApp}; Flags: nowait postinstall skipifsilent
</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,055 | cmd | # How to run a batch file keeping the console window hidden?
I want to start my successfully installed Java program after the installation finished. I know how to do it in principle:
```
[Run]
FileName: "{app}\LaunchApp.bat"; Description: {cm:LaunchApp}; Flags: nowait postinstall skipifsilent
```
LaunchApp.bat:
```... | Try to add the [`runhidden`](http://www.jrsoftware.org/ishelp/topic_runsection.htm#runhidden) flag. From the reference:
> If this flag is specified, it will launch the program in a hidden
> window. Never use this flag when executing a program that may prompt
> for user input.
So this should resolve your question:
``... |
8749491 | unlock protected pdf files | 8 | 2012-01-05 20:41:49 | <p>I need to process a large number of protected pdf files and edit them using a java program, but i don't have the passwords for these files.
Is there any way to unlock this files with a batch?</p>
<p>I would like a windows command like tool or a java open source api.
What is the best solution ? </p>
| 23,134 | 1,133,021 | 2016-02-16 18:02:03 | 8,752,075 | 18 | 2012-01-06 00:54:19 | 997,853 | 2012-01-06 00:54:19 | https://stackoverflow.com/q/8749491 | https://stackoverflow.com/a/8752075 | <p>are these pdf files asking for passwords to be opened, or <strong>protection</strong> consist in restrictions about copy, printing, modify, text extraction and so on?</p>
<p>if this is your case, you can try with </p>
<p><em>qpdf</em></p>
<ul>
<li><a href="http://qpdf.sourceforge.net/" rel="noreferrer">http://qpd... | <p>are these pdf files asking for passwords to be opened, or <strong>protection</strong> consist in restrictions about copy, printing, modify, text extraction and so on?</p> <p>if this is your case, you can try with </p> <p><em>qpdf</em></p> <ul> <li><a href="http://qpdf.sourceforge.net/" rel="noreferrer">http://qpd... | 17, 90, 7002 | batch-file, java, pdf | <h1>unlock protected pdf files</h1>
<p>I need to process a large number of protected pdf files and edit them using a java program, but i don't have the passwords for these files.
Is there any way to unlock this files with a batch?</p>
<p>I would like a windows command like tool or a java open source api.
What is the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,056 | cmd | # unlock protected pdf files
I need to process a large number of protected pdf files and edit them using a java program, but i don't have the passwords for these files.
Is there any way to unlock this files with a batch?
I would like a windows command like tool or a java open source api.
What is the best solution ? | are these pdf files asking for passwords to be opened, or **protection** consist in restrictions about copy, printing, modify, text extraction and so on?
if this is your case, you can try with
*qpdf*
- <http://qpdf.sourceforge.net/>
usage:
```
qpdf --decrypt file.pdf unlocked.pdf
```
and can be used in a batch op... |
6147613 | Creating a batch file, for simple javac and java command execution | 8 | 2011-05-27 03:40:03 | <p>It is a really simple thing but I cannot get my head around it. I have looked at plenty of StackOverFlow post and as well as on internet.</p>
<p>My goal is to create a .bat which will open cmd and execute my Main.java into command prompt. Easy isn't it, but I have got confused about how? </p>
<p>Below I am writin... | 125,746 | 753,603 | 2017-09-11 06:45:50 | 6,147,686 | 18 | 2011-05-27 03:54:19 | 560,934 | 2015-12-08 11:10:41 | https://stackoverflow.com/q/6147613 | https://stackoverflow.com/a/6147686 | <ol>
<li><p>open notepad </p></li>
<li><p>write</p>
<pre><code>@echo off
javac Main.java
java Main
</code></pre></li>
</ol>
<p>3.saveAs blahblah.bat</p>
<p>make sure that Main.java resides with your batch file and java path is set in env. variable </p>
<p>4 . double click on batch file, no need to open cmd explic... | <ol> <li><p>open notepad </p></li> <li><p>write</p> <pre><code>@echo off javac Main.java java Main </code></pre></li> </ol> <p>3.saveAs blahblah.bat</p> <p>make sure that Main.java resides with your batch file and java path is set in env. variable </p> <p>4 . double click on batch file, no need to open cmd explic... | 17, 1135, 2631, 7002, 7427 | batch-file, cmd, executable, java, javac | <h1>Creating a batch file, for simple javac and java command execution</h1>
<p>It is a really simple thing but I cannot get my head around it. I have looked at plenty of StackOverFlow post and as well as on internet.</p>
<p>My goal is to create a .bat which will open cmd and execute my Main.java into command prompt. ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,057 | cmd | # Creating a batch file, for simple javac and java command execution
It is a really simple thing but I cannot get my head around it. I have looked at plenty of StackOverFlow post and as well as on internet.
My goal is to create a .bat which will open cmd and execute my Main.java into command prompt. Easy isn't it, bu... | 1. open notepad
2. write
```
@echo off
javac Main.java
java Main
```
3.saveAs blahblah.bat
make sure that Main.java resides with your batch file and java path is set in env. variable
4 . double click on batch file, no need to open cmd explicitly tt will open itself on .bat execution |
22680648 | Can we write a Spring Batch Job Without ItemReader and ItemWriter | 7 | 2014-03-27 07:13:41 | <p>In my project, I have written a Quartz scheduler with Spring Batch 2.2.</p>
<p>As per my requirement, I want to run a scheduler to fetch application config property to refresh the configuration cache on all the GlassFish Clusters.</p>
<p>So I dont need ItemWriter and ItemReader which are used to for File Read/Writ... | 20,558 | 546,888 | 2014-03-27 07:30:42 | 22,680,927 | 18 | 2014-03-27 07:30:42 | 2,587,166 | 2014-03-27 07:30:42 | https://stackoverflow.com/q/22680648 | https://stackoverflow.com/a/22680927 | <p>Use a <a href="http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/step/tasklet/Tasklet.html">Tasklet</a></p>
<pre><code><job id="reportJob">
<step id="step1">
<tasklet ref="MyTaskletBean" />
</step>
<!-- Other config... -->
</job>
class MyTask... | <p>Use a <a href="http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/step/tasklet/Tasklet.html">Tasklet</a></p> <pre><code><job id="reportJob"> <step id="step1"> <tasklet ref="MyTaskletBean" /> </step> <!-- Other config... --> </job> class MyTask... | 1211, 41895 | spring, spring-batch | <h1>Can we write a Spring Batch Job Without ItemReader and ItemWriter</h1>
<p>In my project, I have written a Quartz scheduler with Spring Batch 2.2.</p>
<p>As per my requirement, I want to run a scheduler to fetch application config property to refresh the configuration cache on all the GlassFish Clusters.</p>
<p>So... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,058 | cmd | # Can we write a Spring Batch Job Without ItemReader and ItemWriter
In my project, I have written a Quartz scheduler with Spring Batch 2.2.
As per my requirement, I want to run a scheduler to fetch application config property to refresh the configuration cache on all the GlassFish Clusters.
So I dont need ItemWriter... | Use a [Tasklet](http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/step/tasklet/Tasklet.html)
```
<job id="reportJob">
<step id="step1">
<tasklet ref="MyTaskletBean" />
</step>
<!-- Other config... -->
</job>
class MyTasklet implements Tasklet {
@Override
public RepeatStatus ex... |
13504564 | JDBC Batch executing extremely slow | 7 | 2012-11-22 01:11:05 | <p>Can anyone tell me what I'm doing wrong I'm executing 350 inserts in a mysql and it's taking like 40 secs.</p>
<p>Here is the code</p>
<pre><code>long t0 = System.currentTimeMillis();
Connection con = connectionProvider.getConnection();
PreparedStatement s = con.prepareStatement("insert into domkee... | 5,359 | 718,333 | 2017-10-27 11:47:48 | 13,504,946 | 18 | 2012-11-22 02:08:15 | 982,341 | 2017-10-27 11:47:48 | https://stackoverflow.com/q/13504564 | https://stackoverflow.com/a/13504946 | <p>Add <code>?rewriteBatchedStatements=true</code> to the end of your JDBC url. It'll give you a serious performance improvement. Note that this is specific to MySql, won't have any effect with any other JDBC drivers.</p>
| <p>Add <code>?rewriteBatchedStatements=true</code> to the end of your JDBC url. It'll give you a serious performance improvement. Note that this is specific to MySql, won't have any effect with any other JDBC drivers.</p> | 17, 21, 5617, 58566 | batch-insert, java, jdbc, mysql | <h1>JDBC Batch executing extremely slow</h1>
<p>Can anyone tell me what I'm doing wrong I'm executing 350 inserts in a mysql and it's taking like 40 secs.</p>
<p>Here is the code</p>
<pre><code>long t0 = System.currentTimeMillis();
Connection con = connectionProvider.getConnection();
PreparedStatement... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,059 | cmd | # JDBC Batch executing extremely slow
Can anyone tell me what I'm doing wrong I'm executing 350 inserts in a mysql and it's taking like 40 secs.
Here is the code
```
long t0 = System.currentTimeMillis();
Connection con = connectionProvider.getConnection();
PreparedStatement s = con.prepareStatement("... | Add `?rewriteBatchedStatements=true` to the end of your JDBC url. It'll give you a serious performance improvement. Note that this is specific to MySql, won't have any effect with any other JDBC drivers. |
5594121 | Batch script date into variable | 6 | 2011-04-08 11:00:47 | <pre><code>for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
set Day=%%k
set Month=%%j
set Year=%%l
set DATE=%%k/%%j/%%l)
</code></pre>
<p>I am try to get the date into the above variables in a batch script, but currently the date comes out as </p>
<pre><code>2011/04/
</code></pre>
<p>Any suggestions on how to f... | 43,081 | 368,186 | 2020-05-07 00:27:27 | 5,594,319 | 18 | 2011-04-08 11:22:38 | 30,447 | 2012-04-18 08:51:40 | https://stackoverflow.com/q/5594121 | https://stackoverflow.com/a/5594319 | <p>You don't get what you expected because <code>%DATE%</code> returns the current date using the windows settings for the "short date format". This setting is fully (endlessly) customizable. </p>
<p>One user may configure its system to show the short date as Fri040811; while another user (even in the same system) may... | <p>You don't get what you expected because <code>%DATE%</code> returns the current date using the windows settings for the "short date format". This setting is fully (endlessly) customizable. </p> <p>One user may configure its system to show the short date as Fri040811; while another user (even in the same system) may... | 276, 7002 | batch-file, variables | <h1>Batch script date into variable</h1>
<pre><code>for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
set Day=%%k
set Month=%%j
set Year=%%l
set DATE=%%k/%%j/%%l)
</code></pre>
<p>I am try to get the date into the above variables in a batch script, but currently the date comes out as </p>
<pre><code>2011/04/
</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,060 | cmd | # Batch script date into variable
```
for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
set Day=%%k
set Month=%%j
set Year=%%l
set DATE=%%k/%%j/%%l)
```
I am try to get the date into the above variables in a batch script, but currently the date comes out as
```
2011/04/
```
Any suggestions on how to fix this? | You don't get what you expected because `%DATE%` returns the current date using the windows settings for the "short date format". This setting is fully (endlessly) customizable.
One user may configure its system to show the short date as Fri040811; while another user (even in the same system) may choose 08/04/2011. It... |
17404165 | How to run a command on command prompt startup in Windows | 69 | 2013-07-01 12:08:50 | <blockquote>
<p><strong>EDIT</strong></p>
<p>If you want to perform any task at computer startup or based on an
event this is very helpful</p>
<p><a href="http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/how-to-schedule-computer-to-shut-down-at-a-certain/800ed207-f630-480d-8c92-dff23... | 146,255 | 840,669 | 2025-05-02 09:19:10 | 17,404,355 | 17 | 2013-07-01 12:19:14 | 840,669 | 2020-01-23 16:32:47 | https://stackoverflow.com/q/17404165 | https://stackoverflow.com/a/17404355 | <p>I found my answer: I should use the <code>/K</code> switch, using which I can enter a new command on the opened command prompt.</p>
<p>E.g. <code>cmd /K cls</code> will open a command prompt for me and clear it. (Answer for question 1)</p>
<p>and </p>
<p><code>cmd /K MyBatchFile.bat</code> will start a command pr... | <p>I found my answer: I should use the <code>/K</code> switch, using which I can enter a new command on the opened command prompt.</p> <p>E.g. <code>cmd /K cls</code> will open a command prompt for me and clear it. (Answer for question 1)</p> <p>and </p> <p><code>cmd /K MyBatchFile.bat</code> will start a command pr... | 64, 1796, 2631, 9938 | cmd, command, command-prompt, windows | <h1>How to run a command on command prompt startup in Windows</h1>
<blockquote>
<p><strong>EDIT</strong></p>
<p>If you want to perform any task at computer startup or based on an
event this is very helpful</p>
<p><a href="http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/how-to-schedu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,061 | cmd | # How to run a command on command prompt startup in Windows
> **EDIT**
>
> If you want to perform any task at computer startup or based on an
> event this is very helpful
>
> <http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/how-to-schedule-computer-to-shut-down-at-a-certain/800ed207-f630-480d-8c... | I found my answer: I should use the `/K` switch, using which I can enter a new command on the opened command prompt.
E.g. `cmd /K cls` will open a command prompt for me and clear it. (Answer for question 1)
and
`cmd /K MyBatchFile.bat` will start a command prompt, execute the batch file and stay on the command promp... |
5859854 | Detect if bat file is running via double click or from cmd window | 42 | 2011-05-02 16:44:27 | <p>I have a bat file that does a bunch of things and closes the cmd window which is fine when user double clicks the bat file from explorer. But if I run the bat file from a already open cmd window as in cmd>c:\myfile.bat then I do not want the bat file to close the cmd window (END) since I need to do other things. I n... | 14,879 | 666,490 | 2025-06-11 06:53:17 | 5,860,983 | 17 | 2011-05-02 18:37:25 | 653,295 | 2011-05-02 19:17:18 | https://stackoverflow.com/q/5859854 | https://stackoverflow.com/a/5860983 | <p><code>%cmdcmdline%</code> gives the exact command line used to start the current Cmd.exe. </p>
<ul>
<li>When launched from a command console, this var is <code>"%SystemRoot%\system32\cmd.exe"</code>.</li>
<li>When launched from explorer this var is <code>cmd /c ""{full_path_to_the_bat_file}" "</code>;<br>
this impl... | <p><code>%cmdcmdline%</code> gives the exact command line used to start the current Cmd.exe. </p> <ul> <li>When launched from a command console, this var is <code>"%SystemRoot%\system32\cmd.exe"</code>.</li> <li>When launched from explorer this var is <code>cmd /c ""{full_path_to_the_bat_file}" "</code>;<br> this impl... | 64, 2631 | cmd, windows | <h1>Detect if bat file is running via double click or from cmd window</h1>
<p>I have a bat file that does a bunch of things and closes the cmd window which is fine when user double clicks the bat file from explorer. But if I run the bat file from a already open cmd window as in cmd>c:\myfile.bat then I do not want the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,062 | cmd | # Detect if bat file is running via double click or from cmd window
I have a bat file that does a bunch of things and closes the cmd window which is fine when user double clicks the bat file from explorer. But if I run the bat file from a already open cmd window as in cmd>c:\myfile.bat then I do not want the bat file ... | `%cmdcmdline%` gives the exact command line used to start the current Cmd.exe.
- When launched from a command console, this var is `"%SystemRoot%\system32\cmd.exe"`.
- When launched from explorer this var is `cmd /c ""{full_path_to_the_bat_file}" "`;
this implicates that you might also check the `%0` variable in y... |
134001 | How can I load the contents of a text file into a batch file variable? | 37 | 2008-09-25 15:29:36 | <p>I need to be able to load the entire contents of a text file and load it into a variable for further processing. </p>
<p>How can I do that?</p>
<hr>
<p>Here's what I did thanks to Roman Odaisky's answer.</p>
<pre><code>SetLocal EnableDelayedExpansion
set content=
for /F "delims=" %%i in (test.txt) do set conten... | 155,878 | 730 | 2021-03-19 19:53:58 | 134,135 | 17 | 2008-09-25 15:49:57 | 21,055 | 2008-09-25 15:49:57 | https://stackoverflow.com/q/134001 | https://stackoverflow.com/a/134135 | <p>Use <code>for</code>, something along the lines of:</p>
<pre><code>set content=
for /f "delims=" %%i in ('filename') do set content=%content% %%i
</code></pre>
<p>Maybe you’ll have to do <code>setlocal enabledelayedexpansion</code> and/or use <code>!content!</code> rather than <code>%content%</code>. I can’t test,... | <p>Use <code>for</code>, something along the lines of:</p> <pre><code>set content= for /f "delims=" %%i in ('filename') do set content=%content% %%i </code></pre> <p>Maybe you’ll have to do <code>setlocal enabledelayedexpansion</code> and/or use <code>!content!</code> rather than <code>%content%</code>. I can’t test,... | 64, 1231, 2631, 7002 | batch-file, cmd, command-line, windows | <h1>How can I load the contents of a text file into a batch file variable?</h1>
<p>I need to be able to load the entire contents of a text file and load it into a variable for further processing. </p>
<p>How can I do that?</p>
<hr>
<p>Here's what I did thanks to Roman Odaisky's answer.</p>
<pre><code>SetLocal Enab... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,063 | cmd | # How can I load the contents of a text file into a batch file variable?
I need to be able to load the entire contents of a text file and load it into a variable for further processing.
How can I do that?
---
Here's what I did thanks to Roman Odaisky's answer.
```
SetLocal EnableDelayedExpansion
set content=
for /... | Use `for`, something along the lines of:
```
set content=
for /f "delims=" %%i in ('filename') do set content=%content% %%i
```
Maybe you’ll have to do `setlocal enabledelayedexpansion` and/or use `!content!` rather than `%content%`. I can’t test, as I don’t have any MS Windows nearby (and I wish you the same :-).
T... |
52768937 | How to define root volume size in AWS batch | 21 | 2018-10-11 21:07:09 | <p>I'm using AWS Batch and I found the root volume size too low for my task.</p>
<p>I tried creating a new computing environment/job queue but there's not any option to set volume size. I tried changing launch configuration from <a href="https://console.aws.amazon.com/ec2/autoscaling/home?region=us-east-1#LaunchConfig... | 11,065 | 41,977 | 2021-02-17 18:59:44 | 52,915,531 | 17 | 2018-10-21 12:56:01 | 9,793,772 | 2018-10-21 16:18:39 | https://stackoverflow.com/q/52768937 | https://stackoverflow.com/a/52915531 | <p>The recommended solution is to use an unmanaged compute environment. Unfortunately this ended up being poor advice because not only is creating your own unmanaged compute environment difficult and esoteric, and not only does it kind-of defeat the entire purpose of AWS batch, but there is a much better (and much simp... | <p>The recommended solution is to use an unmanaged compute environment. Unfortunately this ended up being poor advice because not only is creating your own unmanaged compute environment difficult and esoteric, and not only does it kind-of defeat the entire purpose of AWS batch, but there is a much better (and much simp... | 314, 6906, 33388, 90304, 124227 | amazon-web-services, aws-batch, docker, size, volume | <h1>How to define root volume size in AWS batch</h1>
<p>I'm using AWS Batch and I found the root volume size too low for my task.</p>
<p>I tried creating a new computing environment/job queue but there's not any option to set volume size. I tried changing launch configuration from <a href="https://console.aws.amazon.c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,065 | cmd | # How to define root volume size in AWS batch
I'm using AWS Batch and I found the root volume size too low for my task.
I tried creating a new computing environment/job queue but there's not any option to set volume size. I tried changing launch configuration from [here](https://console.aws.amazon.com/ec2/autoscaling... | The recommended solution is to use an unmanaged compute environment. Unfortunately this ended up being poor advice because not only is creating your own unmanaged compute environment difficult and esoteric, and not only does it kind-of defeat the entire purpose of AWS batch, but there is a much better (and much simpler... |
18877212 | Trouble running a batch file with a space in the path and space in the argument | 21 | 2013-09-18 16:10:27 | <p>I am trying to run a batch file that's located in:</p>
<pre><code>C:\Test Batch\BatchTest.bat
</code></pre>
<p>That will copy a file from another specified location, let's say</p>
<pre><code>C:\Users\UserName\Desktop\Company Downloads\downloadedDoc.doc
</code></pre>
<p>I can run the batch file as:</p>
<pre><cod... | 58,243 | 953,045 | 2018-01-04 01:27:25 | 18,877,554 | 17 | 2013-09-18 16:29:35 | 2,395,088 | 2013-09-18 17:27:50 | https://stackoverflow.com/q/18877212 | https://stackoverflow.com/a/18877554 | <p>Try changing the startup directory with the /d argument to start like so:</p>
<pre><code>cmd /c start "" /d"C:\Test Batch\" "TestBatch.bat" "C:\Users\User Name\Desktop\Company Downloads\downloadedDoc.doc"
</code></pre>
<p>The start command has some oddities parsing quotes.</p>
| <p>Try changing the startup directory with the /d argument to start like so:</p> <pre><code>cmd /c start "" /d"C:\Test Batch\" "TestBatch.bat" "C:\Users\User Name\Desktop\Company Downloads\downloadedDoc.doc" </code></pre> <p>The start command has some oddities parsing quotes.</p> | 2313, 2631, 7002 | arguments, batch-file, cmd | <h1>Trouble running a batch file with a space in the path and space in the argument</h1>
<p>I am trying to run a batch file that's located in:</p>
<pre><code>C:\Test Batch\BatchTest.bat
</code></pre>
<p>That will copy a file from another specified location, let's say</p>
<pre><code>C:\Users\UserName\Desktop\Company ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,066 | cmd | # Trouble running a batch file with a space in the path and space in the argument
I am trying to run a batch file that's located in:
```
C:\Test Batch\BatchTest.bat
```
That will copy a file from another specified location, let's say
```
C:\Users\UserName\Desktop\Company Downloads\downloadedDoc.doc
```
I can run t... | Try changing the startup directory with the /d argument to start like so:
```
cmd /c start "" /d"C:\Test Batch\" "TestBatch.bat" "C:\Users\User Name\Desktop\Company Downloads\downloadedDoc.doc"
```
The start command has some oddities parsing quotes. |
8780097 | renaming files in cmd using wildcards | 20 | 2012-01-08 18:31:41 | <p>I'm writing a BAT file for renaming some files.
My files are <code>*.jpg</code> where * is the file name and I want them to be <code>*-thumb.jpg</code>.</p>
<p>When trying to do <code>RENAME *.jpg *-thumb.jpg</code> my files appear as <code>*.jpg-thumb.jpg</code>.</p>
| 71,522 | 1,129,814 | 2018-12-28 14:58:01 | 8,780,154 | 17 | 2012-01-08 18:40:21 | 530,734 | 2016-09-22 06:29:18 | https://stackoverflow.com/q/8780097 | https://stackoverflow.com/a/8780154 | <p>Something like:</p>
<pre class="lang-dos prettyprint-override"><code>for %%f in (*.jpg) do rename "%%f" "%%~nf-thumb.jpg"
</code></pre>
| <p>Something like:</p> <pre class="lang-dos prettyprint-override"><code>for %%f in (*.jpg) do rename "%%f" "%%~nf-thumb.jpg" </code></pre> | 64, 2631, 7002 | batch-file, cmd, windows | <h1>renaming files in cmd using wildcards</h1>
<p>I'm writing a BAT file for renaming some files.
My files are <code>*.jpg</code> where * is the file name and I want them to be <code>*-thumb.jpg</code>.</p>
<p>When trying to do <code>RENAME *.jpg *-thumb.jpg</code> my files appear as <code>*.jpg-thumb.jpg</code>.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,067 | cmd | # renaming files in cmd using wildcards
I'm writing a BAT file for renaming some files.
My files are `*.jpg` where * is the file name and I want them to be `*-thumb.jpg`.
When trying to do `RENAME *.jpg *-thumb.jpg` my files appear as `*.jpg-thumb.jpg`. | Something like:
```
for %%f in (*.jpg) do rename "%%f" "%%~nf-thumb.jpg"
``` |
4367297 | How to substitute variable contents in a Windows batch file | 20 | 2010-12-06 14:18:31 | <p>I'm writing a simple script to substitute text in an environment variable with other text. The trouble I get is with the substituted or substituted text being pulled from other variables</p>
<pre><code>SET a=The fat cat
ECHO %a%
REM Results in 'The fat cat'
ECHO %a:fat=thin%
REM Results in 'The thin cat'
</code></p... | 58,633 | 18,744 | 2017-04-03 03:47:12 | 4,481,648 | 17 | 2010-12-19 04:53:19 | 547,355 | 2010-12-19 05:00:41 | https://stackoverflow.com/q/4367297 | https://stackoverflow.com/a/4481648 | <p>Please try the following:</p>
<p>Copy and paste the code into Notepad and save it as a batch file.</p>
<pre><code> @echo off
setlocal enabledelayedexpansion
set str=The fat cat
set f=fat
echo.
echo f = [%f%]
echo.
echo str = [%str%]
set str=!str:%f%=thin!
echo str:... | <p>Please try the following:</p> <p>Copy and paste the code into Notepad and save it as a batch file.</p> <pre><code> @echo off setlocal enabledelayedexpansion set str=The fat cat set f=fat echo. echo f = [%f%] echo. echo str = [%str%] set str=!str:%f%=thin! echo str:... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>How to substitute variable contents in a Windows batch file</h1>
<p>I'm writing a simple script to substitute text in an environment variable with other text. The trouble I get is with the substituted or substituted text being pulled from other variables</p>
<pre><code>SET a=The fat cat
ECHO %a%
REM Results in 'Th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,068 | cmd | # How to substitute variable contents in a Windows batch file
I'm writing a simple script to substitute text in an environment variable with other text. The trouble I get is with the substituted or substituted text being pulled from other variables
```
SET a=The fat cat
ECHO %a%
REM Results in 'The fat cat'
ECHO %a:f... | Please try the following:
Copy and paste the code into Notepad and save it as a batch file.
```
@echo off
setlocal enabledelayedexpansion
set str=The fat cat
set f=fat
echo.
echo f = [%f%]
echo.
echo str = [%str%]
set str=!str:%f%=thin!
echo str:f=thin = [%str%]
```
... |
47143521 | Where to apply batch normalization on standard CNNs | 19 | 2017-11-06 18:37:01 | <p>I have the following architecture:</p>
<pre><code>Conv1
Relu1
Pooling1
Conv2
Relu2
Pooling3
FullyConnect1
FullyConnect2
</code></pre>
<p>My question is, where do I apply batch normalization? And what would be the best function to do this in TensorFlow?</p>
| 21,651 | 8,233,320 | 2021-01-15 18:20:08 | 47,143,624 | 17 | 2017-11-06 18:43:38 | 712,995 | 2017-11-06 18:43:38 | https://stackoverflow.com/q/47143521 | https://stackoverflow.com/a/47143624 | <p>The original <a href="https://arxiv.org/abs/1502.03167" rel="noreferrer">batch-norm paper</a> prescribes using the batch-norm before ReLU activation. But there is evidence that it's probably better to use batchnorm <em>after</em> the activation. Here's a comment on <a href="https://github.com/fchollet/keras/issues/1... | <p>The original <a href="https://arxiv.org/abs/1502.03167" rel="noreferrer">batch-norm paper</a> prescribes using the batch-norm before ReLU activation. But there is evidence that it's probably better to use batchnorm <em>after</em> the activation. Here's a comment on <a href="https://github.com/fchollet/keras/issues/1... | 16, 5990, 109466, 115813, 124994 | batch-normalization, conv-neural-network, machine-learning, python, tensorflow | <h1>Where to apply batch normalization on standard CNNs</h1>
<p>I have the following architecture:</p>
<pre><code>Conv1
Relu1
Pooling1
Conv2
Relu2
Pooling3
FullyConnect1
FullyConnect2
</code></pre>
<p>My question is, where do I apply batch normalization? And what would be the best function to do this in TensorFlow?</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,069 | cmd | # Where to apply batch normalization on standard CNNs
I have the following architecture:
```
Conv1
Relu1
Pooling1
Conv2
Relu2
Pooling3
FullyConnect1
FullyConnect2
```
My question is, where do I apply batch normalization? And what would be the best function to do this in TensorFlow? | The original [batch-norm paper](https://arxiv.org/abs/1502.03167) prescribes using the batch-norm before ReLU activation. But there is evidence that it's probably better to use batchnorm *after* the activation. Here's a comment on [Keras GitHub](https://github.com/fchollet/keras/issues/1802#issuecomment-187966878) by F... |
35988863 | Using command line/batch to switch to/focus on app | 19 | 2016-03-14 13:27:06 | <p>Is there an command i can use on cmd to switch to/focus on selected app window?</p>
<p>Lets say i have three apps working: A, B, C and currently i m focused on B. Is there a command (not shortcut) to switch to/focus on app A? </p>
<p>Maybe can i do it with batch?</p>
<p>Im working on windows.</p>
| 45,492 | 6,044,304 | 2024-05-24 11:34:32 | 35,990,933 | 17 | 2016-03-14 14:58:17 | 388,389 | 2022-01-07 16:44:43 | https://stackoverflow.com/q/35988863 | https://stackoverflow.com/a/35990933 | <p>try with <a href="https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/sendKeys.bat" rel="noreferrer">sendKeys.bat</a> :</p>
<pre><code>call sendkeys.bat "Title A" ""
</code></pre>
<p>The first argument is the beginning of the title you want to switch to (if it is <code>Some Titl... | <p>try with <a href="https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/sendKeys.bat" rel="noreferrer">sendKeys.bat</a> :</p> <pre><code>call sendkeys.bat "Title A" "" </code></pre> <p>The first argument is the beginning of the title you want to switch to (if it is <code>Some Titl... | 64, 1231, 7002 | batch-file, command-line, windows | <h1>Using command line/batch to switch to/focus on app</h1>
<p>Is there an command i can use on cmd to switch to/focus on selected app window?</p>
<p>Lets say i have three apps working: A, B, C and currently i m focused on B. Is there a command (not shortcut) to switch to/focus on app A? </p>
<p>Maybe can i do it wit... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,070 | cmd | # Using command line/batch to switch to/focus on app
Is there an command i can use on cmd to switch to/focus on selected app window?
Lets say i have three apps working: A, B, C and currently i m focused on B. Is there a command (not shortcut) to switch to/focus on app A?
Maybe can i do it with batch?
Im working on ... | try with [sendKeys.bat](https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/sendKeys.bat) :
```
call sendkeys.bat "Title A" ""
```
The first argument is the beginning of the title you want to switch to (if it is `Some Title` you can use only `Some` if it is unique enough). Second argument are empty ... |
6875306 | Difference between System.exit(int code) and Runtime.getRuntime().exit(int code) | 19 | 2011-07-29 15:18:09 | <p>I'm working on the Java batch program that should exit with different codes based on various conditions. The program will be triggered and monitored by CA7 scheduler which will use exit code to trigger other jobs.</p>
<p>Apparently there are couple of ways to exit:</p>
<pre><code>System.exit(int code)
</code></pr... | 7,535 | 311,263 | 2013-12-17 15:54:29 | 6,875,343 | 17 | 2011-07-29 15:21:08 | 759,762 | 2013-12-17 15:54:29 | https://stackoverflow.com/q/6875306 | https://stackoverflow.com/a/6875343 | <p>There is no real difference, however it is just convention to use <code>System.exit();</code></p>
<p><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exit%28int%29" rel="noreferrer">Source</a></p>
<blockquote>
<p>The System.exit method is the conventional and convenient means of
invokin... | <p>There is no real difference, however it is just convention to use <code>System.exit();</code></p> <p><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exit%28int%29" rel="noreferrer">Source</a></p> <blockquote> <p>The System.exit method is the conventional and convenient means of invokin... | 17, 7002 | batch-file, java | <h1>Difference between System.exit(int code) and Runtime.getRuntime().exit(int code)</h1>
<p>I'm working on the Java batch program that should exit with different codes based on various conditions. The program will be triggered and monitored by CA7 scheduler which will use exit code to trigger other jobs.</p>
<p>Appar... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,071 | cmd | # Difference between System.exit(int code) and Runtime.getRuntime().exit(int code)
I'm working on the Java batch program that should exit with different codes based on various conditions. The program will be triggered and monitored by CA7 scheduler which will use exit code to trigger other jobs.
Apparently there are ... | There is no real difference, however it is just convention to use `System.exit();`
[Source](http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exit%28int%29)
> The System.exit method is the conventional and convenient means of
> invoking this method. |
11107044 | Strange Windows DIR command behavior | 18 | 2012-06-19 18:25:29 | <p>I discovered this quite by accident while looking for a file with a number in the name. When I type:</p>
<p><b><code>dir</code></b> <code>*</code><em>number</em><code>*</code></p>
<p>(where number represents any number from 0 to 9 and with no spaces between the asterisks and the number)</p>
<p>at the cmd.exe com... | 3,851 | 1,167,442 | 2014-09-26 13:49:54 | 11,107,715 | 17 | 2012-06-19 19:08:34 | 68,204 | 2012-06-19 21:00:20 | https://stackoverflow.com/q/11107044 | https://stackoverflow.com/a/11107715 | <p>Wild cards at the command prompt are matched against both the long file name and the short "8.3" name if one is present. This can produce surprises.</p>
<p>To see the short names, use the <code>/X</code> option to the <code>DIR</code> command.</p>
<p>Note that this behavior is not in any way specific to the <code>... | <p>Wild cards at the command prompt are matched against both the long file name and the short "8.3" name if one is present. This can produce surprises.</p> <p>To see the short names, use the <code>/X</code> option to the <code>DIR</code> command.</p> <p>Note that this behavior is not in any way specific to the <code>... | 64, 1231, 2631, 7002, 14208 | batch-file, cmd, command-line, dir, windows | <h1>Strange Windows DIR command behavior</h1>
<p>I discovered this quite by accident while looking for a file with a number in the name. When I type:</p>
<p><b><code>dir</code></b> <code>*</code><em>number</em><code>*</code></p>
<p>(where number represents any number from 0 to 9 and with no spaces between the asteri... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,073 | cmd | # Strange Windows DIR command behavior
I discovered this quite by accident while looking for a file with a number in the name. When I type:
**`dir`** `*`*number*`*`
(where number represents any number from 0 to 9 and with no spaces between the asterisks and the number)
at the cmd.exe command prompt, it returns vari... | Wild cards at the command prompt are matched against both the long file name and the short "8.3" name if one is present. This can produce surprises.
To see the short names, use the `/X` option to the `DIR` command.
Note that this behavior is not in any way specific to the `DIR` command, and can lead to other (often u... |
23302049 | run robocopy bat to copy entire drive to another drive | 16 | 2014-04-25 20:05:54 | <p>I'm trying to run a simple backup (mirror) of one entire drive (d:) to another drive (k:). I've created a .bat file ('backup.bat') defining the source (d:) and destination (k:) and placed this batch file within a folder on the d drive (d:\temp). When I double-click on the batch file it defines the source as d:\temp,... | 125,537 | 3,178,354 | 2021-09-06 14:42:10 | 23,302,499 | 17 | 2014-04-25 20:32:05 | 30,447 | 2014-04-25 20:32:05 | https://stackoverflow.com/q/23302049 | https://stackoverflow.com/a/23302499 | <p>with <code>"D:"</code> you are <strong>not</strong> specifying the <em>root</em> directory of the D drive (<code>D:\</code>) but the <em>current</em> directory of D instead, (<code>D:\temp</code> in your example). </p>
<p>To solve this problem, just add <code>\</code> to the source spec (and while there, to the des... | <p>with <code>"D:"</code> you are <strong>not</strong> specifying the <em>root</em> directory of the D drive (<code>D:\</code>) but the <em>current</em> directory of D instead, (<code>D:\temp</code> in your example). </p> <p>To solve this problem, just add <code>\</code> to the source spec (and while there, to the des... | 64, 2631, 7002, 11635, 34595 | batch-file, cmd, robocopy, windows, windows-7 | <h1>run robocopy bat to copy entire drive to another drive</h1>
<p>I'm trying to run a simple backup (mirror) of one entire drive (d:) to another drive (k:). I've created a .bat file ('backup.bat') defining the source (d:) and destination (k:) and placed this batch file within a folder on the d drive (d:\temp). When I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,074 | cmd | # run robocopy bat to copy entire drive to another drive
I'm trying to run a simple backup (mirror) of one entire drive (d:) to another drive (k:). I've created a .bat file ('backup.bat') defining the source (d:) and destination (k:) and placed this batch file within a folder on the d drive (d:\temp). When I double-cl... | with `"D:"` you are **not** specifying the *root* directory of the D drive (`D:\`) but the *current* directory of D instead, (`D:\temp` in your example).
To solve this problem, just add `\` to the source spec (and while there, to the dest spec as well)
```
robocopy d:\ k:\ /L /v
``` |
44927312 | Access is denied when use del /f in windows 10 64bit | 15 | 2017-07-05 13:13:31 | <p>I'm going to delete 1.mp3 but it gives me the error "Access is denied".</p>
<p>More info about file's perms:</p>
<pre><code>attrib 1.mp3
A C:\Users\Alipour\Desktop\1\1.mp3
</code></pre>
<p>I also used <code>attrib -s -h 1.mp3</code></p>
<p>but still it can not be deleted by</p>
<pre><code>del /f/s/q 1.mp3 >... | 50,691 | 2,362,678 | 2022-03-18 06:48:07 | 44,928,249 | 17 | 2017-07-05 13:54:13 | 8,051,589 | 2017-08-15 06:09:34 | https://stackoverflow.com/q/44927312 | https://stackoverflow.com/a/44928249 | <p>There are several methods to remove such a file:</p>
<p><strong>1. Process Explorer if the file is in use:</strong><br>
You can use <a href="https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx" rel="noreferrer">ProcessExplorer</a> from Windows Sysinternals to identifiy which program locks the file... | <p>There are several methods to remove such a file:</p> <p><strong>1. Process Explorer if the file is in use:</strong><br> You can use <a href="https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx" rel="noreferrer">ProcessExplorer</a> from Windows Sysinternals to identifiy which program locks the file... | 64, 2120, 2631 | cmd, file-permissions, windows | <h1>Access is denied when use del /f in windows 10 64bit</h1>
<p>I'm going to delete 1.mp3 but it gives me the error "Access is denied".</p>
<p>More info about file's perms:</p>
<pre><code>attrib 1.mp3
A C:\Users\Alipour\Desktop\1\1.mp3
</code></pre>
<p>I also used <code>attrib -s -h 1.mp3</code></p>
<p>but still... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,075 | cmd | # Access is denied when use del /f in windows 10 64bit
I'm going to delete 1.mp3 but it gives me the error "Access is denied".
More info about file's perms:
```
attrib 1.mp3
A C:\Users\Alipour\Desktop\1\1.mp3
```
I also used `attrib -s -h 1.mp3`
but still it can not be deleted by
```
del /f/s/q 1.mp3 > NUL
```
... | There are several methods to remove such a file:
**1. Process Explorer if the file is in use:**
You can use [ProcessExplorer](https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx) from Windows Sysinternals to identifiy which program locks the file. Download and start ProcessExplorer and go to `Find|... |
5254460 | How can I get a password containing a caret (^) passed unchanged as a parameter to a Windows batch file? | 15 | 2011-03-10 01:34:59 | <p><strong>Summary:</strong><br>
From the command line (on Windows Server 2003 R2), I type:</p>
<pre><code>> SET password=a^b
> ECHO %password%
</code></pre>
<p>And the result is "ab". Where'd the freakin caret (^) go? I then attempted to "escape" it with ^^, `^, %^, ^^^, and none of these worked to ever have... | 9,068 | 501,113 | 2023-11-22 15:20:53 | 5,254,713 | 17 | 2011-03-10 02:16:57 | 235 | 2011-03-10 02:16:57 | https://stackoverflow.com/q/5254460 | https://stackoverflow.com/a/5254713 | <p>According to <a href="http://www.phipster.com/2008/12/using-caret-in-windows-batch-files.html" rel="noreferrer">this page</a>, <strong>& | ( < > ^</strong> are all reserved characters in windows batch files. ^ is an escape character, as well as line continuation character. ^^ should give you a ^, but then tha... | <p>According to <a href="http://www.phipster.com/2008/12/using-caret-in-windows-batch-files.html" rel="noreferrer">this page</a>, <strong>& | ( < > ^</strong> are all reserved characters in windows batch files. ^ is an escape character, as well as line continuation character. ^^ should give you a ^, but then tha... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>How can I get a password containing a caret (^) passed unchanged as a parameter to a Windows batch file?</h1>
<p><strong>Summary:</strong><br>
From the command line (on Windows Server 2003 R2), I type:</p>
<pre><code>> SET password=a^b
> ECHO %password%
</code></pre>
<p>And the result is "ab". Where'd the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,076 | cmd | # How can I get a password containing a caret (^) passed unchanged as a parameter to a Windows batch file?
**Summary:**
From the command line (on Windows Server 2003 R2), I type:
```
> SET password=a^b
> ECHO %password%
```
And the result is "ab". Where'd the freakin caret (^) go? I then attempted to "escape" it... | According to [this page](http://www.phipster.com/2008/12/using-caret-in-windows-batch-files.html), **& | ( < > ^** are all reserved characters in windows batch files. ^ is an escape character, as well as line continuation character. ^^ should give you a ^, but then that ^ may need to be escaped.
To get a password thro... |
23226233 | How to add date and time to filename in DOS? | 14 | 2014-04-22 17:22:19 | <p>I want to add date and time value in filename and then I want to move that file to near by folder.</p>
<p>Here I'm using below commands to capture date and time :</p>
<pre><code>set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~,8%
echo %dt%
</code></pre>
<p>Then I am using copy command as below :</p>
<pre><co... | 118,041 | 3,561,488 | 2017-01-06 09:49:34 | 23,226,410 | 17 | 2014-04-22 17:32:26 | 980,550 | 2016-06-07 23:02:19 | https://stackoverflow.com/q/23226233 | https://stackoverflow.com/a/23226410 | <p>The colon (<code>:</code>) isn't allowed in a file name. It's reserved for delimiting drive letters, etc, in DOS path names. You could use underscore (<code>_</code>) instead:</p>
<pre><code>set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~0,2%_%time:~3,2%_%time:~6,2%
</code></pre>
<p>Note that there is no leadi... | <p>The colon (<code>:</code>) isn't allowed in a file name. It's reserved for delimiting drive letters, etc, in DOS path names. You could use underscore (<code>_</code>) instead:</p> <pre><code>set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~0,2%_%time:~3,2%_%time:~6,2% </code></pre> <p>Note that there is no leadi... | 7002 | batch-file | <h1>How to add date and time to filename in DOS?</h1>
<p>I want to add date and time value in filename and then I want to move that file to near by folder.</p>
<p>Here I'm using below commands to capture date and time :</p>
<pre><code>set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~,8%
echo %dt%
</code></pre>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,077 | cmd | # How to add date and time to filename in DOS?
I want to add date and time value in filename and then I want to move that file to near by folder.
Here I'm using below commands to capture date and time :
```
set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~,8%
echo %dt%
```
Then I am using copy command as below :... | The colon (`:`) isn't allowed in a file name. It's reserved for delimiting drive letters, etc, in DOS path names. You could use underscore (`_`) instead:
```
set dt=%date:~7,2%-%date:~4,2%-%date:~10,4%_%time:~0,2%_%time:~3,2%_%time:~6,2%
```
Note that there is no leading zero for times before 10 am. If this is import... |
13933944 | Rename multiple files without parentheses/remove parentheses windows | 14 | 2012-12-18 13:21:08 | <p>I want to rename a large number of files in increasing order of numbers, starting from anywhere.
But when I rename multiple files, it leaves me with parentheses.
eg i rename files to abc_.jpeg it results in abc_(1).jpeg, abc_(2).jpeg and so on.</p>
<p>I tried using command prompt to rename </p>
<p><code>ren abc_... | 67,993 | 1,331,342 | 2022-10-08 18:50:09 | 13,937,977 | 17 | 2012-12-18 17:04:42 | 799,586 | 2012-12-18 21:58:25 | https://stackoverflow.com/q/13933944 | https://stackoverflow.com/a/13937977 | <p>To remove the brackets you will have to do some string manipulation. I have written a batch file to do this (save as <code>.bat</code>)</p>
<pre><code>cd C:\folder
setlocal enabledelayedexpansion
for %%a in (abc_*.jpeg) do (
set f=%%a
set f=!f:^(=!
set f=!f:^)=!
ren "%%a" "!f!"
)
</code></pre>
<p>I don't think you... | <p>To remove the brackets you will have to do some string manipulation. I have written a batch file to do this (save as <code>.bat</code>)</p> <pre><code>cd C:\folder setlocal enabledelayedexpansion for %%a in (abc_*.jpeg) do ( set f=%%a set f=!f:^(=! set f=!f:^)=! ren "%%a" "!f!" ) </code></pre> <p>I don't think you... | 64, 2631, 4510 | cmd, rename, windows | <h1>Rename multiple files without parentheses/remove parentheses windows</h1>
<p>I want to rename a large number of files in increasing order of numbers, starting from anywhere.
But when I rename multiple files, it leaves me with parentheses.
eg i rename files to abc_.jpeg it results in abc_(1).jpeg, abc_(2).jpeg and... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,078 | cmd | # Rename multiple files without parentheses/remove parentheses windows
I want to rename a large number of files in increasing order of numbers, starting from anywhere.
But when I rename multiple files, it leaves me with parentheses.
eg i rename files to abc_.jpeg it results in abc_(1).jpeg, abc_(2).jpeg and so on.
I ... | To remove the brackets you will have to do some string manipulation. I have written a batch file to do this (save as `.bat`)
```
cd C:\folder
setlocal enabledelayedexpansion
for %%a in (abc_*.jpeg) do (
set f=%%a
set f=!f:^(=!
set f=!f:^)=!
ren "%%a" "!f!"
)
```
I don't think you can easily do this in one line from t... |
2740827 | MSBuild Validating Properties | 14 | 2010-04-29 21:15:26 | <p>I'm working on a reusable MSBuild Target that will be consumed by several other tasks. This target requires that several properties be defined. What's the best way to validate that properties are defined, throwing an Error if the are not?</p>
<p>Two attempts that I <em>almost</em> like:</p>
<pre><code><?xml ver... | 5,602 | 6,151 | 2012-12-30 01:25:31 | 2,746,543 | 17 | 2010-04-30 17:49:24 | 105,999 | 2012-12-30 01:25:31 | https://stackoverflow.com/q/2740827 | https://stackoverflow.com/a/2746543 | <p>Great question! I have written about this in depth in my <a href="http://msbuildbook.com/" rel="noreferrer">book</a> and in a blog post, <a href="http://sedodream.com/2009/06/30/ElementsOfReusableMSBuildScriptsValidation.aspx" rel="noreferrer">Elements of Reusable MSBuild Scripts: Validation</a>. My approach will co... | <p>Great question! I have written about this in depth in my <a href="http://msbuildbook.com/" rel="noreferrer">book</a> and in a blog post, <a href="http://sedodream.com/2009/06/30/ElementsOfReusableMSBuildScriptsValidation.aspx" rel="noreferrer">Elements of Reusable MSBuild Scripts: Validation</a>. My approach will co... | 265, 4898, 7002 | batch-file, msbuild, properties | <h1>MSBuild Validating Properties</h1>
<p>I'm working on a reusable MSBuild Target that will be consumed by several other tasks. This target requires that several properties be defined. What's the best way to validate that properties are defined, throwing an Error if the are not?</p>
<p>Two attempts that I <em>almost<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,079 | cmd | # MSBuild Validating Properties
I'm working on a reusable MSBuild Target that will be consumed by several other tasks. This target requires that several properties be defined. What's the best way to validate that properties are defined, throwing an Error if the are not?
Two attempts that I *almost* like:
```
<?xml v... | Great question! I have written about this in depth in my [book](http://msbuildbook.com/) and in a blog post, [Elements of Reusable MSBuild Scripts: Validation](http://sedodream.com/2009/06/30/ElementsOfReusableMSBuildScriptsValidation.aspx). My approach will cover properties and items.
Here is the run down. In the sha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.