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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16974120 | mysql import only missing rows | 11 | 2013-06-06 23:55:08 | <p>I'm looking for a way to restore my DB from a prior backup. However, the backup should not simply overwrite all existing records but instead add only the difference between current DB and the backup file. If no "non existent" records are stored in the backup, nothing should happen. The backups were made with mysqldu... | 8,324 | 2,461,703 | 2014-12-01 19:46:28 | 27,236,041 | 22 | 2014-12-01 19:46:28 | 2,309,582 | 2014-12-01 19:46:28 | https://stackoverflow.com/q/16974120 | https://stackoverflow.com/a/27236041 | <p>Here is a less manual answer:</p>
<p><code>mysqldump -t --insert-ignore --skip-opt -u USER -pPASSWORD -h 127.0.0.1 database > database.sql</code></p>
<p>That export command with the <code>-t --insert-ignore --skip-opt</code> options will give you a sql dump file with no <code>DROP TABLE</code> or <code>CREATE T... | <p>Here is a less manual answer:</p> <p><code>mysqldump -t --insert-ignore --skip-opt -u USER -pPASSWORD -h 127.0.0.1 database > database.sql</code></p> <p>That export command with the <code>-t --insert-ignore --skip-opt</code> options will give you a sql dump file with no <code>DROP TABLE</code> or <code>CREATE T... | 21, 2631 | cmd, mysql | <h1>mysql import only missing rows</h1>
<p>I'm looking for a way to restore my DB from a prior backup. However, the backup should not simply overwrite all existing records but instead add only the difference between current DB and the backup file. If no "non existent" records are stored in the backup, nothing should ha... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,859 | cmd | # mysql import only missing rows
I'm looking for a way to restore my DB from a prior backup. However, the backup should not simply overwrite all existing records but instead add only the difference between current DB and the backup file. If no "non existent" records are stored in the backup, nothing should happen. The... | Here is a less manual answer:
`mysqldump -t --insert-ignore --skip-opt -u USER -pPASSWORD -h 127.0.0.1 database > database.sql`
That export command with the `-t --insert-ignore --skip-opt` options will give you a sql dump file with no `DROP TABLE` or `CREATE TABLE` commands and every `INSERT` is now an `INSERT IGNORE... |
19103950 | Running batch file from USB drive when drive letter changes | 11 | 2013-09-30 21:12:36 | <p>So, I have made a batch script and it executes multiple portable programs (e.g., prog1.exe, prog2.exe, etc). The problem is whenever I connect the USB drive to another computer, the drive letters change, giving me errors when running my .bat file. Please help me find a solution. Thank you.</p>
| 42,978 | 2,832,713 | 2017-12-07 19:36:26 | 19,104,070 | 22 | 2013-09-30 21:19:38 | 361,842 | 2014-09-17 12:02:43 | https://stackoverflow.com/q/19103950 | https://stackoverflow.com/a/19104070 | <p><code>%~d0</code> gives you the current drive letter (including the colon). If the batch file's contained on the USB drive, you can use that.</p>
<p>So, for instance, instead of</p>
<pre><code>E:\PortablePrograms\ProgramName.exe
</code></pre>
<p>you would write</p>
<pre><code>%~d0\PortablePrograms\ProgramName.e... | <p><code>%~d0</code> gives you the current drive letter (including the colon). If the batch file's contained on the USB drive, you can use that.</p> <p>So, for instance, instead of</p> <pre><code>E:\PortablePrograms\ProgramName.exe </code></pre> <p>you would write</p> <pre><code>%~d0\PortablePrograms\ProgramName.e... | 7002 | batch-file | <h1>Running batch file from USB drive when drive letter changes</h1>
<p>So, I have made a batch script and it executes multiple portable programs (e.g., prog1.exe, prog2.exe, etc). The problem is whenever I connect the USB drive to another computer, the drive letters change, giving me errors when running my .bat file. ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,860 | cmd | # Running batch file from USB drive when drive letter changes
So, I have made a batch script and it executes multiple portable programs (e.g., prog1.exe, prog2.exe, etc). The problem is whenever I connect the USB drive to another computer, the drive letters change, giving me errors when running my .bat file. Please he... | `%~d0` gives you the current drive letter (including the colon). If the batch file's contained on the USB drive, you can use that.
So, for instance, instead of
```
E:\PortablePrograms\ProgramName.exe
```
you would write
```
%~d0\PortablePrograms\ProgramName.exe
```
... or you could do something like this
```
::ch... |
31069920 | VBScript - How to pause a script until a specific key is pressed? | 10 | 2015-06-26 09:43:15 | <p>How to pause a VBScript program until the user presses a specific key?<br />
I need to pause the execution of the script and make it wait until a key such as 'left_arrow' is pressed.</p>
| 34,598 | 4,430,117 | 2024-05-04 00:09:14 | 31,072,302 | 22 | 2015-06-26 11:41:38 | 2,237,785 | 2015-06-26 11:41:38 | https://stackoverflow.com/q/31069920 | https://stackoverflow.com/a/31072302 | <p>You don't have a lot of choices. If you have a console script, and I'm assuming you do, you can read input from the user but it only registers when you press [ENTER]. So you could pause until the enter key is pressed. For example:</p>
<pre><code>WScript.Echo "Press [ENTER] to continue..."
' Read dummy input. This ... | <p>You don't have a lot of choices. If you have a console script, and I'm assuming you do, you can read input from the user but it only registers when you press [ENTER]. So you could pause until the enter key is pressed. For example:</p> <pre><code>WScript.Echo "Press [ENTER] to continue..." ' Read dummy input. This ... | 494, 2221, 2631, 21289, 114256 | cmd, pause, sleep, vbscript, wait | <h1>VBScript - How to pause a script until a specific key is pressed?</h1>
<p>How to pause a VBScript program until the user presses a specific key?<br />
I need to pause the execution of the script and make it wait until a key such as 'left_arrow' is pressed.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,861 | cmd | # VBScript - How to pause a script until a specific key is pressed?
How to pause a VBScript program until the user presses a specific key?
I need to pause the execution of the script and make it wait until a key such as 'left_arrow' is pressed. | You don't have a lot of choices. If you have a console script, and I'm assuming you do, you can read input from the user but it only registers when you press [ENTER]. So you could pause until the enter key is pressed. For example:
```
WScript.Echo "Press [ENTER] to continue..."
' Read dummy input. This call will not ... |
19303155 | Copy file from batch file's directory | 10 | 2013-10-10 18:12:18 | <p>I know only the very basics of writing batch files. I am trying to figure out how to write one that, given any directory it is in, would copy a file that is within the same directory and put it in a new location. I know how to copy the file and move it, but I don't know how to write the batch file to understand it... | 49,430 | 2,275,022 | 2013-10-10 18:30:07 | 19,303,478 | 22 | 2013-10-10 18:30:07 | 891,976 | 2013-10-10 18:30:07 | https://stackoverflow.com/q/19303155 | https://stackoverflow.com/a/19303478 | <h3><code>%0</code> contains the full path and file name to the batch script.</h3>
<p>Use just <code>%~dp0</code> to get the path without the batch script file name.</p>
<pre><code>copy "%~dp0\Move.txt" "C:\"
</code></pre>
<p>Use the <code>echo</code> command to view what a variable holds when you a... | <h3><code>%0</code> contains the full path and file name to the batch script.</h3> <p>Use just <code>%~dp0</code> to get the path without the batch script file name.</p> <pre><code>copy "%~dp0\Move.txt" "C:\" </code></pre> <p>Use the <code>echo</code> command to view what a variable holds when you a... | 64, 7002, 9938 | batch-file, command-prompt, windows | <h1>Copy file from batch file's directory</h1>
<p>I know only the very basics of writing batch files. I am trying to figure out how to write one that, given any directory it is in, would copy a file that is within the same directory and put it in a new location. I know how to copy the file and move it, but I don't kn... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,862 | cmd | # Copy file from batch file's directory
I know only the very basics of writing batch files. I am trying to figure out how to write one that, given any directory it is in, would copy a file that is within the same directory and put it in a new location. I know how to copy the file and move it, but I don't know how to w... | ### `%0` contains the full path and file name to the batch script.
Use just `%~dp0` to get the path without the batch script file name.
```
copy "%~dp0\Move.txt" "C:\"
```
Use the `echo` command to view what a variable holds when you are having a problem.
```
echo %0
```
From `call /?`
```
Substitution of batch p... |
7295232 | Non-blocking batch file execution | 9 | 2011-09-03 19:04:03 | <p>I have the following commands in a batch file:</p>
<pre><code>"C:\MI2\Stream\bin\Debug\Stream.exe" 19
"C:\MI2\Stream\bin\Debug\Stream.exe" 20
"C:\MI2\Stream\bin\Debug\Stream.exe" 21
"C:\MI2\Stream\bin\Debug\Stream.exe" 23
"C:\MI2\Stream\bin\Debug\Stream.exe" 25
</code></pre>
<p>I'm attempting to execute 5 instance... | 10,658 | 585,152 | 2025-03-10 09:45:46 | 7,295,299 | 22 | 2011-09-03 19:14:49 | 41,071 | 2011-09-03 19:32:31 | https://stackoverflow.com/q/7295232 | https://stackoverflow.com/a/7295299 | <p>You can use <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true"><code>start</code></a>:</p>
<pre><code>start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 19
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 20
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 21
start "" ... | <p>You can use <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true"><code>start</code></a>:</p> <pre><code>start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 19 start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 20 start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 21 start "" ... | 7002 | batch-file | <h1>Non-blocking batch file execution</h1>
<p>I have the following commands in a batch file:</p>
<pre><code>"C:\MI2\Stream\bin\Debug\Stream.exe" 19
"C:\MI2\Stream\bin\Debug\Stream.exe" 20
"C:\MI2\Stream\bin\Debug\Stream.exe" 21
"C:\MI2\Stream\bin\Debug\Stream.exe" 23
"C:\MI2\Stream\bin\Debug\Stream.exe" 25
</code></pr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,864 | cmd | # Non-blocking batch file execution
I have the following commands in a batch file:
```
"C:\MI2\Stream\bin\Debug\Stream.exe" 19
"C:\MI2\Stream\bin\Debug\Stream.exe" 20
"C:\MI2\Stream\bin\Debug\Stream.exe" 21
"C:\MI2\Stream\bin\Debug\Stream.exe" 23
"C:\MI2\Stream\bin\Debug\Stream.exe" 25
```
I'm attempting to execute ... | You can use [`start`](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true):
```
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 19
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 20
start "" "C:\MI2\Stream\bin\Debug\Stream.exe" 21
start "" "C:\MI2\Stream\bin\Debug\Stream.exe"... |
4904191 | Delete folders with wild cards from a batch file Windows 7 | 9 | 2011-02-05 00:14:40 | <ol>
<li>I know we can write programs to do it. <br/></li>
<li>I know we can write other scripts (perl/vbscript/ etc.) to do it. </li>
</ol>
<p>I am looking for a command prompt/batch file solution to delete all folders matching <strong>sub_*</strong> (like sub_1, sub_2 ... ) to be deleted. rmdir or rd doesn't support... | 17,723 | 501,004 | 2015-11-06 03:37:45 | 4,904,285 | 22 | 2011-02-05 00:34:11 | 73,070 | 2011-02-05 00:34:11 | https://stackoverflow.com/q/4904191 | https://stackoverflow.com/a/4904285 | <pre><code>for /d %x in (sub_*) do rd /s /q "%x"
</code></pre>
<p>You need to double the <code>%</code> if used in a batch file:</p>
<pre><code>for /d %%x in (sub_*) do rd /s /q "%%x"
</code></pre>
<p>Untested, make sure to first use <code>echo</code> or something else that doesn't immediately wipe the directories ;... | <pre><code>for /d %x in (sub_*) do rd /s /q "%x" </code></pre> <p>You need to double the <code>%</code> if used in a batch file:</p> <pre><code>for /d %%x in (sub_*) do rd /s /q "%%x" </code></pre> <p>Untested, make sure to first use <code>echo</code> or something else that doesn't immediately wipe the directories ;... | 1796, 7002, 9938 | batch-file, command, command-prompt | <h1>Delete folders with wild cards from a batch file Windows 7</h1>
<ol>
<li>I know we can write programs to do it. <br/></li>
<li>I know we can write other scripts (perl/vbscript/ etc.) to do it. </li>
</ol>
<p>I am looking for a command prompt/batch file solution to delete all folders matching <strong>sub_*</strong>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,865 | cmd | # Delete folders with wild cards from a batch file Windows 7
1. I know we can write programs to do it.
2. I know we can write other scripts (perl/vbscript/ etc.) to do it.
I am looking for a command prompt/batch file solution to delete all folders matching **sub_*** (like sub_1, sub_2 ... ) to be deleted. rmdir or rd... | ```
for /d %x in (sub_*) do rd /s /q "%x"
```
You need to double the `%` if used in a batch file:
```
for /d %%x in (sub_*) do rd /s /q "%%x"
```
Untested, make sure to first use `echo` or something else that doesn't immediately wipe the directories ;) |
56026422 | How to start Python virtual environment in .bat batch file? | 7 | 2019-05-07 15:57:26 | <p>I need to set up a long list of temporary environment variables every time when I start a Python Flask app on Windows 10. Now I would like to create a batch file to run with all settings in one double click. The following lines run well if I copy them and paste to cmd prompt, but I couldn't run them in the batch fil... | 14,145 | 10,855,350 | 2020-07-17 14:40:34 | 56,026,485 | 22 | 2019-05-07 16:01:46 | 404,970 | 2019-05-07 16:01:46 | https://stackoverflow.com/q/56026422 | https://stackoverflow.com/a/56026485 | <p>One of the many (far too many) quirks of .bat files is that if you launch another .bat file, it doesn't know where to return to.<br>
You need to explicitly <code>call</code> it:</p>
<pre><code>call venv\scripts\activate
</code></pre>
| <p>One of the many (far too many) quirks of .bat files is that if you launch another .bat file, it doesn't know where to return to.<br> You need to explicitly <code>call</code> it:</p> <pre><code>call venv\scripts\activate </code></pre> | 2631, 7002, 90848 | batch-file, cmd, python-venv | <h1>How to start Python virtual environment in .bat batch file?</h1>
<p>I need to set up a long list of temporary environment variables every time when I start a Python Flask app on Windows 10. Now I would like to create a batch file to run with all settings in one double click. The following lines run well if I copy t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,866 | cmd | # How to start Python virtual environment in .bat batch file?
I need to set up a long list of temporary environment variables every time when I start a Python Flask app on Windows 10. Now I would like to create a batch file to run with all settings in one double click. The following lines run well if I copy them and p... | One of the many (far too many) quirks of .bat files is that if you launch another .bat file, it doesn't know where to return to.
You need to explicitly `call` it:
```
call venv\scripts\activate
``` |
51965156 | Using wget to force cache clear | 7 | 2018-08-22 10:47:39 | <p>I am trying to extract the current date and time from this Wikipedia page (<a href="https://en.wikipedia.org/wiki/ISO_8601" rel="noreferrer">https://en.wikipedia.org/wiki/ISO_8601</a>) using wget in the Windows 10 command prompt. This is for a personal app I am developing, so instead of trying to figure out more com... | 25,151 | 9,946,112 | 2021-09-25 06:13:19 | 51,969,942 | 22 | 2018-08-22 15:11:18 | 2,896,216 | 2018-08-22 15:11:18 | https://stackoverflow.com/q/51965156 | https://stackoverflow.com/a/51969942 | <p>This will work:</p>
<pre><code>wget --no-check-certificate --no-cache --no-cookies https://en.wikipedia.org/wiki/ISO_8601 --post-data="action=purge"
</code></pre>
<p>But forcing the servers at wikipedia to update the cached version of the page across their servers might not be the best way to solve this overall. S... | <p>This will work:</p> <pre><code>wget --no-check-certificate --no-cache --no-cookies https://en.wikipedia.org/wiki/ISO_8601 --post-data="action=purge" </code></pre> <p>But forcing the servers at wikipedia to update the cached version of the page across their servers might not be the best way to solve this overall. S... | 64, 1231, 5583, 7002 | batch-file, command-line, wget, windows | <h1>Using wget to force cache clear</h1>
<p>I am trying to extract the current date and time from this Wikipedia page (<a href="https://en.wikipedia.org/wiki/ISO_8601" rel="noreferrer">https://en.wikipedia.org/wiki/ISO_8601</a>) using wget in the Windows 10 command prompt. This is for a personal app I am developing, so... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,867 | cmd | # Using wget to force cache clear
I am trying to extract the current date and time from this Wikipedia page (<https://en.wikipedia.org/wiki/ISO_8601>) using wget in the Windows 10 command prompt. This is for a personal app I am developing, so instead of trying to figure out more complicated c++ (only language I know, ... | This will work:
```
wget --no-check-certificate --no-cache --no-cookies https://en.wikipedia.org/wiki/ISO_8601 --post-data="action=purge"
```
But forcing the servers at wikipedia to update the cached version of the page across their servers might not be the best way to solve this overall. Since you are programming in... |
7752121 | Catch an error inside a batch file (7-zip) | 7 | 2011-10-13 09:32:19 | <p>I have a batch file in which I execute the following line to list the contents of an archive:</p>
<pre><code>"\Program Files\7-Zip\7z.exe" l "\Backup Google Docs.7z"
</code></pre>
<p>The archive is intentionally corrupted.</p>
<p>cmd.exe displays this:</p>
<p><img src="https://i.sstatic.net/YFK1U.jpg" alt="enter... | 25,943 | 652,669 | 2016-12-15 23:38:16 | 7,752,279 | 22 | 2011-10-13 09:48:15 | 457,352 | 2011-10-13 09:48:15 | https://stackoverflow.com/q/7752121 | https://stackoverflow.com/a/7752279 | <p>Any program's exit code is stored in the <code>%ERRORLEVEL%</code> variable in a batch script.</p>
<p>From the 7-zip manual:</p>
<pre><code>7-Zip returns the following exit codes:
Code Meaning
0 No error
1 Warning (Non fatal error(s)). For example, one or more files were locked by some other application, so the... | <p>Any program's exit code is stored in the <code>%ERRORLEVEL%</code> variable in a batch script.</p> <p>From the 7-zip manual:</p> <pre><code>7-Zip returns the following exit codes: Code Meaning 0 No error 1 Warning (Non fatal error(s)). For example, one or more files were locked by some other application, so the... | 64, 379, 3981, 5680, 7002 | 7zip, batch-file, error-handling, runtime-error, windows | <h1>Catch an error inside a batch file (7-zip)</h1>
<p>I have a batch file in which I execute the following line to list the contents of an archive:</p>
<pre><code>"\Program Files\7-Zip\7z.exe" l "\Backup Google Docs.7z"
</code></pre>
<p>The archive is intentionally corrupted.</p>
<p>cmd.exe displays this:</p>
<p><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,868 | cmd | # Catch an error inside a batch file (7-zip)
I have a batch file in which I execute the following line to list the contents of an archive:
```
"\Program Files\7-Zip\7z.exe" l "\Backup Google Docs.7z"
```
The archive is intentionally corrupted.
cmd.exe displays this:
). For example, one or more files were locked by some other application, so they were not compressed.
2 Fatal ... |
3848597 | .bat current folder name | 7 | 2010-10-03 04:24:38 | <p>In my bat script, I'm calling another script and passing it a string parameter</p>
<pre><code>cscript log.vbs "triggered from folder <foldername> by Eric"
</code></pre>
<p>The string parameter as you can see contains the name of the folder from which the script is being called. What's the right way to pass t... | 23,339 | 407,723 | 2017-05-05 06:39:15 | 3,848,657 | 22 | 2010-10-03 04:55:20 | 14,860 | 2013-02-18 12:32:09 | https://stackoverflow.com/q/3848597 | https://stackoverflow.com/a/3848657 | <p>If you want the directory where you're currently at, you can get that from <code>%cd%</code>. That's your current working directory.</p>
<p>If you're going to be <em>changing</em> your current working directory during the script execution, just save it at the start:</p>
<pre><code>set startdir=%cd%
</code></pre>
... | <p>If you want the directory where you're currently at, you can get that from <code>%cd%</code>. That's your current working directory.</p> <p>If you're going to be <em>changing</em> your current working directory during the script execution, just save it at the start:</p> <pre><code>set startdir=%cd% </code></pre> ... | 64, 7002 | batch-file, windows | <h1>.bat current folder name</h1>
<p>In my bat script, I'm calling another script and passing it a string parameter</p>
<pre><code>cscript log.vbs "triggered from folder <foldername> by Eric"
</code></pre>
<p>The string parameter as you can see contains the name of the folder from which the script is being call... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,869 | cmd | # .bat current folder name
In my bat script, I'm calling another script and passing it a string parameter
```
cscript log.vbs "triggered from folder <foldername> by Eric"
```
The string parameter as you can see contains the name of the folder from which the script is being called. What's the right way to pass this d... | If you want the directory where you're currently at, you can get that from `%cd%`. That's your current working directory.
If you're going to be *changing* your current working directory during the script execution, just save it at the start:
```
set startdir=%cd%
```
then you can use `%startdir%` in your code regard... |
7496065 | How to echo an environment variable of which string value has an '&' in Windows batch? | 6 | 2011-09-21 07:27:08 | <p>A batch file has the lines:</p>
<pre><code>set hi=Hello^&World!
echo %hi%
</code></pre>
<p>It prints <code>Hello</code> and next outputs the error message:</p>
<blockquote>
<p>'World!' is not recognized as an internal or external command,<br />
operable program or batch file.</p>
</blockquote>
<p>I want that it ... | 58,364 | 505,515 | 2025-04-04 05:12:31 | 7,496,814 | 22 | 2011-09-21 08:32:58 | 799,586 | 2011-09-21 08:32:58 | https://stackoverflow.com/q/7496065 | https://stackoverflow.com/a/7496814 | <p>This works for me:</p>
<pre><code>set "hi=Hello^&World!"
echo %hi%
</code></pre>
<p>Outputs</p>
<pre><code>Hello&World!
</code></pre>
| <p>This works for me:</p> <pre><code>set "hi=Hello^&World!" echo %hi% </code></pre> <p>Outputs</p> <pre><code>Hello&World! </code></pre> | 7002, 13824 | batch-file, echo | <h1>How to echo an environment variable of which string value has an '&' in Windows batch?</h1>
<p>A batch file has the lines:</p>
<pre><code>set hi=Hello^&World!
echo %hi%
</code></pre>
<p>It prints <code>Hello</code> and next outputs the error message:</p>
<blockquote>
<p>'World!' is not recognized as an internal... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,870 | cmd | # How to echo an environment variable of which string value has an '&' in Windows batch?
A batch file has the lines:
```
set hi=Hello^&World!
echo %hi%
```
It prints `Hello` and next outputs the error message:
> 'World!' is not recognized as an internal or external command,
> operable program or batch file.
I wa... | This works for me:
```
set "hi=Hello^&World!"
echo %hi%
```
Outputs
```
Hello&World!
``` |
5485853 | How to create a folder with name as current date in batch (.bat) files | 54 | 2011-03-30 11:46:35 | <p>I don't know much about windows .bat file syntax. My simple requirement is to create a folder at a specific location with name as current date. I tried searching this on google but didn't get any good option. Is there any way to do this?</p>
| 317,686 | 191 | 2021-02-23 11:00:40 | 5,485,929 | 21 | 2011-03-30 11:54:03 | 138,579 | 2011-03-30 11:54:03 | https://stackoverflow.com/q/5485853 | https://stackoverflow.com/a/5485929 | <p>Try this (an equivalent of bash backquotes):</p>
<pre><code>for /f "tokens=1* delims=" %%a in ('date /T') do set datestr=%%a
mkdir %datestr%
</code></pre>
<p>For further information, see <a href="http://ss64.com/nt/for_cmd.html" rel="noreferrer">http://ss64.com/nt/for_cmd.html</a></p>
| <p>Try this (an equivalent of bash backquotes):</p> <pre><code>for /f "tokens=1* delims=" %%a in ('date /T') do set datestr=%%a mkdir %datestr% </code></pre> <p>For further information, see <a href="http://ss64.com/nt/for_cmd.html" rel="noreferrer">http://ss64.com/nt/for_cmd.html</a></p> | 64, 7002 | batch-file, windows | <h1>How to create a folder with name as current date in batch (.bat) files</h1>
<p>I don't know much about windows .bat file syntax. My simple requirement is to create a folder at a specific location with name as current date. I tried searching this on google but didn't get any good option. Is there any way to do this?... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,871 | cmd | # How to create a folder with name as current date in batch (.bat) files
I don't know much about windows .bat file syntax. My simple requirement is to create a folder at a specific location with name as current date. I tried searching this on google but didn't get any good option. Is there any way to do this? | Try this (an equivalent of bash backquotes):
```
for /f "tokens=1* delims=" %%a in ('date /T') do set datestr=%%a
mkdir %datestr%
```
For further information, see <http://ss64.com/nt/for_cmd.html> |
11267309 | Importing zipped files in Mysql using command line | 43 | 2012-06-29 18:43:46 | <p><a href="https://stackoverflow.com/q/11258811/1488173">Importing zipped files in Mysql using CMD</a></p>
<p>What is the right syntax to import sql zipped files into mysql using cmd ?</p>
<p>I am doing the following</p>
<pre><code>xz < backup.sql.gz | mysql -u root test
</code></pre>
<p>But always getting the ... | 91,558 | 1,488,173 | 2024-12-07 03:42:24 | 12,154,202 | 21 | 2012-08-28 06:55:11 | 1,488,173 | 2014-06-23 13:48:33 | https://stackoverflow.com/q/11267309 | https://stackoverflow.com/a/12154202 | <p>I got the answer from my other question.
This is the command to import zipped file when you are using 7zip</p>
<blockquote>
<p>7z x -so backup.7z | mysql -u root test</p>
</blockquote>
<p>x is the extraction command</p>
<p><code>-so</code> option makes 7-zip write to stdout</p>
| <p>I got the answer from my other question. This is the command to import zipped file when you are using 7zip</p> <blockquote> <p>7z x -so backup.7z | mysql -u root test</p> </blockquote> <p>x is the extraction command</p> <p><code>-so</code> option makes 7-zip write to stdout</p> | 21, 30, 2631, 29470, 48840 | cmd, database, mysql, winzip, xz | <h1>Importing zipped files in Mysql using command line</h1>
<p><a href="https://stackoverflow.com/q/11258811/1488173">Importing zipped files in Mysql using CMD</a></p>
<p>What is the right syntax to import sql zipped files into mysql using cmd ?</p>
<p>I am doing the following</p>
<pre><code>xz < backup.sql.gz | ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,873 | cmd | # Importing zipped files in Mysql using command line
[Importing zipped files in Mysql using CMD](https://stackoverflow.com/q/11258811/1488173)
What is the right syntax to import sql zipped files into mysql using cmd ?
I am doing the following
```
xz < backup.sql.gz | mysql -u root test
```
But always getting the f... | I got the answer from my other question.
This is the command to import zipped file when you are using 7zip
> 7z x -so backup.7z | mysql -u root test
x is the extraction command
`-so` option makes 7-zip write to stdout |
19642622 | How do I echo ASCII art that contains special characters in a batch file? | 33 | 2013-10-28 18:41:38 | <p>So.. This is (to me anyway) the most important feature of this program. I need this to work. Please don't laugh.. (okay you can laugh) but when my program errors, I want it to display this:</p>
<pre><code> _ _,---._
,-',' `-.___
/-;' `._
/\/ ._ _,'o \
... | 92,899 | 2,863,294 | 2026-01-18 14:11:58 | 19,642,766 | 21 | 2013-10-28 18:50:12 | 575,199 | 2013-10-28 18:50:12 | https://stackoverflow.com/q/19642622 | https://stackoverflow.com/a/19642766 | <p>Store image in a file (doh.txt). Then <code>type doh.txt</code> in the batch file.</p>
| <p>Store image in a file (doh.txt). Then <code>type doh.txt</code> in the batch file.</p> | 2631, 2743, 4804, 7002, 20685 | ascii-art, batch-file, cmd, escaping, symbols | <h1>How do I echo ASCII art that contains special characters in a batch file?</h1>
<p>So.. This is (to me anyway) the most important feature of this program. I need this to work. Please don't laugh.. (okay you can laugh) but when my program errors, I want it to display this:</p>
<pre><code> _ _,---._
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,874 | cmd | # How do I echo ASCII art that contains special characters in a batch file?
So.. This is (to me anyway) the most important feature of this program. I need this to work. Please don't laugh.. (okay you can laugh) but when my program errors, I want it to display this:
```
_ _,---._
,-',' `-.___
... | Store image in a file (doh.txt). Then `type doh.txt` in the batch file. |
16244345 | Batch file to move files to another directory | 24 | 2013-04-26 20:03:08 | <p>I hope that you can help me with this one. It might have been asked multiple times already (I know that), but for some reason, I just can't have it working.</p>
<p>I want to move some files from the "files" directory to the root directory.</p>
<p>So the files are, for example:</p>
<pre><code>test1.txt test2.txt t... | 160,925 | 2,077,474 | 2020-05-23 18:46:49 | 16,244,577 | 21 | 2013-04-26 20:19:43 | 1,543,816 | 2013-04-26 21:10:19 | https://stackoverflow.com/q/16244345 | https://stackoverflow.com/a/16244577 | <p>/q isn't a valid parameter.
/y: Suppresses prompting to confirm overwriting </p>
<p>Also ..\txt means directory txt under the parent directory, not the root directory.
The root directory would be: \
And please mention the error you get</p>
<p>Try:</p>
<pre><code>move files\*.txt \
</code></pre>
<p>Edit:
Try:</p... | <p>/q isn't a valid parameter. /y: Suppresses prompting to confirm overwriting </p> <p>Also ..\txt means directory txt under the parent directory, not the root directory. The root directory would be: \ And please mention the error you get</p> <p>Try:</p> <pre><code>move files\*.txt \ </code></pre> <p>Edit: Try:</p... | 5310, 5634, 7002 | batch-file, file, move | <h1>Batch file to move files to another directory</h1>
<p>I hope that you can help me with this one. It might have been asked multiple times already (I know that), but for some reason, I just can't have it working.</p>
<p>I want to move some files from the "files" directory to the root directory.</p>
<p>So the files ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,875 | cmd | # Batch file to move files to another directory
I hope that you can help me with this one. It might have been asked multiple times already (I know that), but for some reason, I just can't have it working.
I want to move some files from the "files" directory to the root directory.
So the files are, for example:
```
... | /q isn't a valid parameter.
/y: Suppresses prompting to confirm overwriting
Also ..\txt means directory txt under the parent directory, not the root directory.
The root directory would be: \
And please mention the error you get
Try:
```
move files\*.txt \
```
Edit:
Try:
```
move \files\*.txt \
```
Edit 2:
```
mo... |
23420340 | Windows command prompt: Using a variable set in the same line of a one-liner | 22 | 2014-05-02 03:41:43 | <p>Okay, I learned that one can use <code>&</code> or <code>&&</code> to combine multiple commands into a single line, but it seems that variables that are <code>set</code> aren't actually available for interpolation in the same line:</p>
<pre><code>C:\Users\Andrew>set foo=hello, world!&& echo %f... | 11,822 | 925,913 | 2022-03-31 10:43:25 | 23,421,825 | 21 | 2014-05-02 06:06:53 | 463,115 | 2017-10-25 13:17:43 | https://stackoverflow.com/q/23420340 | https://stackoverflow.com/a/23421825 | <p>You can do it in the same line, but I would recommend to use a batch file like <em>preHook.bat</em>. </p>
<p>As one liner </p>
<pre><code>set "mu=hello, world!" && call echo %^mu%
</code></pre>
<p>At first you can see that the quotes are different than yours.</p>
<hr>
<p>Here's why:</p>
<pre><code>set... | <p>You can do it in the same line, but I would recommend to use a batch file like <em>preHook.bat</em>. </p> <p>As one liner </p> <pre><code>set "mu=hello, world!" && call echo %^mu% </code></pre> <p>At first you can see that the quotes are different than yours.</p> <hr> <p>Here's why:</p> <pre><code>set... | 64, 367, 2631, 7002, 34595 | batch-file, cmd, syntax, windows, windows-7 | <h1>Windows command prompt: Using a variable set in the same line of a one-liner</h1>
<p>Okay, I learned that one can use <code>&</code> or <code>&&</code> to combine multiple commands into a single line, but it seems that variables that are <code>set</code> aren't actually available for interpolation in th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,876 | cmd | # Windows command prompt: Using a variable set in the same line of a one-liner
Okay, I learned that one can use `&` or `&&` to combine multiple commands into a single line, but it seems that variables that are `set` aren't actually available for interpolation in the same line:
```
C:\Users\Andrew>set foo=hello, world... | You can do it in the same line, but I would recommend to use a batch file like *preHook.bat*.
As one liner
```
set "mu=hello, world!" && call echo %^mu%
```
At first you can see that the quotes are different than yours.
---
Here's why:
```
set test1="quotes"
set "test2=no quotes" with comment
```
In the first te... |
11549235 | Nested IF ( IF ( ... ) ELSE( .. ) ) statement in batch | 22 | 2012-07-18 19:55:07 | <p>I'm trying to write an <code>IF ELSE</code> statement nested inside another <code>IF</code> statement. Here's what I have:</p>
<pre><code>IF %dirdive%==1 (
IF DEFINED log (
ECHO %DATE%, %TIME% >> %log%
FOR /R %root1% %%G IN (.) DO (
SET _G=%%G
CALL :TESTEVERYTHING !... | 77,440 | 1,454,613 | 2024-05-11 04:07:29 | 11,549,975 | 21 | 2012-07-18 20:41:31 | 1,012,053 | 2012-07-18 21:01:10 | https://stackoverflow.com/q/11549235 | https://stackoverflow.com/a/11549975 | <p>The source of your problem is that even if a branch of an IF statement does not execute, it still must have valid syntax.</p>
<p>When <code>log</code> is not defined, then the following line</p>
<pre><code>ECHO %DATE%, %TIME% >> %log%
</code></pre>
<p>expands to the following when <code>log</code> is undefi... | <p>The source of your problem is that even if a branch of an IF statement does not execute, it still must have valid syntax.</p> <p>When <code>log</code> is not defined, then the following line</p> <pre><code>ECHO %DATE%, %TIME% >> %log% </code></pre> <p>expands to the following when <code>log</code> is undefi... | 7002 | batch-file | <h1>Nested IF ( IF ( ... ) ELSE( .. ) ) statement in batch</h1>
<p>I'm trying to write an <code>IF ELSE</code> statement nested inside another <code>IF</code> statement. Here's what I have:</p>
<pre><code>IF %dirdive%==1 (
IF DEFINED log (
ECHO %DATE%, %TIME% >> %log%
FOR /R %root1% %%G IN (.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,877 | cmd | # Nested IF ( IF ( ... ) ELSE( .. ) ) statement in batch
I'm trying to write an `IF ELSE` statement nested inside another `IF` statement. Here's what I have:
```
IF %dirdive%==1 (
IF DEFINED log (
ECHO %DATE%, %TIME% >> %log%
FOR /R %root1% %%G IN (.) DO (
SET _G=%%G
CALL ... | The source of your problem is that even if a branch of an IF statement does not execute, it still must have valid syntax.
When `log` is not defined, then the following line
```
ECHO %DATE%, %TIME% >> %log%
```
expands to the following when `log` is undefined
```
ECHO someDate, someTime >>
```
There is no file name... |
518228 | Is it possible to add a directory to DLL search path from a batch file or cmd script? | 22 | 2009-02-05 22:16:23 | <p>MSDN says that the function <a href="http://msdn.microsoft.com/en-us/library/ms686203.aspx" rel="noreferrer">SetDllDirectory()</a> can be used to insert a directory into the <a href="http://msdn.microsoft.com/en-us/library/ms682586.aspx" rel="noreferrer">DLL Search Path</a>. Can this function be accessed from a batc... | 76,354 | 14,420 | 2022-10-01 13:38:02 | 518,289 | 21 | 2009-02-05 22:33:33 | 22,290 | 2022-10-01 13:38:02 | https://stackoverflow.com/q/518228 | https://stackoverflow.com/a/518289 | <p>You can place the DLL in the same path as the executable, which is searched first before <code>%WINDIR%</code>. There's no way to call <code>SetDllDirectory</code> from a batch file directly.</p>
<p>But, you can insert your DLL directory in the <code>%PATH%</code> variable, and Windows will then find the DLL there.<... | <p>You can place the DLL in the same path as the executable, which is searched first before <code>%WINDIR%</code>. There's no way to call <code>SetDllDirectory</code> from a batch file directly.</p> <p>But, you can insert your DLL directory in the <code>%PATH%</code> variable, and Windows will then find the DLL there.<... | 457, 2631, 6701, 7002 | batch-file, cmd, dll, wsh | <h1>Is it possible to add a directory to DLL search path from a batch file or cmd script?</h1>
<p>MSDN says that the function <a href="http://msdn.microsoft.com/en-us/library/ms686203.aspx" rel="noreferrer">SetDllDirectory()</a> can be used to insert a directory into the <a href="http://msdn.microsoft.com/en-us/library... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,878 | cmd | # Is it possible to add a directory to DLL search path from a batch file or cmd script?
MSDN says that the function [SetDllDirectory()](http://msdn.microsoft.com/en-us/library/ms686203.aspx) can be used to insert a directory into the [DLL Search Path](http://msdn.microsoft.com/en-us/library/ms682586.aspx). Can this fu... | You can place the DLL in the same path as the executable, which is searched first before `%WINDIR%`. There's no way to call `SetDllDirectory` from a batch file directly.
But, you can insert your DLL directory in the `%PATH%` variable, and Windows will then find the DLL there.
```
set PATH=C:\path to your dll;%PATH%
`... |
42298177 | Docker container with entrypoint variable expansion and CMD parameters | 20 | 2017-02-17 12:37:32 | <p>I want to create a Docker Image that acts as an executable for which the user passes a token as an environment variable. The executable has sub commands that the user should pass via dockers CMD (think of git with authentication via Env).
However, Docker does not append the CMD to the entrypoint.
The relevant part o... | 12,456 | 1,747,457 | 2024-04-17 17:28:14 | 42,332,740 | 21 | 2017-02-19 20:53:22 | 596,285 | 2017-02-23 14:34:20 | https://stackoverflow.com/q/42298177 | https://stackoverflow.com/a/42332740 | <p>With <code>/bin/sh -c "script"</code> syntax, anything after the <code>-c</code> argument becomes an argument to your script. You can reach them with <code>$0</code> and <code>$@</code> as part of your /bin/sh script:</p>
<pre><code>ENTRYPOINT ["/bin/sh", "-c", "exec /usr/bin/mycmd --token=$MY_TOKEN $0 $@"]
CMD ["p... | <p>With <code>/bin/sh -c "script"</code> syntax, anything after the <code>-c</code> argument becomes an argument to your script. You can reach them with <code>$0</code> and <code>$@</code> as part of your /bin/sh script:</p> <pre><code>ENTRYPOINT ["/bin/sh", "-c", "exec /usr/bin/mycmd --token=$MY_TOKEN $0 $@"] CMD ["p... | 90304, 108477, 115133, 118567, 164539 | docker, docker-cmd, docker-container, dockerfile, docker-image | <h1>Docker container with entrypoint variable expansion and CMD parameters</h1>
<p>I want to create a Docker Image that acts as an executable for which the user passes a token as an environment variable. The executable has sub commands that the user should pass via dockers CMD (think of git with authentication via Env)... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,879 | cmd | # Docker container with entrypoint variable expansion and CMD parameters
I want to create a Docker Image that acts as an executable for which the user passes a token as an environment variable. The executable has sub commands that the user should pass via dockers CMD (think of git with authentication via Env).
However... | With `/bin/sh -c "script"` syntax, anything after the `-c` argument becomes an argument to your script. You can reach them with `$0` and `$@` as part of your /bin/sh script:
```
ENTRYPOINT ["/bin/sh", "-c", "exec /usr/bin/mycmd --token=$MY_TOKEN $0 $@"]
CMD ["pull", "stuff"]
```
Note that you could also change your e... |
26509971 | Spring batch jpaPagingItemReader why some rows are not read? | 19 | 2014-10-22 14:31:17 | <p>I 'm using Spring Batch(3.0.1.RELEASE) / JPA and an HSQLBD server database.
I need to browse an entire table (using paging) and update items (one by one). So I used a jpaPagingItemReader. But when I run the job I can see that some rows are skipped, and the number of skipped rows is equal to the page size. For i.e.... | 44,631 | 2,111,572 | 2023-01-03 17:40:44 | 26,545,593 | 21 | 2014-10-24 09:51:28 | 1,643,132 | 2021-09-22 16:02:38 | https://stackoverflow.com/q/26509971 | https://stackoverflow.com/a/26545593 | <p><code>org.springframework.batch.item.database.JpaPagingItemReader</code> creates is own <code>entityManager</code> instance</p>
<p>(from <code>org.springframework.batch.item.database.JpaPagingItemReader#doOpen</code>) :</p>
<pre><code>entityManager = entityManagerFactory.createEntityManager(jpaPropertyMap);
</code><... | <p><code>org.springframework.batch.item.database.JpaPagingItemReader</code> creates is own <code>entityManager</code> instance</p> <p>(from <code>org.springframework.batch.item.database.JpaPagingItemReader#doOpen</code>) :</p> <pre><code>entityManager = entityManagerFactory.createEntityManager(jpaPropertyMap); </code><... | 2990, 41895 | jpa, spring-batch | <h1>Spring batch jpaPagingItemReader why some rows are not read?</h1>
<p>I 'm using Spring Batch(3.0.1.RELEASE) / JPA and an HSQLBD server database.
I need to browse an entire table (using paging) and update items (one by one). So I used a jpaPagingItemReader. But when I run the job I can see that some rows are skippe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,881 | cmd | # Spring batch jpaPagingItemReader why some rows are not read?
I 'm using Spring Batch(3.0.1.RELEASE) / JPA and an HSQLBD server database.
I need to browse an entire table (using paging) and update items (one by one). So I used a jpaPagingItemReader. But when I run the job I can see that some rows are skipped, and the... | `org.springframework.batch.item.database.JpaPagingItemReader` creates is own `entityManager` instance
(from `org.springframework.batch.item.database.JpaPagingItemReader#doOpen`) :
```
entityManager = entityManagerFactory.createEntityManager(jpaPropertyMap);
```
If you are within a transaction, as it seems to be, rea... |
13727125 | How to clear variables after each batch script run? | 19 | 2012-12-05 15:51:45 | <p>It seems that since I use SET to declare my variables in batch script, if I run it multiple times in cmd, the variable value will persist unless I explicitly reset them. </p>
<p>Do I have to use setlocal and endlocal to make sure the variables from one run doesn't persist over to another, without shutting down the ... | 37,792 | 465,448 | 2012-12-05 16:52:33 | 13,728,288 | 21 | 2012-12-05 16:52:33 | 1,012,053 | 2012-12-05 16:52:33 | https://stackoverflow.com/q/13727125 | https://stackoverflow.com/a/13728288 | <p>Yes, you should use SETLOCAL. That will localize any changes such that the old environment will be restored once ENDLOCAL is issued.</p>
<p>When all script processing finishes and you are returned to a command line context, there is an implicit ENDLOCAL issued for every active SETLOCAL. There is no need to explicit... | <p>Yes, you should use SETLOCAL. That will localize any changes such that the old environment will be restored once ENDLOCAL is issued.</p> <p>When all script processing finishes and you are returned to a command line context, there is an implicit ENDLOCAL issued for every active SETLOCAL. There is no need to explicit... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>How to clear variables after each batch script run?</h1>
<p>It seems that since I use SET to declare my variables in batch script, if I run it multiple times in cmd, the variable value will persist unless I explicitly reset them. </p>
<p>Do I have to use setlocal and endlocal to make sure the variables from one ru... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,882 | cmd | # How to clear variables after each batch script run?
It seems that since I use SET to declare my variables in batch script, if I run it multiple times in cmd, the variable value will persist unless I explicitly reset them.
Do I have to use setlocal and endlocal to make sure the variables from one run doesn't persist... | Yes, you should use SETLOCAL. That will localize any changes such that the old environment will be restored once ENDLOCAL is issued.
When all script processing finishes and you are returned to a command line context, there is an implicit ENDLOCAL issued for every active SETLOCAL. There is no need to explicitly issue E... |
10823033 | Sending arguments from Batch file to Python script | 18 | 2012-05-30 19:34:05 | <p>I'm running Python 3.2 on Win XP. I run a python script thru a batch file via this:</p>
<p><code>C:\Python32\python.exe test.py %1</code></p>
<p><code>%1</code> is an argument that i pass to do some processing in the python script. </p>
<p>I have 2 variables in the batch file that I also want to send as arguments... | 66,792 | 530,955 | 2021-09-16 03:59:14 | 10,823,125 | 21 | 2012-05-30 19:41:09 | 63,147 | 2012-05-30 19:52:40 | https://stackoverflow.com/q/10823033 | https://stackoverflow.com/a/10823125 | <p>your_script.bat:</p>
<pre><code>set VAR_1=this
set VAR_2=that
python your_script.py %1 %VAR_1% %VAR_2%
</code></pre>
| <p>your_script.bat:</p> <pre><code>set VAR_1=this set VAR_2=that python your_script.py %1 %VAR_1% %VAR_2% </code></pre> | 16, 2216, 7002 | batch-file, python, windows-xp | <h1>Sending arguments from Batch file to Python script</h1>
<p>I'm running Python 3.2 on Win XP. I run a python script thru a batch file via this:</p>
<p><code>C:\Python32\python.exe test.py %1</code></p>
<p><code>%1</code> is an argument that i pass to do some processing in the python script. </p>
<p>I have 2 varia... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,883 | cmd | # Sending arguments from Batch file to Python script
I'm running Python 3.2 on Win XP. I run a python script thru a batch file via this:
`C:\Python32\python.exe test.py %1`
`%1` is an argument that i pass to do some processing in the python script.
I have 2 variables in the batch file that I also want to send as ar... | your_script.bat:
```
set VAR_1=this
set VAR_2=that
python your_script.py %1 %VAR_1% %VAR_2%
``` |
8493493 | How to loop through tokens in a string? | 18 | 2011-12-13 17:29:05 | <p>Say I have a string such as foo:bar:baz, is it possible to loop through this string? It looked like you could tokenize lines of a file but the following will only echo 'foo' once. </p>
<p><code>for /f "tokens=1,2* delims=:" %%x in ("%%j") do echo %%x</code></p>
| 37,616 | 503,945 | 2014-06-23 15:22:02 | 8,493,916 | 21 | 2011-12-13 18:02:07 | 778,560 | 2011-12-13 18:07:36 | https://stackoverflow.com/q/8493493 | https://stackoverflow.com/a/8493916 | <pre><code>set string=foo:bar:baz
for %%x in (%string::= %) do echo %%x
</code></pre>
<p>FOR value delimiters may be space, comma, semicolon and equal-sign. You may directly process a string if the elements are delimited with any of these characters. If not, just change the delimiter for one of these character (as I d... | <pre><code>set string=foo:bar:baz for %%x in (%string::= %) do echo %%x </code></pre> <p>FOR value delimiters may be space, comma, semicolon and equal-sign. You may directly process a string if the elements are delimited with any of these characters. If not, just change the delimiter for one of these character (as I d... | 7002 | batch-file | <h1>How to loop through tokens in a string?</h1>
<p>Say I have a string such as foo:bar:baz, is it possible to loop through this string? It looked like you could tokenize lines of a file but the following will only echo 'foo' once. </p>
<p><code>for /f "tokens=1,2* delims=:" %%x in ("%%j") do echo %%x</code></p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,884 | cmd | # How to loop through tokens in a string?
Say I have a string such as foo:bar:baz, is it possible to loop through this string? It looked like you could tokenize lines of a file but the following will only echo 'foo' once.
`for /f "tokens=1,2* delims=:" %%x in ("%%j") do echo %%x` | ```
set string=foo:bar:baz
for %%x in (%string::= %) do echo %%x
```
FOR value delimiters may be space, comma, semicolon and equal-sign. You may directly process a string if the elements are delimited with any of these characters. If not, just change the delimiter for one of these character (as I did above).
```
set ... |
8145744 | How to Invoke a parameter in a batch file with comma-delimiter | 17 | 2011-11-16 02:04:09 | <p>I want to invoke a batch file with a comma-delimited paramater. How can I achieved this? </p>
<p>I want it like this example.</p>
<p>I have a text.bat with the script:</p>
<pre><code>@echo off
set test=%1
echo Sample %test% batch.
</code></pre>
<p>I want to run the batch like this:</p>
<pre><code>c:\text.bat t... | 18,347 | 956,702 | 2011-11-16 02:35:14 | 8,145,920 | 21 | 2011-11-16 02:31:19 | 740,923 | 2011-11-16 02:31:19 | https://stackoverflow.com/q/8145744 | https://stackoverflow.com/a/8145920 | <p>Wow! I didn't know commas behaved that way.</p>
<p>You have two options.</p>
<p>You can use this script:</p>
<pre><code>@echo off
set test=%~1
echo Sample %test% batch.
</code></pre>
<p>And run it with:</p>
<pre><code>C:\text.bat "this,is,test"
</code></pre>
<p>The <code>%~1</code> represents the first argume... | <p>Wow! I didn't know commas behaved that way.</p> <p>You have two options.</p> <p>You can use this script:</p> <pre><code>@echo off set test=%~1 echo Sample %test% batch. </code></pre> <p>And run it with:</p> <pre><code>C:\text.bat "this,is,test" </code></pre> <p>The <code>%~1</code> represents the first argume... | 7002 | batch-file | <h1>How to Invoke a parameter in a batch file with comma-delimiter</h1>
<p>I want to invoke a batch file with a comma-delimited paramater. How can I achieved this? </p>
<p>I want it like this example.</p>
<p>I have a text.bat with the script:</p>
<pre><code>@echo off
set test=%1
echo Sample %test% batch.
</code></p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,885 | cmd | # How to Invoke a parameter in a batch file with comma-delimiter
I want to invoke a batch file with a comma-delimited paramater. How can I achieved this?
I want it like this example.
I have a text.bat with the script:
```
@echo off
set test=%1
echo Sample %test% batch.
```
I want to run the batch like this:
```
c... | Wow! I didn't know commas behaved that way.
You have two options.
You can use this script:
```
@echo off
set test=%~1
echo Sample %test% batch.
```
And run it with:
```
C:\text.bat "this,is,test"
```
The `%~1` represents the first argument without quotes. The quotes group the comma-delimited list as a single argu... |
3934619 | Conditional PAUSE (not in command line) | 17 | 2010-10-14 15:04:28 | <p>I like to have a final <code>PAUSE</code> in my *.bat scripts so I can just double click on them in Windows explorer and have the chance to read the output. However, the final PAUSE is an annoyance when I run the same script from the command line.</p>
<p>Is there any way to detect whether we are running the script ... | 17,767 | 13,508 | 2015-12-10 18:27:32 | 3,938,027 | 21 | 2010-10-14 22:13:23 | 3,501 | 2015-12-10 18:27:32 | https://stackoverflow.com/q/3934619 | https://stackoverflow.com/a/3938027 | <pre><code>@echo off
echo.Hello World
(((echo.%cmdcmdline%)|find /I "%~0")>nul)&&pause
</code></pre>
<p>...NT+ only, no %cmdcmdline% in Win9x probably.</p>
<p>As pointed out by E M in the comments, putting all of this on one line opens you up to some edge cases where %cmdcmdline% will escape out of the par... | <pre><code>@echo off echo.Hello World (((echo.%cmdcmdline%)|find /I "%~0")>nul)&&pause </code></pre> <p>...NT+ only, no %cmdcmdline% in Win9x probably.</p> <p>As pointed out by E M in the comments, putting all of this on one line opens you up to some edge cases where %cmdcmdline% will escape out of the par... | 7002 | batch-file | <h1>Conditional PAUSE (not in command line)</h1>
<p>I like to have a final <code>PAUSE</code> in my *.bat scripts so I can just double click on them in Windows explorer and have the chance to read the output. However, the final PAUSE is an annoyance when I run the same script from the command line.</p>
<p>Is there any... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,886 | cmd | # Conditional PAUSE (not in command line)
I like to have a final `PAUSE` in my *.bat scripts so I can just double click on them in Windows explorer and have the chance to read the output. However, the final PAUSE is an annoyance when I run the same script from the command line.
Is there any way to detect whether we a... | ```
@echo off
echo.Hello World
(((echo.%cmdcmdline%)|find /I "%~0")>nul)&&pause
```
...NT+ only, no %cmdcmdline% in Win9x probably.
As pointed out by E M in the comments, putting all of this on one line opens you up to some edge cases where %cmdcmdline% will escape out of the parenthesis. The workaround is to use two... |
1106040 | How to make Notepad++ run script based on its name? | 17 | 2009-07-09 19:40:33 | <p>I want to make notepad++ run the "ruby {filename_here}" command if the current filename ends with .rb and "perl {filename_here}" if it ends with .pl. I've tried to use the NppExec plugin, but it can't do conditional stuff, so I wrote a bat</p>
<pre><code>@echo off
if /i %~sx1 == .pl perl "%~f1"
if /i %~sx1 == .rb... | 36,257 | 123,927 | 2017-12-21 00:28:15 | 1,224,979 | 21 | 2009-08-03 22:44:58 | 103,043 | 2017-12-21 00:28:15 | https://stackoverflow.com/q/1106040 | https://stackoverflow.com/a/1224979 | <p>You need to put the file name at the end of the command.
In the Run(F5) dialog, try this:</p>
<pre><code>runscript $(FULL_CURRENT_PATH)
</code></pre>
<p>If you want to test it out, you could put a <code>& pause</code> at the end, just to see if it worked.</p>
<p>You could also tweak your script a bit so that ... | <p>You need to put the file name at the end of the command. In the Run(F5) dialog, try this:</p> <pre><code>runscript $(FULL_CURRENT_PATH) </code></pre> <p>If you want to test it out, you could put a <code>& pause</code> at the end, just to see if it worked.</p> <p>You could also tweak your script a bit so that ... | 2631, 8193 | cmd, notepad++ | <h1>How to make Notepad++ run script based on its name?</h1>
<p>I want to make notepad++ run the "ruby {filename_here}" command if the current filename ends with .rb and "perl {filename_here}" if it ends with .pl. I've tried to use the NppExec plugin, but it can't do conditional stuff, so I wrote a bat</p>
<pre><code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,888 | cmd | # How to make Notepad++ run script based on its name?
I want to make notepad++ run the "ruby {filename_here}" command if the current filename ends with .rb and "perl {filename_here}" if it ends with .pl. I've tried to use the NppExec plugin, but it can't do conditional stuff, so I wrote a bat
```
@echo off
if /i %~s... | You need to put the file name at the end of the command.
In the Run(F5) dialog, try this:
```
runscript $(FULL_CURRENT_PATH)
```
If you want to test it out, you could put a `& pause` at the end, just to see if it worked.
You could also tweak your script a bit so that every file doesn't test for each extension, by us... |
2457406 | How do you enter something at a console prompt programmatically? | 16 | 2010-03-16 19:21:54 | <p>I have program, that must interact with a console program before my program can continue what it is doing. I'm trying to avoid my user from having to interact with this dos program. So, I created a <code>.bat</code> file that does everything I need to do except for the last step which still requires user interaction... | 29,165 | 217,867 | 2022-01-27 10:03:44 | 2,457,428 | 21 | 2010-03-16 19:25:57 | 99,492 | 2010-03-17 00:16:32 | https://stackoverflow.com/q/2457406 | https://stackoverflow.com/a/2457428 | <p>You can pipe in a 'y' character into the program like so:</p>
<pre><code>echo y | executable.exe
</code></pre>
<p>Multiple lines can be entered like so:</p>
<pre><code>(echo y
echo n) | executable.exe
</code></pre>
<p>...which will pass first 'y' then 'n'.</p>
<p>See tip from <a href="http://support.microsoft.c... | <p>You can pipe in a 'y' character into the program like so:</p> <pre><code>echo y | executable.exe </code></pre> <p>Multiple lines can be entered like so:</p> <pre><code>(echo y echo n) | executable.exe </code></pre> <p>...which will pass first 'y' then 'n'.</p> <p>See tip from <a href="http://support.microsoft.c... | 7002 | batch-file | <h1>How do you enter something at a console prompt programmatically?</h1>
<p>I have program, that must interact with a console program before my program can continue what it is doing. I'm trying to avoid my user from having to interact with this dos program. So, I created a <code>.bat</code> file that does everything I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,889 | cmd | # How do you enter something at a console prompt programmatically?
I have program, that must interact with a console program before my program can continue what it is doing. I'm trying to avoid my user from having to interact with this dos program. So, I created a `.bat` file that does everything I need to do except f... | You can pipe in a 'y' character into the program like so:
```
echo y | executable.exe
```
Multiple lines can be entered like so:
```
(echo y
echo n) | executable.exe
```
...which will pass first 'y' then 'n'.
See tip from [Microsoft here](http://support.microsoft.com/kb/135268). |
41462284 | PhpStorm - run terminal (cmd) as administrator | 15 | 2017-01-04 11:04:44 | <p>On Windows it's easy to run <code>cmd</code> application as administrator: </p>
<pre><code>Right click on cmd icon >> run as administrator`
</code></pre>
<p>But I would like to use <code>PhpStorm terminal</code> tool as administrator since I constantly have to execute queries that require administrator role.... | 13,002 | 2,333,299 | 2023-07-01 21:03:00 | 41,462,525 | 21 | 2017-01-04 11:18:02 | 783,119 | 2023-07-01 21:03:00 | https://stackoverflow.com/q/41462284 | https://stackoverflow.com/a/41462525 | <p>There are no options in the IDE for running the shell (<code>cmd.exe</code>, <code>powershell.exe</code> etc.) with higher rights at the moment.</p>
<p><a href="https://youtrack.jetbrains.com/issue/IDEA-121335" rel="nofollow noreferrer">https://youtrack.jetbrains.com/issue/IDEA-121335</a> -- watch this ticket (star... | <p>There are no options in the IDE for running the shell (<code>cmd.exe</code>, <code>powershell.exe</code> etc.) with higher rights at the moment.</p> <p><a href="https://youtrack.jetbrains.com/issue/IDEA-121335" rel="nofollow noreferrer">https://youtrack.jetbrains.com/issue/IDEA-121335</a> -- watch this ticket (star... | 391, 2631, 5623, 66821 | administrator, cmd, phpstorm, terminal | <h1>PhpStorm - run terminal (cmd) as administrator</h1>
<p>On Windows it's easy to run <code>cmd</code> application as administrator: </p>
<pre><code>Right click on cmd icon >> run as administrator`
</code></pre>
<p>But I would like to use <code>PhpStorm terminal</code> tool as administrator since I constantly ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,890 | cmd | # PhpStorm - run terminal (cmd) as administrator
On Windows it's easy to run `cmd` application as administrator:
```
Right click on cmd icon >> run as administrator`
```
But I would like to use `PhpStorm terminal` tool as administrator since I constantly have to execute queries that require administrator role.
When... | There are no options in the IDE for running the shell (`cmd.exe`, `powershell.exe` etc.) with higher rights at the moment.
<https://youtrack.jetbrains.com/issue/IDEA-121335> -- watch this ticket (star/vote/comment) to get notified on any progress. Maybe someone will post some possible workarounds there...
---
**Your... |
30651776 | xcopy returns error "Invalid number of parameters" when exclude parameter is set | 15 | 2015-06-04 18:47:04 | <p>Issuing:</p>
<pre><code>xcopy X:\ "Y:\...\bin\9876543210\" /c /g /d /i /e /r /h /y
</code></pre>
<p>works as expected. However:</p>
<pre><code>xcopy X:\ "Y:\...\bin\9876543210\" /c /g /d /i /e /r /h /y /exclude:"Y:\...\exclude.txt"
</code></pre>
<p>returns error:</p>
<blockquote>
<p>Invalid number of paramete... | 115,262 | 4,157,124 | 2023-11-17 16:26:25 | 30,652,934 | 21 | 2015-06-04 19:52:24 | 1,012,053 | 2015-06-04 19:52:24 | https://stackoverflow.com/q/30651776 | https://stackoverflow.com/a/30652934 | <p>XCOPY is an old command harking back to the days of DOS. It looks like the /EXCLUDE option was never updated to support long file names. Ugh :-(</p>
<p>If you remove the quotes, then the text after the space is interpreted as an additional parameter, and you get the "Invalid number of parameters" error. If you keep... | <p>XCOPY is an old command harking back to the days of DOS. It looks like the /EXCLUDE option was never updated to support long file names. Ugh :-(</p> <p>If you remove the quotes, then the text after the space is interpreted as an additional parameter, and you get the "Invalid number of parameters" error. If you keep... | 64, 2631, 4710, 7002 | batch-file, cmd, windows, xcopy | <h1>xcopy returns error "Invalid number of parameters" when exclude parameter is set</h1>
<p>Issuing:</p>
<pre><code>xcopy X:\ "Y:\...\bin\9876543210\" /c /g /d /i /e /r /h /y
</code></pre>
<p>works as expected. However:</p>
<pre><code>xcopy X:\ "Y:\...\bin\9876543210\" /c /g /d /i /e /r /h /y /exclude:"Y:\...\exclu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,891 | cmd | # xcopy returns error "Invalid number of parameters" when exclude parameter is set
Issuing:
```
xcopy X:\ "Y:\...\bin\9876543210\" /c /g /d /i /e /r /h /y
```
works as expected. However:
```
xcopy X:\ "Y:\...\bin\9876543210\" /c /g /d /i /e /r /h /y /exclude:"Y:\...\exclude.txt"
```
returns error:
> Invalid numbe... | XCOPY is an old command harking back to the days of DOS. It looks like the /EXCLUDE option was never updated to support long file names. Ugh :-(
If you remove the quotes, then the text after the space is interpreted as an additional parameter, and you get the "Invalid number of parameters" error. If you keep the quote... |
26202241 | How to write a spring batch step without an itemwriter | 14 | 2014-10-05 11:35:59 | <p>I am trying to configure a spring batch step without an item writer using below configuraion. However i get error saying that writer
element has neither a 'writer' attribute nor a element.</p>
<p>I went through the link <a href="https://stackoverflow.com/questions/17191889/spring-batch-tasklet-without-itemwriter"... | 45,919 | 3,247,376 | 2023-09-14 09:10:24 | 26,205,749 | 21 | 2014-10-05 18:16:21 | 2,587,166 | 2023-09-14 09:10:24 | https://stackoverflow.com/q/26202241 | https://stackoverflow.com/a/26205749 | <p>For chunk-based step reader and writer are mandatory.<br/>
If you don't want a writer use a No-operation ItemWriter that does nothing.</p>
<p>EDIT:<br/>
A no-op implementation is an empty implementation of interface that does...nothing!<br/>
Just let your class implement desirable inteface(s) with empty methods.<br/... | <p>For chunk-based step reader and writer are mandatory.<br/> If you don't want a writer use a No-operation ItemWriter that does nothing.</p> <p>EDIT:<br/> A no-op implementation is an empty implementation of interface that does...nothing!<br/> Just let your class implement desirable inteface(s) with empty methods.<br/... | 1211, 41895 | spring, spring-batch | <h1>How to write a spring batch step without an itemwriter</h1>
<p>I am trying to configure a spring batch step without an item writer using below configuraion. However i get error saying that writer
element has neither a 'writer' attribute nor a element.</p>
<p>I went through the link <a href="https://stackoverflow... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,893 | cmd | # How to write a spring batch step without an itemwriter
I am trying to configure a spring batch step without an item writer using below configuraion. However i get error saying that writer
element has neither a 'writer' attribute nor a element.
I went through the link [spring batch : Tasklet without ItemWriter](http... | For chunk-based step reader and writer are mandatory.
If you don't want a writer use a No-operation ItemWriter that does nothing.
EDIT:
A no-op implementation is an empty implementation of interface that does...nothing!
Just let your class implement desirable inteface(s) with empty methods.
No-op ItemWriter:
`... |
3732947 | Batch To Remove Character From A String | 14 | 2010-09-17 05:57:41 | <p>this may seem basic but Is there a way to create a batch to remove char from a string from a txt file. ?</p>
<p>If I already have this inside the .txt file</p>
<pre><code>2005060.png
2005070.png
2005080.png
2005090.png
</code></pre>
<p>so is there a way to create a batch file that will remove the .png at th... | 74,113 | 448,571 | 2012-12-19 09:21:00 | 3,733,006 | 21 | 2010-09-17 06:10:46 | 14,860 | 2010-09-17 06:22:51 | https://stackoverflow.com/q/3732947 | https://stackoverflow.com/a/3733006 | <p>You can do it as per the following command script:</p>
<pre><code>@setlocal enableextensions enabledelayedexpansion
@echo off
set variable=2005060.png
echo !variable!
if "x!variable:~-4!"=="x.png" (
set variable=!variable:~0,-4!
)
echo !variable!
endlocal
</code></pre>
<p>This outputs:</p>
<pre><code>2005060.... | <p>You can do it as per the following command script:</p> <pre><code>@setlocal enableextensions enabledelayedexpansion @echo off set variable=2005060.png echo !variable! if "x!variable:~-4!"=="x.png" ( set variable=!variable:~0,-4! ) echo !variable! endlocal </code></pre> <p>This outputs:</p> <pre><code>2005060.... | 7002 | batch-file | <h1>Batch To Remove Character From A String</h1>
<p>this may seem basic but Is there a way to create a batch to remove char from a string from a txt file. ?</p>
<p>If I already have this inside the .txt file</p>
<pre><code>2005060.png
2005070.png
2005080.png
2005090.png
</code></pre>
<p>so is there a way to cr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,894 | cmd | # Batch To Remove Character From A String
this may seem basic but Is there a way to create a batch to remove char from a string from a txt file. ?
If I already have this inside the .txt file
```
2005060.png
2005070.png
2005080.png
2005090.png
```
so is there a way to create a batch file that will remove the .... | You can do it as per the following command script:
```
@setlocal enableextensions enabledelayedexpansion
@echo off
set variable=2005060.png
echo !variable!
if "x!variable:~-4!"=="x.png" (
set variable=!variable:~0,-4!
)
echo !variable!
endlocal
```
This outputs:
```
2005060.png
2005060
```
The magic line, of co... |
36334228 | How to solve this CollectionView crash? | 13 | 2016-03-31 12:59:15 | <p>My app has two <code>CollectionViewController</code>s. Only one is visible at a given time.</p>
<p>I have created the following structure on storyboard: two container views on top of each other. Every container view has a <code>CollectionViewController</code> embedded. The visibility of a particular container view ... | 13,734 | 316,469 | 2016-05-25 09:50:32 | 37,323,733 | 21 | 2016-05-19 12:50:03 | 1,393,275 | 2016-05-19 12:50:03 | https://stackoverflow.com/q/36334228 | https://stackoverflow.com/a/37323733 | <p>For me adding <code>self.collectionView.numberOfItemsInSection(0)</code> fixed the crash.
The collectionView has issues while inserting items when it is not visible.</p>
<p>Seems like I'm not alone with my solution: <a href="http://www.openradar.me/15262692" rel="noreferrer">http://www.openradar.me/15262692</a></p>... | <p>For me adding <code>self.collectionView.numberOfItemsInSection(0)</code> fixed the crash. The collectionView has issues while inserting items when it is not visible.</p> <p>Seems like I'm not alone with my solution: <a href="http://www.openradar.me/15262692" rel="noreferrer">http://www.openradar.me/15262692</a></p>... | 154, 58338, 84213, 118855 | ios, iphone, performbatchupdates, uicollectionview | <h1>How to solve this CollectionView crash?</h1>
<p>My app has two <code>CollectionViewController</code>s. Only one is visible at a given time.</p>
<p>I have created the following structure on storyboard: two container views on top of each other. Every container view has a <code>CollectionViewController</code> embedde... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,895 | cmd | # How to solve this CollectionView crash?
My app has two `CollectionViewController`s. Only one is visible at a given time.
I have created the following structure on storyboard: two container views on top of each other. Every container view has a `CollectionViewController` embedded. The visibility of a particular cont... | For me adding `self.collectionView.numberOfItemsInSection(0)` fixed the crash.
The collectionView has issues while inserting items when it is not visible.
Seems like I'm not alone with my solution: <http://www.openradar.me/15262692> |
11575386 | Foo.cmd won't output lines in process (on website) | 13 | 2012-07-20 08:10:08 | <p>I've a problem understanding the in's and out's of the ProcessStartInfo class in .NET.
I use this class for executing .exe programs like FFmpeg with no issues whatsoever.</p>
<p>But when I use ProcessStartInfo to start a .cmd program like a simple foo.cmd containing only <code>@echo Hello world</code> it doesn't ou... | 25,992 | 876,465 | 2020-11-21 23:04:50 | 11,613,662 | 21 | 2012-07-23 13:37:54 | 876,465 | 2018-01-05 12:36:33 | https://stackoverflow.com/q/11575386 | https://stackoverflow.com/a/11613662 | <p>I found the answer myself and will post a solution for anyone interested.</p>
<p>The source of the issue is fairly hard to debug, because the problem originated in how IIS handles users and processes.</p>
<p>As I thought, there was nothing wrong with the code itself.</p>
<p><strong>Answer</strong></p>
<p>In IIS,... | <p>I found the answer myself and will post a solution for anyone interested.</p> <p>The source of the issue is fairly hard to debug, because the problem originated in how IIS handles users and processes.</p> <p>As I thought, there was nothing wrong with the code itself.</p> <p><strong>Answer</strong></p> <p>In IIS,... | 1, 9, 2631, 5910 | .net, c#, cmd, process | <h1>Foo.cmd won't output lines in process (on website)</h1>
<p>I've a problem understanding the in's and out's of the ProcessStartInfo class in .NET.
I use this class for executing .exe programs like FFmpeg with no issues whatsoever.</p>
<p>But when I use ProcessStartInfo to start a .cmd program like a simple foo.cmd ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,896 | cmd | # Foo.cmd won't output lines in process (on website)
I've a problem understanding the in's and out's of the ProcessStartInfo class in .NET.
I use this class for executing .exe programs like FFmpeg with no issues whatsoever.
But when I use ProcessStartInfo to start a .cmd program like a simple foo.cmd containing only ... | I found the answer myself and will post a solution for anyone interested.
The source of the issue is fairly hard to debug, because the problem originated in how IIS handles users and processes.
As I thought, there was nothing wrong with the code itself.
**Answer**
In IIS, a website is running in a AppPool. An AppPo... |
1493979 | What does the @title batch script command do? | 13 | 2009-09-29 17:38:16 | <p>I see it a few times in my batch script, however I'm not certain what it actually does. The two occurrences of it are below an @echo (which prints out the text following it to the console) and are exact duplicates of the text that is printed with @echo.</p>
| 21,787 | 572 | 2009-11-17 10:33:47 | 1,493,998 | 21 | 2009-09-29 17:42:38 | 23,921 | 2009-09-29 17:42:38 | https://stackoverflow.com/q/1493979 | https://stackoverflow.com/a/1493998 | <p>Not surprisingly, it <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/title.mspx?mfr=true" rel="noreferrer">sets the title</a> of the command prompt window the batch is running in. The leading <code>@</code> keeps the line from being echo'd to the prompt.</p>
| <p>Not surprisingly, it <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/title.mspx?mfr=true" rel="noreferrer">sets the title</a> of the command prompt window the batch is running in. The leading <code>@</code> keeps the line from being echo'd to the prompt.</p> | 64, 7002 | batch-file, windows | <h1>What does the @title batch script command do?</h1>
<p>I see it a few times in my batch script, however I'm not certain what it actually does. The two occurrences of it are below an @echo (which prints out the text following it to the console) and are exact duplicates of the text that is printed with @echo.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,897 | cmd | # What does the @title batch script command do?
I see it a few times in my batch script, however I'm not certain what it actually does. The two occurrences of it are below an @echo (which prints out the text following it to the console) and are exact duplicates of the text that is printed with @echo. | Not surprisingly, it [sets the title](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/title.mspx?mfr=true) of the command prompt window the batch is running in. The leading `@` keeps the line from being echo'd to the prompt. |
71970035 | java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.atDebug() with poi-ooxml | 12 | 2022-04-22 14:02:24 | <p>I have:</p>
<pre><code><dependencies>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml<... | 21,291 | 903,885 | 2022-06-30 11:42:13 | 72,043,344 | 21 | 2022-04-28 12:03:32 | 903,885 | 2022-04-28 12:03:32 | https://stackoverflow.com/q/71970035 | https://stackoverflow.com/a/72043344 | <p>The <code>spring-boot-starter</code> version 2.2.0 dependency was bringing <code>log4j</code> related dependencies with 2.12.1 version, which, did not have <code>atDebug()</code> method. So:</p>
<pre><code><dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifac... | <p>The <code>spring-boot-starter</code> version 2.2.0 dependency was bringing <code>log4j</code> related dependencies with 2.12.1 version, which, did not have <code>atDebug()</code> method. So:</p> <pre><code><dependencyManagement> <dependencies> <!-- https://mvnrepository.com/artifac... | 1211, 2859, 41895, 95875 | log4j, spring, spring-batch, spring-boot | <h1>java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.atDebug() with poi-ooxml</h1>
<p>I have:</p>
<pre><code><dependencies>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<dependency>
<groupId>com.faste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,898 | cmd | # java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.atDebug() with poi-ooxml
I have:
```
<dependencies>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
... | The `spring-boot-starter` version 2.2.0 dependency was bringing `log4j` related dependencies with 2.12.1 version, which, did not have `atDebug()` method. So:
```
<dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-to-slf4j -->
<de... |
34317826 | Batch file: Check if OS is Windows 10 | 12 | 2015-12-16 17:00:06 | <p>I want to make a batch file which will do the following operation: checks if the running OS is windows. If it is than it should print <code>Hello. Im win 10</code> else should print other message. How can i do this if condition?</p>
<p>Pseudocode:</p>
<pre><code>if OS == Win10 then
echo Hello im win 10
else
... | 34,767 | 2,357,522 | 2024-02-24 18:02:40 | 34,317,898 | 21 | 2015-12-16 17:03:38 | 996,815 | 2015-12-16 17:03:38 | https://stackoverflow.com/q/34317826 | https://stackoverflow.com/a/34317898 | <pre><code>setlocal
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
if "%version%" == "6.3" echo Windows 8.1
if "%version%" == "6.2" echo Windows 8.
if "%version%" == "6.1" echo Windows 7.
if "%version%" == "6.0" echo Windows Vista.
if "%version%" == "10.0" echo Windows 10.
echo %version%
rem etc et... | <pre><code>setlocal for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j if "%version%" == "6.3" echo Windows 8.1 if "%version%" == "6.2" echo Windows 8. if "%version%" == "6.1" echo Windows 7. if "%version%" == "6.0" echo Windows Vista. if "%version%" == "10.0" echo Windows 10. echo %version% rem etc et... | 64, 1987, 2631, 7002, 12688 | batch-file, cmd, detect, operating-system, windows | <h1>Batch file: Check if OS is Windows 10</h1>
<p>I want to make a batch file which will do the following operation: checks if the running OS is windows. If it is than it should print <code>Hello. Im win 10</code> else should print other message. How can i do this if condition?</p>
<p>Pseudocode:</p>
<pre><code>if OS... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,899 | cmd | # Batch file: Check if OS is Windows 10
I want to make a batch file which will do the following operation: checks if the running OS is windows. If it is than it should print `Hello. Im win 10` else should print other message. How can i do this if condition?
Pseudocode:
```
if OS == Win10 then
echo Hello im win 10... | ```
setlocal
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
if "%version%" == "6.3" echo Windows 8.1
if "%version%" == "6.2" echo Windows 8.
if "%version%" == "6.1" echo Windows 7.
if "%version%" == "6.0" echo Windows Vista.
if "%version%" == "10.0" echo Windows 10.
echo %version%
rem etc etc
endlo... |
33296326 | FFMPEG Fade in and Fade out for Overlay | 12 | 2015-10-23 06:45:42 | <p>I'm trying to add Overlay-Pictures to my video via FFMPEG (on Android). For know I managed to display the Image between a certain time span. But now, additionally, I want to add a fade in and fade out animation.
Here is what I have so far:</p>
<pre><code>ArrayList<String> cmd = new ArrayList<String>(); ... | 6,720 | 678,448 | 2015-11-18 08:34:29 | 33,418,177 | 21 | 2015-10-29 15:20:28 | 4,663,670 | 2015-11-18 08:34:29 | https://stackoverflow.com/q/33296326 | https://stackoverflow.com/a/33418177 | <p>You fade the image in <code>rgba</code>. Example:</p>
<pre><code>ffmpeg -f lavfi -i color=color=black -loop 1 -i logo.png -filter_complex "\
[1:0] format=rgba,fade=in:st=0:d=3:alpha=1,fade=out:st=6:d=3:alpha=1 [ovr];\
[0:0][ovr] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2\
" -t 10 -y out.gif
</code></pre>
<p... | <p>You fade the image in <code>rgba</code>. Example:</p> <pre><code>ffmpeg -f lavfi -i color=color=black -loop 1 -i logo.png -filter_complex "\ [1:0] format=rgba,fade=in:st=0:d=3:alpha=1,fade=out:st=6:d=3:alpha=1 [ovr];\ [0:0][ovr] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2\ " -t 10 -y out.gif </code></pre> <p... | 1386, 2631, 3847 | android, cmd, ffmpeg | <h1>FFMPEG Fade in and Fade out for Overlay</h1>
<p>I'm trying to add Overlay-Pictures to my video via FFMPEG (on Android). For know I managed to display the Image between a certain time span. But now, additionally, I want to add a fade in and fade out animation.
Here is what I have so far:</p>
<pre><code>ArrayList<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,900 | cmd | # FFMPEG Fade in and Fade out for Overlay
I'm trying to add Overlay-Pictures to my video via FFMPEG (on Android). For know I managed to display the Image between a certain time span. But now, additionally, I want to add a fade in and fade out animation.
Here is what I have so far:
```
ArrayList<String> cmd = new Arra... | You fade the image in `rgba`. Example:
```
ffmpeg -f lavfi -i color=color=black -loop 1 -i logo.png -filter_complex "\
[1:0] format=rgba,fade=in:st=0:d=3:alpha=1,fade=out:st=6:d=3:alpha=1 [ovr];\
[0:0][ovr] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2\
" -t 10 -y out.gif
```
`format=rgba` - use RGB format with a... |
25919451 | Use CreateProcess to Run a Batch File | 12 | 2014-09-18 18:03:29 | <p>I am trying to use CreateProcess to start a new environment block and run a batch file in the new environment block. I've read through the msdn example for CreateProcess, and came up with the code shown below.</p>
<p>What is happening, it will open the new command prompt, and stop there. It will not run my .bat fil... | 24,394 | 2,970,916 | 2014-09-18 19:29:29 | 25,919,674 | 21 | 2014-09-18 18:18:36 | 505,088 | 2014-09-18 19:29:29 | https://stackoverflow.com/q/25919451 | https://stackoverflow.com/a/25919674 | <p>Some problems:</p>
<ol>
<li>You need to pass the <code>/C</code> option to <code>cmd.exe</code> in order to make it execute the .bat file.</li>
<li>The second parameter to <code>CreateProcess</code> must be a modifiable string. Not a literal. </li>
<li>You need to escape backslash characters in literals. </li>
<li>... | <p>Some problems:</p> <ol> <li>You need to pass the <code>/C</code> option to <code>cmd.exe</code> in order to make it execute the .bat file.</li> <li>The second parameter to <code>CreateProcess</code> must be a modifiable string. Not a literal. </li> <li>You need to escape backslash characters in literals. </li> <li>... | 10, 889, 6613, 7002 | batch-file, c++, createprocess, winapi | <h1>Use CreateProcess to Run a Batch File</h1>
<p>I am trying to use CreateProcess to start a new environment block and run a batch file in the new environment block. I've read through the msdn example for CreateProcess, and came up with the code shown below.</p>
<p>What is happening, it will open the new command prom... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,901 | cmd | # Use CreateProcess to Run a Batch File
I am trying to use CreateProcess to start a new environment block and run a batch file in the new environment block. I've read through the msdn example for CreateProcess, and came up with the code shown below.
What is happening, it will open the new command prompt, and stop the... | Some problems:
1. You need to pass the `/C` option to `cmd.exe` in order to make it execute the .bat file.
2. The second parameter to `CreateProcess` must be a modifiable string. Not a literal.
3. You need to escape backslash characters in literals.
4. `lpszCurrentVariable` points to the buffer returned by `GetEnviron... |
22418553 | CMD: '■m' is not recognized as an internal or external command | 12 | 2014-03-15 01:44:08 | <p>I am trying to get a batch file to work. Whenever I attempt to run a .bat the command line returns '■m' is not recognized... error, where "m" is the first letter of the file. For example: </p>
<p><code>md c:\testsource
md c:\testbackup</code></p>
<p>Returns </p>
<p>C:>"C:\Users\Michael\Dropbox\Documents\Research\... | 29,511 | 3,422,060 | 2024-07-09 11:18:52 | 22,418,622 | 21 | 2014-03-15 01:57:09 | 25,097 | 2014-03-15 01:57:09 | https://stackoverflow.com/q/22418553 | https://stackoverflow.com/a/22418622 | <p>What text editor are you writing this in? It seems like your text editor may save the file as UTF-16 encoded text, which <code>cmd.exe</code> can't handle. Try setting the "coding"/"file encoding" to "ANSI" when saving the file.</p>
<p>This results in the first byte being a byte-order-mark (telling other editors ho... | <p>What text editor are you writing this in? It seems like your text editor may save the file as UTF-16 encoded text, which <code>cmd.exe</code> can't handle. Try setting the "coding"/"file encoding" to "ANSI" when saving the file.</p> <p>This results in the first byte being a byte-order-mark (telling other editors ho... | 64, 1231, 1796, 7002, 9938 | batch-file, command, command-line, command-prompt, windows | <h1>CMD: '■m' is not recognized as an internal or external command</h1>
<p>I am trying to get a batch file to work. Whenever I attempt to run a .bat the command line returns '■m' is not recognized... error, where "m" is the first letter of the file. For example: </p>
<p><code>md c:\testsource
md c:\testbackup</code></... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,902 | cmd | # CMD: '■m' is not recognized as an internal or external command
I am trying to get a batch file to work. Whenever I attempt to run a .bat the command line returns '■m' is not recognized... error, where "m" is the first letter of the file. For example:
`md c:\testsource
md c:\testbackup`
Returns
C:>"C:\Users\Michae... | What text editor are you writing this in? It seems like your text editor may save the file as UTF-16 encoded text, which `cmd.exe` can't handle. Try setting the "coding"/"file encoding" to "ANSI" when saving the file.
This results in the first byte being a byte-order-mark (telling other editors how to process the file... |
20563975 | How to make a batch file execute a reg file | 11 | 2013-12-13 10:18:20 | <p>I have the following code </p>
<pre><code>@echo off
file.reg
pause
</code></pre>
<p>This works but when the batch file is elevated I get an error saying that it cannot find the file. does any one know what I am doing wrong.</p>
| 80,402 | 2,964,427 | 2025-05-17 10:21:32 | 20,564,077 | 21 | 2013-12-13 10:23:50 | 388,389 | 2025-05-17 10:17:01 | https://stackoverflow.com/q/20563975 | https://stackoverflow.com/a/20564077 | <p>Try this:</p>
<pre><code>@echo off
rem set __COMPAT_LAYER=RunAsInvoker
REGEDIT.EXE /S "%~dp0file.reg"
pause
</code></pre>
<p>If you are accessing locations in the registry that does not require admin privileges you can use <code>__COMPAT_LAYER</code> environment variable. Just execute this before using <... | <p>Try this:</p> <pre><code>@echo off rem set __COMPAT_LAYER=RunAsInvoker REGEDIT.EXE /S "%~dp0file.reg" pause </code></pre> <p>If you are accessing locations in the registry that does not require admin privileges you can use <code>__COMPAT_LAYER</code> environment variable. Just execute this before using <... | 64, 263, 5310, 7002, 60888 | batch-file, elevated-privileges, file, registry, windows | <h1>How to make a batch file execute a reg file</h1>
<p>I have the following code </p>
<pre><code>@echo off
file.reg
pause
</code></pre>
<p>This works but when the batch file is elevated I get an error saying that it cannot find the file. does any one know what I am doing wrong.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,903 | cmd | # How to make a batch file execute a reg file
I have the following code
```
@echo off
file.reg
pause
```
This works but when the batch file is elevated I get an error saying that it cannot find the file. does any one know what I am doing wrong. | Try this:
```
@echo off
rem set __COMPAT_LAYER=RunAsInvoker
REGEDIT.EXE /S "%~dp0file.reg"
pause
```
If you are accessing locations in the registry that does not require admin privileges you can use `__COMPAT_LAYER` environment variable. Just execute this before using `regedit`:
```
set __COMPAT_LAYER=RunAsInvoker... |
17714681 | Get java version from batch file | 11 | 2013-07-18 04:42:52 | <p>How to get java version and want to get '6' out of java version from batch file.
I tried below script, but it didn't work.</p>
<pre><code> REM check java exists using JAVA_HOME system variable
if "%JAVA_HOME%" == "" (
ECHO Installing java
start /w jdk.exe /s
SETX -m JAVA_HOME "C:\Program Files\Java\jdk1.6.0_31"... | 24,300 | 2,583,610 | 2020-02-03 10:42:11 | 17,714,698 | 21 | 2013-07-18 04:45:33 | 388,389 | 2014-04-25 17:46:24 | https://stackoverflow.com/q/17714681 | https://stackoverflow.com/a/17714698 | <pre><code>for /f tokens^=2-5^ delims^=.-_^" %j in ('java -fullversion 2^>^&1') do @set "jver=%j%k%l%m"
</code></pre>
<p>This will store the java version into <strong><code>jver</code></strong> variable and as integer
And you can use it for comparisons .E.G</p>
<pre><code>if %jver% LSS 16000 echo not supported... | <pre><code>for /f tokens^=2-5^ delims^=.-_^" %j in ('java -fullversion 2^>^&1') do @set "jver=%j%k%l%m" </code></pre> <p>This will store the java version into <strong><code>jver</code></strong> variable and as integer And you can use it for comparisons .E.G</p> <pre><code>if %jver% LSS 16000 echo not supported... | 1796, 2631, 5792, 7002 | batch-file, cmd, command, version | <h1>Get java version from batch file</h1>
<p>How to get java version and want to get '6' out of java version from batch file.
I tried below script, but it didn't work.</p>
<pre><code> REM check java exists using JAVA_HOME system variable
if "%JAVA_HOME%" == "" (
ECHO Installing java
start /w jdk.exe /s
SETX -m JAV... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,904 | cmd | # Get java version from batch file
How to get java version and want to get '6' out of java version from batch file.
I tried below script, but it didn't work.
```
REM check java exists using JAVA_HOME system variable
if "%JAVA_HOME%" == "" (
ECHO Installing java
start /w jdk.exe /s
SETX -m JAVA_HOME "C:\Program F... | ```
for /f tokens^=2-5^ delims^=.-_^" %j in ('java -fullversion 2^>^&1') do @set "jver=%j%k%l%m"
```
This will store the java version into **`jver`** variable and as integer
And you can use it for comparisons .E.G
```
if %jver% LSS 16000 echo not supported version
```
.You can use more major version by removing %k a... |
15974707 | How to rename folders in Windows 7: command line that have spaces in the name | 11 | 2013-04-12 15:01:13 | <p>How do I rename a path that has spaces in it under Windows 7? </p>
<p>Command line:</p>
<pre><code>rename c:\ho hum\new folder -> c:\ho_hum\new_folder
</code></pre>
| 33,384 | 767,829 | 2018-11-04 08:48:13 | 15,974,913 | 21 | 2013-04-12 15:10:14 | 504,368 | 2016-04-15 09:21:14 | https://stackoverflow.com/q/15974707 | https://stackoverflow.com/a/15974913 | <p>This can only be done by moving the folder and set a new name for the destination:</p>
<pre><code>move "c:\ho hum\new folder" "c:\ho hum\new_folder"
move "c:\ho hum" "c:\ho_hum"
</code></pre>
| <p>This can only be done by moving the folder and set a new name for the destination:</p> <pre><code>move "c:\ho hum\new folder" "c:\ho hum\new_folder" move "c:\ho hum" "c:\ho_hum" </code></pre> | 2631, 34595 | cmd, windows-7 | <h1>How to rename folders in Windows 7: command line that have spaces in the name</h1>
<p>How do I rename a path that has spaces in it under Windows 7? </p>
<p>Command line:</p>
<pre><code>rename c:\ho hum\new folder -> c:\ho_hum\new_folder
</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,905 | cmd | # How to rename folders in Windows 7: command line that have spaces in the name
How do I rename a path that has spaces in it under Windows 7?
Command line:
```
rename c:\ho hum\new folder -> c:\ho_hum\new_folder
``` | This can only be done by moving the folder and set a new name for the destination:
```
move "c:\ho hum\new folder" "c:\ho hum\new_folder"
move "c:\ho hum" "c:\ho_hum"
``` |
11711400 | How to monitor focus changes? | 11 | 2012-07-29 17:33:52 | <p>Well Sometimes I am typing and very rarely it happens that something steals focus, I read some solution (even a VB watch) but they don't apply to me. Is there any windows-wide 'handle' which handles ANY focus changes?</p>
<p>It doesn't matter in which language, C, C++, VB.NET, C#, Anything .NET or windows related, ... | 11,858 | null | 2013-03-30 12:01:36 | 11,712,947 | 21 | 2012-07-29 21:04:15 | 517,852 | 2012-07-29 21:04:15 | https://stackoverflow.com/q/11711400 | https://stackoverflow.com/a/11712947 | <p>One way would be to use the windows UI Automation API. It exposes a global focus changed event. Here is a quick sample I came up with (in C#). Note, you need to add references to UIAutomationClient and UIAutomationTypes.</p>
<pre><code>using System.Windows.Automation;
using System.Diagnostics;
namespace FocusChang... | <p>One way would be to use the windows UI Automation API. It exposes a global focus changed event. Here is a quick sample I came up with (in C#). Note, you need to add references to UIAutomationClient and UIAutomationTypes.</p> <pre><code>using System.Windows.Automation; using System.Diagnostics; namespace FocusChang... | 9, 10, 41, 494, 7002 | batch-file, c#, c++, vb.net, vbscript | <h1>How to monitor focus changes?</h1>
<p>Well Sometimes I am typing and very rarely it happens that something steals focus, I read some solution (even a VB watch) but they don't apply to me. Is there any windows-wide 'handle' which handles ANY focus changes?</p>
<p>It doesn't matter in which language, C, C++, VB.NET,... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,906 | cmd | # How to monitor focus changes?
Well Sometimes I am typing and very rarely it happens that something steals focus, I read some solution (even a VB watch) but they don't apply to me. Is there any windows-wide 'handle' which handles ANY focus changes?
It doesn't matter in which language, C, C++, VB.NET, C#, Anything .N... | One way would be to use the windows UI Automation API. It exposes a global focus changed event. Here is a quick sample I came up with (in C#). Note, you need to add references to UIAutomationClient and UIAutomationTypes.
```
using System.Windows.Automation;
using System.Diagnostics;
namespace FocusChanged
{
class... |
1333589 | How do I transform the working directory into a 8.3 short file name using batch? | 11 | 2009-08-26 09:58:11 | <p>I'm writing a build script, and if the directory the user's building the script contains spaces, everything falls apart. To go around that, I thought of using 8.3 filenames so that <code>drive:\Documents and setttings\whatever</code> becomes <code>drive:\Docume~1\whatever</code> . The current directory can be found ... | 10,756 | 31,610 | 2013-01-08 23:11:51 | 1,333,640 | 21 | 2009-08-26 10:07:09 | 30,225 | 2013-01-08 23:11:51 | https://stackoverflow.com/q/1333589 | https://stackoverflow.com/a/1333640 | <pre><code>for %f in ("%cd%") do @echo %~sf
</code></pre>
<p>Edit: <strong>don't forget to use %% if you are using it in batch file.</strong> like this</p>
<pre><code>for %%f in ("%cd%") do @echo %%~sf
</code></pre>
<p>On my machine:</p>
<pre><code>C:\Users\preet>cd "\Program Files"
C:\Program Files>for %f in... | <pre><code>for %f in ("%cd%") do @echo %~sf </code></pre> <p>Edit: <strong>don't forget to use %% if you are using it in batch file.</strong> like this</p> <pre><code>for %%f in ("%cd%") do @echo %%~sf </code></pre> <p>On my machine:</p> <pre><code>C:\Users\preet>cd "\Program Files" C:\Program Files>for %f in... | 64, 7002 | batch-file, windows | <h1>How do I transform the working directory into a 8.3 short file name using batch?</h1>
<p>I'm writing a build script, and if the directory the user's building the script contains spaces, everything falls apart. To go around that, I thought of using 8.3 filenames so that <code>drive:\Documents and setttings\whatever<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,907 | cmd | # How do I transform the working directory into a 8.3 short file name using batch?
I'm writing a build script, and if the directory the user's building the script contains spaces, everything falls apart. To go around that, I thought of using 8.3 filenames so that `drive:\Documents and setttings\whatever` becomes `driv... | ```
for %f in ("%cd%") do @echo %~sf
```
Edit: **don't forget to use %% if you are using it in batch file.** like this
```
for %%f in ("%cd%") do @echo %%~sf
```
On my machine:
```
C:\Users\preet>cd "\Program Files"
C:\Program Files>for %f in ("%cd%") do @echo %~sf
C:\PROGRA~1
```
Other options:
In addition, subs... |
73637315 | OSError: no library called "cairo-2" was found (from Custom_Widgets import ProjectMaker) | 10 | 2022-09-07 14:34:17 | <p>How to fix this error?</p>
<pre><code>C:\Users\vanvl\OneDrive\Bureaublad\Progammeren\Project 1.02.2>python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.... | 38,128 | 19,941,977 | 2024-12-10 03:50:55 | 73,913,080 | 21 | 2022-09-30 19:10:08 | 15,368,670 | 2023-09-26 06:06:36 | https://stackoverflow.com/q/73637315 | https://stackoverflow.com/a/73913080 | <p>This is quite an annoying dependency problem because cairocffi is not built for windows, you need the additional dependency as explained there: <a href="https://doc.courtbouillon.org/cairocffi/stable/overview.html#installing-cairo-on-windows" rel="noreferrer">https://doc.courtbouillon.org/cairocffi/stable/overview.h... | <p>This is quite an annoying dependency problem because cairocffi is not built for windows, you need the additional dependency as explained there: <a href="https://doc.courtbouillon.org/cairocffi/stable/overview.html#installing-cairo-on-windows" rel="noreferrer">https://doc.courtbouillon.org/cairocffi/stable/overview.h... | 16, 2631 | cmd, python | <h1>OSError: no library called "cairo-2" was found (from Custom_Widgets import ProjectMaker)</h1>
<p>How to fix this error?</p>
<pre><code>C:\Users\vanvl\OneDrive\Bureaublad\Progammeren\Project 1.02.2>python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,908 | cmd | # OSError: no library called "cairo-2" was found (from Custom_Widgets import ProjectMaker)
How to fix this error?
```
C:\Users\vanvl\OneDrive\Bureaublad\Progammeren\Project 1.02.2>python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits... | This is quite an annoying dependency problem because cairocffi is not built for windows, you need the additional dependency as explained there: <https://doc.courtbouillon.org/cairocffi/stable/overview.html#installing-cairo-on-windows>
A quicker solution is to do the following:
I used pipwin which install from an unoff... |
11210997 | Windows console %DATE% Math | 10 | 2012-06-26 15:41:25 | <p>I would like to set the date in a Windows batch file to 7 days ago from today. I would like to do this in the following format.</p>
<pre class="lang-csh prettyprint-override"><code>set today=%date:~10,4%-%date:~4,2%-%date:~-7,2%
</code></pre>
<p>Any ideas how to subract the 7 day time delta here ?</p>
| 31,538 | 759,422 | 2025-08-15 17:43:35 | 11,213,142 | 21 | 2012-06-26 17:52:09 | 778,560 | 2012-06-26 17:52:09 | https://stackoverflow.com/q/11210997 | https://stackoverflow.com/a/11213142 | <p>I posted the description below in some site some time ago:</p>
<hr>
<p>The following Batch files convert from Date to Julian Day Number an viceversa:</p>
<p>DATETOJULIAN.BAT:</p>
<pre><code>@ECHO OFF
REM CONVERT DATE TO JULIAN DAY NUMBER
REM ANTONIO PEREZ AYALA
REM GET MONTH, DAY, YEAR VALUES
FOR /F "TOKENS=1-3 ... | <p>I posted the description below in some site some time ago:</p> <hr> <p>The following Batch files convert from Date to Julian Day Number an viceversa:</p> <p>DATETOJULIAN.BAT:</p> <pre><code>@ECHO OFF REM CONVERT DATE TO JULIAN DAY NUMBER REM ANTONIO PEREZ AYALA REM GET MONTH, DAY, YEAR VALUES FOR /F "TOKENS=1-3 ... | 64, 2631, 5002, 7002 | batch-file, cmd, date, windows | <h1>Windows console %DATE% Math</h1>
<p>I would like to set the date in a Windows batch file to 7 days ago from today. I would like to do this in the following format.</p>
<pre class="lang-csh prettyprint-override"><code>set today=%date:~10,4%-%date:~4,2%-%date:~-7,2%
</code></pre>
<p>Any ideas how to subract the 7 d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,909 | cmd | # Windows console %DATE% Math
I would like to set the date in a Windows batch file to 7 days ago from today. I would like to do this in the following format.
```
set today=%date:~10,4%-%date:~4,2%-%date:~-7,2%
```
Any ideas how to subract the 7 day time delta here ? | I posted the description below in some site some time ago:
---
The following Batch files convert from Date to Julian Day Number an viceversa:
DATETOJULIAN.BAT:
```
@ECHO OFF
REM CONVERT DATE TO JULIAN DAY NUMBER
REM ANTONIO PEREZ AYALA
REM GET MONTH, DAY, YEAR VALUES
FOR /F "TOKENS=1-3 DELIMS=/" %%A IN ("%1") DO SE... |
47751529 | How do I suppress console/cmd error messages in python | 9 | 2017-12-11 11:04:45 | <p>How do I suppress error messages in python for chromedriver and pyinstaller exe? </p>
<p>I noticed that when I use chromedriver in pyinstaller and run it I get a list of error messages. I have been trying to remove them but no luck thus far.
UPDATE: It seems the headless flag is causing a lot of grief. </p>
<pre><... | 13,155 | null | 2019-12-31 06:53:30 | 47,798,976 | 21 | 2017-12-13 17:27:48 | 2,887,618 | 2017-12-13 17:27:48 | https://stackoverflow.com/q/47751529 | https://stackoverflow.com/a/47798976 | <p>Those logs are issued by Chrome. You can disable them by launching Chrome with the log level set to Fatal: </p>
<pre><code>options = Options()
options.add_argument('--headless')
options.add_argument('--hide-scrollbars')
options.add_argument('--disable-gpu')
options.add_argument("--log-level=3") # fatal
driver = we... | <p>Those logs are issued by Chrome. You can disable them by launching Chrome with the log level set to Fatal: </p> <pre><code>options = Options() options.add_argument('--headless') options.add_argument('--hide-scrollbars') options.add_argument('--disable-gpu') options.add_argument("--log-level=3") # fatal driver = we... | 16, 379, 1104, 2631, 14766 | cmd, error-handling, pyinstaller, python, selenium | <h1>How do I suppress console/cmd error messages in python</h1>
<p>How do I suppress error messages in python for chromedriver and pyinstaller exe? </p>
<p>I noticed that when I use chromedriver in pyinstaller and run it I get a list of error messages. I have been trying to remove them but no luck thus far.
UPDATE: It... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,910 | cmd | # How do I suppress console/cmd error messages in python
How do I suppress error messages in python for chromedriver and pyinstaller exe?
I noticed that when I use chromedriver in pyinstaller and run it I get a list of error messages. I have been trying to remove them but no luck thus far.
UPDATE: It seems the headle... | Those logs are issued by Chrome. You can disable them by launching Chrome with the log level set to Fatal:
```
options = Options()
options.add_argument('--headless')
options.add_argument('--hide-scrollbars')
options.add_argument('--disable-gpu')
options.add_argument("--log-level=3") # fatal
driver = webdriver.Chrome(... |
47750732 | Write HEX values to file in Windows batch | 8 | 2017-12-11 10:21:44 | <p>In Linux we can do</p>
<pre><code>echo -n -e '\x66\x6f\x6f' > test.txt
</code></pre>
<p>to write HEX values to a file.</p>
<p>How can this be done simply in Windows batch?</p>
| 33,859 | 1,110,642 | 2024-09-04 09:45:25 | 47,826,309 | 21 | 2017-12-15 05:30:24 | 1,012,053 | 2017-12-15 13:09:00 | https://stackoverflow.com/q/47750732 | https://stackoverflow.com/a/47826309 | <p>I am assuming you want the ability to write all possible binary bytes in the range \x00 through \xFF. Unfortunately, pure batch does not provide a simple mechanism to do this.</p>
<p>But there are a number of options that are not too difficult.</p>
<h3>Undocumented <code>!=ExitCodeASCII!</code> dynamic variable</h3>... | <p>I am assuming you want the ability to write all possible binary bytes in the range \x00 through \xFF. Unfortunately, pure batch does not provide a simple mechanism to do this.</p> <p>But there are a number of options that are not too difficult.</p> <h3>Undocumented <code>!=ExitCodeASCII!</code> dynamic variable</h3>... | 368, 1391, 7002 | batch-file, binary, hex | <h1>Write HEX values to file in Windows batch</h1>
<p>In Linux we can do</p>
<pre><code>echo -n -e '\x66\x6f\x6f' > test.txt
</code></pre>
<p>to write HEX values to a file.</p>
<p>How can this be done simply in Windows 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,911 | cmd | # Write HEX values to file in Windows batch
In Linux we can do
```
echo -n -e '\x66\x6f\x6f' > test.txt
```
to write HEX values to a file.
How can this be done simply in Windows batch? | I am assuming you want the ability to write all possible binary bytes in the range \x00 through \xFF. Unfortunately, pure batch does not provide a simple mechanism to do this.
But there are a number of options that are not too difficult.
### Undocumented `!=ExitCodeASCII!` dynamic variable
The `!=ExitCodeASCII!` dyn... |
21629019 | Confusion about executionContexts in Spring Batch | 8 | 2014-02-07 13:29:08 | <p>What exactly is an executionContext in Spring batch? What does getting a handle on it allow us to do? It seems like an overloaded use of the term executionContext.
What is the difference between the two "Contexts" below? One of them has jobParameters and the other just gets the execution context. But the first one g... | 13,404 | 1,445,444 | 2014-02-08 21:53:42 | 21,652,254 | 21 | 2014-02-08 21:53:42 | 618,059 | 2014-02-08 21:53:42 | https://stackoverflow.com/q/21629019 | https://stackoverflow.com/a/21652254 | <p>Within Spring Batch there are two ExecutionContexts. The first is at the Job level. The second is at the Step level. In each case, the ExecutionContext serves as a storage area for information pertinent to that level. For example, in the Step's ExecutionContext, the state of a step (how many records have been re... | <p>Within Spring Batch there are two ExecutionContexts. The first is at the Job level. The second is at the Step level. In each case, the ExecutionContext serves as a storage area for information pertinent to that level. For example, in the Step's ExecutionContext, the state of a step (how many records have been re... | 1211, 41895 | spring, spring-batch | <h1>Confusion about executionContexts in Spring Batch</h1>
<p>What exactly is an executionContext in Spring batch? What does getting a handle on it allow us to do? It seems like an overloaded use of the term executionContext.
What is the difference between the two "Contexts" below? One of them has jobParameters and the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,912 | cmd | # Confusion about executionContexts in Spring Batch
What exactly is an executionContext in Spring batch? What does getting a handle on it allow us to do? It seems like an overloaded use of the term executionContext.
What is the difference between the two "Contexts" below? One of them has jobParameters and the other ju... | Within Spring Batch there are two ExecutionContexts. The first is at the Job level. The second is at the Step level. In each case, the ExecutionContext serves as a storage area for information pertinent to that level. For example, in the Step's ExecutionContext, the state of a step (how many records have been read, etc... |
32742093 | how to access python from command line using py instead of python | 7 | 2015-09-23 14:18:09 | <p>I have a very weird request. An executable I have has a system call to a python script which goes like py file1.py
Now, in my system though py is shown as an unrecognized internal or external command. python file1.py works however.</p>
<p>is there some way I can get my windows command prompt to recognize that py an... | 47,615 | 1,910,621 | 2022-08-01 15:28:42 | 32,742,619 | 21 | 2015-09-23 14:40:51 | 3,545,273 | 2022-08-01 15:28:42 | https://stackoverflow.com/q/32742093 | https://stackoverflow.com/a/32742619 | <p><code>py</code> command comes with Python3.x and allows you to choose among multiple Python interpreters. For example, if you have both Python 3.4 and 2.7 installed, <code>py -2</code> will start python2.7, and <code>py -3</code> will start python3.4. If you just use <code>py</code> it will start the one that was de... | <p><code>py</code> command comes with Python3.x and allows you to choose among multiple Python interpreters. For example, if you have both Python 3.4 and 2.7 installed, <code>py -2</code> will start python2.7, and <code>py -3</code> will start python3.4. If you just use <code>py</code> it will start the one that was de... | 16, 64, 2631, 59047 | cmd, python, python-2.7, windows | <h1>how to access python from command line using py instead of python</h1>
<p>I have a very weird request. An executable I have has a system call to a python script which goes like py file1.py
Now, in my system though py is shown as an unrecognized internal or external command. python file1.py works however.</p>
<p>is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,913 | cmd | # how to access python from command line using py instead of python
I have a very weird request. An executable I have has a system call to a python script which goes like py file1.py
Now, in my system though py is shown as an unrecognized internal or external command. python file1.py works however.
is there some way ... | `py` command comes with Python3.x and allows you to choose among multiple Python interpreters. For example, if you have both Python 3.4 and 2.7 installed, `py -2` will start python2.7, and `py -3` will start python3.4. If you just use `py` it will start the one that was defined as default.
So the official way would be... |
3523393 | Batch File to write to event viewer | 7 | 2010-08-19 15:29:48 | <p>I have a batch file that runs a richcopy program, I am wanting to monitor the errorlevel so far i have got this </p>
<p>IF (%ERRORLEVEL% == 0) goto OK
else IF (%ERRORLEVEL% == 3010) goto Report</p>
<p>:Report</p>
<p>:OK
END</p>
<p>What I am wanting to do is to report the error to the event viewer so that it can... | 24,185 | 301,751 | 2010-08-19 16:21:19 | 3,523,486 | 21 | 2010-08-19 15:38:34 | 334,849 | 2010-08-19 16:21:19 | https://stackoverflow.com/q/3523393 | https://stackoverflow.com/a/3523486 | <p>You can use <code>EVENTCREATE</code> to write to the event log.</p>
<p>An example would be:</p>
<pre><code>EVENTCREATE /T ERROR /L APPLICATION /ID 100 /D "This is your error message."
</code></pre>
<p>More information can be found at the <a href="http://technet.microsoft.com/en-us/library/bb490899.aspx" rel="nore... | <p>You can use <code>EVENTCREATE</code> to write to the event log.</p> <p>An example would be:</p> <pre><code>EVENTCREATE /T ERROR /L APPLICATION /ID 100 /D "This is your error message." </code></pre> <p>More information can be found at the <a href="http://technet.microsoft.com/en-us/library/bb490899.aspx" rel="nore... | 4330, 7002 | batch-file, copy | <h1>Batch File to write to event viewer</h1>
<p>I have a batch file that runs a richcopy program, I am wanting to monitor the errorlevel so far i have got this </p>
<p>IF (%ERRORLEVEL% == 0) goto OK
else IF (%ERRORLEVEL% == 3010) goto Report</p>
<p>:Report</p>
<p>:OK
END</p>
<p>What I am wanting to do is to report... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,914 | cmd | # Batch File to write to event viewer
I have a batch file that runs a richcopy program, I am wanting to monitor the errorlevel so far i have got this
IF (%ERRORLEVEL% == 0) goto OK
else IF (%ERRORLEVEL% == 3010) goto Report
:Report
:OK
END
What I am wanting to do is to report the error to the event viewer so that ... | You can use `EVENTCREATE` to write to the event log.
An example would be:
```
EVENTCREATE /T ERROR /L APPLICATION /ID 100 /D "This is your error message."
```
More information can be found at the [TechNet article](http://technet.microsoft.com/en-us/library/bb490899.aspx).
**EDIT**
In your case, try this. Your pare... |
17714421 | batch file to open multiple command prompts and execute the same task | 6 | 2013-07-18 04:13:28 | <p>I want a batch script which opens up multiple command prompt on a single click and runs the same command over and over again . i have written a below code which only opens an single command prompt and stops there .is there a way to do the same.</p>
<pre><code> for /l %%x in (1, 1, 5) do (
start cmd /c
... | 25,560 | 2,276,753 | 2017-05-16 14:07:38 | 17,714,592 | 21 | 2013-07-18 04:32:11 | 388,389 | 2013-07-18 04:41:02 | https://stackoverflow.com/q/17714421 | https://stackoverflow.com/a/17714592 | <pre><code> for /l %%x in (1, 1, 5) do (
start cmd /c "cd / && dir /s && pause"
)
</code></pre>
<p>It opens different command prompts ...</p>
| <pre><code> for /l %%x in (1, 1, 5) do ( start cmd /c "cd / && dir /s && pause" ) </code></pre> <p>It opens different command prompts ...</p> | 2631, 7002 | batch-file, cmd | <h1>batch file to open multiple command prompts and execute the same task</h1>
<p>I want a batch script which opens up multiple command prompt on a single click and runs the same command over and over again . i have written a below code which only opens an single command prompt and stops there .is there a way to do t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,915 | cmd | # batch file to open multiple command prompts and execute the same task
I want a batch script which opens up multiple command prompt on a single click and runs the same command over and over again . i have written a below code which only opens an single command prompt and stops there .is there a way to do the same.
`... | ```
for /l %%x in (1, 1, 5) do (
start cmd /c "cd / && dir /s && pause"
)
```
It opens different command prompts ... |
12408673 | How to ping multiple servers and return IP address and Hostnames using batch script? | 6 | 2012-09-13 14:32:46 | <p>So I have to use <strong>batch only</strong> for this. Basically, the server HOSTNAMES are all listed in a txt file. I used the following code to ping all the servers and display their results in a txtfile. </p>
<pre><code>For /f %%i in (testservers.txt) do ping -n 1 %%i >>pingtest.txt
</code></pre>
<p>The a... | 147,281 | 1,652,866 | 2018-04-19 21:32:00 | 12,411,764 | 21 | 2012-09-13 17:34:24 | 1,336,150 | 2016-02-16 08:59:15 | https://stackoverflow.com/q/12408673 | https://stackoverflow.com/a/12411764 | <p>Well, it's unfortunate that you didn't post your own code too, so that it could be corrected.<br/>
Anyway, here's my own solution to this:</p>
<pre><code>@echo off
setlocal enabledelayedexpansion
set OUTPUT_FILE=result.txt
>nul copy nul %OUTPUT_FILE%
for /f %%i in (testservers.txt) do (
set SERVER_ADDRESS=A... | <p>Well, it's unfortunate that you didn't post your own code too, so that it could be corrected.<br/> Anyway, here's my own solution to this:</p> <pre><code>@echo off setlocal enabledelayedexpansion set OUTPUT_FILE=result.txt >nul copy nul %OUTPUT_FILE% for /f %%i in (testservers.txt) do ( set SERVER_ADDRESS=A... | 5649, 7002 | batch-file, ping | <h1>How to ping multiple servers and return IP address and Hostnames using batch script?</h1>
<p>So I have to use <strong>batch only</strong> for this. Basically, the server HOSTNAMES are all listed in a txt file. I used the following code to ping all the servers and display their results in a txtfile. </p>
<pre><code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,916 | cmd | # How to ping multiple servers and return IP address and Hostnames using batch script?
So I have to use **batch only** for this. Basically, the server HOSTNAMES are all listed in a txt file. I used the following code to ping all the servers and display their results in a txtfile.
```
For /f %%i in (testservers.txt) d... | Well, it's unfortunate that you didn't post your own code too, so that it could be corrected.
Anyway, here's my own solution to this:
```
@echo off
setlocal enabledelayedexpansion
set OUTPUT_FILE=result.txt
>nul copy nul %OUTPUT_FILE%
for /f %%i in (testservers.txt) do (
set SERVER_ADDRESS=ADDRESS N/A
for /... |
3288552 | How can I escape an exclamation mark ! in cmd scripts? | 86 | 2010-07-20 09:20:36 | <p>When I have <code>setlocal ENABLEDELAYEDEXPANSION</code> set in a cmd script is there any way I can escape a ! that I want to use as a parameter to a command? </p>
<pre><code>@echo off
setlocal ENABLEDELAYEDEXPANSION
echo I want to go out with a bang!
echo I still want to go out with a bang^!
</code></pre>
| 69,559 | 174,447 | 2023-11-05 00:18:13 | 30,705,470 | 20 | 2015-06-08 09:25:26 | 4,985,665 | 2023-11-05 00:18:13 | https://stackoverflow.com/q/3288552 | https://stackoverflow.com/a/30705470 | <p>To use an exclamation point in batch with Delayed Expansion enabled, you must first add the exclamation point to a variable with it disabled. See the below example with both <code>DISABLEDELAYEDEXPANSION</code> and <code>ENABLEDELAYEDEXPANSION</code> state.</p>
<pre><code>@echo off
setlocal DISABLEDELAYEDEXPANSION
s... | <p>To use an exclamation point in batch with Delayed Expansion enabled, you must first add the exclamation point to a variable with it disabled. See the below example with both <code>DISABLEDELAYEDEXPANSION</code> and <code>ENABLEDELAYEDEXPANSION</code> state.</p> <pre><code>@echo off setlocal DISABLEDELAYEDEXPANSION s... | 2631, 7002 | batch-file, cmd | <h1>How can I escape an exclamation mark ! in cmd scripts?</h1>
<p>When I have <code>setlocal ENABLEDELAYEDEXPANSION</code> set in a cmd script is there any way I can escape a ! that I want to use as a parameter to a command? </p>
<pre><code>@echo off
setlocal ENABLEDELAYEDEXPANSION
echo I want to go out with a bang!
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,917 | cmd | # How can I escape an exclamation mark ! in cmd scripts?
When I have `setlocal ENABLEDELAYEDEXPANSION` set in a cmd script is there any way I can escape a ! that I want to use as a parameter to a command?
```
@echo off
setlocal ENABLEDELAYEDEXPANSION
echo I want to go out with a bang!
echo I still want to go out with... | To use an exclamation point in batch with Delayed Expansion enabled, you must first add the exclamation point to a variable with it disabled. See the below example with both `DISABLEDELAYEDEXPANSION` and `ENABLEDELAYEDEXPANSION` state.
```
@echo off
setlocal DISABLEDELAYEDEXPANSION
set DB_password=encrypt!Pws
echo %DB... |
426071 | How can I sync the computer's clock upon startup? | 65 | 2009-01-08 21:35:11 | <p>I have several servers hosted with GoGrid, and every time I reboot one of my cloud servers, the system clock is incorrect. The server isn't a member of a domain, so I just have the OS set to sync with an Internet time server. This only happens once a day, and I don't see an option to make this happen automatically u... | 104,475 | 43,722 | 2025-10-06 18:47:12 | 426,113 | 20 | 2009-01-08 21:41:50 | 43,722 | 2009-01-08 21:41:50 | https://stackoverflow.com/q/426071 | https://stackoverflow.com/a/426113 | <p>On Windows 2008, there is an option in the Task Scheduler that will allow you to wait until a network connection is available before the task is run. In the task properties dialog, create a new "At Startup" trigger, and be sure to check the "Enabled" box. Add an action to run your batch file. Finally, add a Conditio... | <p>On Windows 2008, there is an option in the Task Scheduler that will allow you to wait until a network connection is available before the task is run. In the task properties dialog, create a new "At Startup" trigger, and be sure to check the "Enabled" box. Add an action to run your batch file. Finally, add a Conditio... | 64, 1263, 7002 | batch-file, datetime, windows | <h1>How can I sync the computer's clock upon startup?</h1>
<p>I have several servers hosted with GoGrid, and every time I reboot one of my cloud servers, the system clock is incorrect. The server isn't a member of a domain, so I just have the OS set to sync with an Internet time server. This only happens once a day, an... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,918 | cmd | # How can I sync the computer's clock upon startup?
I have several servers hosted with GoGrid, and every time I reboot one of my cloud servers, the system clock is incorrect. The server isn't a member of a domain, so I just have the OS set to sync with an Internet time server. This only happens once a day, and I don't... | On Windows 2008, there is an option in the Task Scheduler that will allow you to wait until a network connection is available before the task is run. In the task properties dialog, create a new "At Startup" trigger, and be sure to check the "Enabled" box. Add an action to run your batch file. Finally, add a Condition t... |
36601121 | How to execute a .bat file from node.js passing some parameters? | 23 | 2016-04-13 14:13:23 | <p>I use node.js v4.4.4 and I need to run a <code>.bat</code> file from node.js.</p>
<p>From the location of the js file for my node app the .bat is runnable using command line with the following path (Window platform): </p>
<pre><code>'../src/util/buildscripts/build.bat --profile ../profiles/app.profile.js'
</code><... | 51,861 | 379,008 | 2019-02-22 13:21:33 | 36,617,142 | 20 | 2016-04-14 08:06:09 | 379,008 | 2019-02-22 13:21:33 | https://stackoverflow.com/q/36601121 | https://stackoverflow.com/a/36617142 | <p>The following script solved my issue, basically I had to:</p>
<ul>
<li><p>Converting to absolute path reference to .bat file.</p></li>
<li><p>Passing arguments to .bat using an array.</p>
<pre><code>var bat = require.resolve('../src/util/buildscripts/build.bat');
var profile = require.resolve('../profiles/app.prof... | <p>The following script solved my issue, basically I had to:</p> <ul> <li><p>Converting to absolute path reference to .bat file.</p></li> <li><p>Passing arguments to .bat using an array.</p> <pre><code>var bat = require.resolve('../src/util/buildscripts/build.bat'); var profile = require.resolve('../profiles/app.prof... | 3, 7002, 46426 | batch-file, javascript, node.js | <h1>How to execute a .bat file from node.js passing some parameters?</h1>
<p>I use node.js v4.4.4 and I need to run a <code>.bat</code> file from node.js.</p>
<p>From the location of the js file for my node app the .bat is runnable using command line with the following path (Window platform): </p>
<pre><code>'../src/... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,919 | cmd | # How to execute a .bat file from node.js passing some parameters?
I use node.js v4.4.4 and I need to run a `.bat` file from node.js.
From the location of the js file for my node app the .bat is runnable using command line with the following path (Window platform):
```
'../src/util/buildscripts/build.bat --profile .... | The following script solved my issue, basically I had to:
- Converting to absolute path reference to .bat file.
- Passing arguments to .bat using an array.
```
var bat = require.resolve('../src/util/buildscripts/build.bat');
var profile = require.resolve('../profiles/app.profile.js');
var ls = spawn(bat, ['--... |
28457107 | Spring batch scope issue while using spring boot | 22 | 2015-02-11 14:43:41 | <p>I'm having Standalone spring batch job. This works perfectly fine when in JUNIT</p>
<pre><code>@RunWith(SpringJUnit4ClassRunner.class)
//@SpringApplicationConfiguration(classes = KPBootApplication.class)
@ContextConfiguration(locations={"classpath:kp-sb.xml"})
public class KPBootApplicationTests {
private fina... | 38,964 | 1,279,145 | 2023-05-10 13:01:23 | 28,616,094 | 20 | 2015-02-19 20:17:47 | 618,059 | 2015-02-19 20:17:47 | https://stackoverflow.com/q/28457107 | https://stackoverflow.com/a/28616094 | <p>This may be a bug (we're still investigating), however we do have a work around. The cause of this is that when using <code>@EnableBatchProcessing</code> the <code>StepScope</code> that is automatically configured assumes java config and therefore does not proxy the step scoped beans, causing them to be created too... | <p>This may be a bug (we're still investigating), however we do have a work around. The cause of this is that when using <code>@EnableBatchProcessing</code> the <code>StepScope</code> that is automatically configured assumes java config and therefore does not proxy the step scoped beans, causing them to be created too... | 1211, 41895, 95875 | spring, spring-batch, spring-boot | <h1>Spring batch scope issue while using spring boot</h1>
<p>I'm having Standalone spring batch job. This works perfectly fine when in JUNIT</p>
<pre><code>@RunWith(SpringJUnit4ClassRunner.class)
//@SpringApplicationConfiguration(classes = KPBootApplication.class)
@ContextConfiguration(locations={"classpath:kp-sb.xml"... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,920 | cmd | # Spring batch scope issue while using spring boot
I'm having Standalone spring batch job. This works perfectly fine when in JUNIT
```
@RunWith(SpringJUnit4ClassRunner.class)
//@SpringApplicationConfiguration(classes = KPBootApplication.class)
@ContextConfiguration(locations={"classpath:kp-sb.xml"})
public class KPBo... | This may be a bug (we're still investigating), however we do have a work around. The cause of this is that when using `@EnableBatchProcessing` the `StepScope` that is automatically configured assumes java config and therefore does not proxy the step scoped beans, causing them to be created too soon. The work around is ... |
20644110 | How to set the default directory of the cd command in Windows cmd terminal? | 22 | 2013-12-17 20:33:47 | <p>The cmd command <code>cd</code> takes me to a directory I never spend any time in.</p>
<p>I would like it to take me to <code>C:\Users\Kacy\Documents\</code> by default.</p>
<p>Unfortunately, <code>set cd = C:\Users\Kacy\Documents\</code> does not work.</p>
<p>Is there a simple way to change this setting within t... | 53,431 | 2,763,256 | 2021-05-26 16:08:46 | 20,644,285 | 20 | 2013-12-17 20:44:31 | 62,576 | 2013-12-17 21:05:53 | https://stackoverflow.com/q/20644110 | https://stackoverflow.com/a/20644285 | <p>The command <code>cd</code> without any arguments simply displays the current directory; it doesn't "take you" anywhere. </p>
<p>From an already open command prompt, you can't change this using simply <code>cd</code>. You can write a batch file that does it for you, and run that instead. Create a plain text file wi... | <p>The command <code>cd</code> without any arguments simply displays the current directory; it doesn't "take you" anywhere. </p> <p>From an already open command prompt, you can't change this using simply <code>cd</code>. You can write a batch file that does it for you, and run that instead. Create a plain text file wi... | 2631, 3718, 69665 | cd, cmd, windows-8 | <h1>How to set the default directory of the cd command in Windows cmd terminal?</h1>
<p>The cmd command <code>cd</code> takes me to a directory I never spend any time in.</p>
<p>I would like it to take me to <code>C:\Users\Kacy\Documents\</code> by default.</p>
<p>Unfortunately, <code>set cd = C:\Users\Kacy\Documents... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,921 | cmd | # How to set the default directory of the cd command in Windows cmd terminal?
The cmd command `cd` takes me to a directory I never spend any time in.
I would like it to take me to `C:\Users\Kacy\Documents\` by default.
Unfortunately, `set cd = C:\Users\Kacy\Documents\` does not work.
Is there a simple way to change... | The command `cd` without any arguments simply displays the current directory; it doesn't "take you" anywhere.
From an already open command prompt, you can't change this using simply `cd`. You can write a batch file that does it for you, and run that instead. Create a plain text file with Notepad that contains just one... |
56234411 | robocopy causes exit(1) on success | 19 | 2019-05-21 08:41:53 | <p>I am trying to invoke this code in jenkins</p>
<pre><code>rem copy installation to output folder
set src="C:\code\EPMD\Installer\inno setup\Output"
set dst="c:/test_installs/Calibration/%version_name%"
call robocopy %src% %dst% /MIR /E /is /it
</code></pre>
<p>The code runs and works, creating a new file in the de... | 12,791 | 913,098 | 2021-01-20 12:55:12 | 56,236,247 | 20 | 2019-05-21 10:25:52 | 5,047,996 | 2019-05-21 13:53:42 | https://stackoverflow.com/q/56234411 | https://stackoverflow.com/a/56236247 |
<p>The <a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy#exit-return-codes" rel="noreferrer" title="robocopy"><code>robocopy</code> command</a> uses the exit code (or <a href="https://ss64.com/nt/errorlevel.html" rel="noreferrer" title="%Errorlevel%"><code>ErrorLevel</... | <p>The <a href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy#exit-return-codes" rel="noreferrer" title="robocopy"><code>robocopy</code> command</a> uses the exit code (or <a href="https://ss64.com/nt/errorlevel.html" rel="noreferrer" title="%Errorlevel%"><code>ErrorLevel</... | 64, 2631, 7002, 11635, 64999 | batch-file, cmd, jenkins, robocopy, windows | <h1>robocopy causes exit(1) on success</h1>
<p>I am trying to invoke this code in jenkins</p>
<pre><code>rem copy installation to output folder
set src="C:\code\EPMD\Installer\inno setup\Output"
set dst="c:/test_installs/Calibration/%version_name%"
call robocopy %src% %dst% /MIR /E /is /it
</code></pre>
<p>The code r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,922 | cmd | # robocopy causes exit(1) on success
I am trying to invoke this code in jenkins
```
rem copy installation to output folder
set src="C:\code\EPMD\Installer\inno setup\Output"
set dst="c:/test_installs/Calibration/%version_name%"
call robocopy %src% %dst% /MIR /E /is /it
```
The code runs and works, creating a new fil... | The [`robocopy` command](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy#exit-return-codes "robocopy") uses the exit code (or [`ErrorLevel`](https://ss64.com/nt/errorlevel.html "%Errorlevel%")) to indicate the result of the copying action, where a value less than `8` does not m... |
22309648 | Nuget pack AND push within same batch script | 17 | 2014-03-10 19:37:21 | <p>I'm having a heck of time writing a batch script to both pack and push the resulting <code>.nupkg</code> file up to my private nuget feed. I can call <code>pack</code> just fine, but I don't know how to parse the name of the nupkg out of the resulting output in order to do the <code>push</code>. Unfortunately, the v... | 6,710 | 4,572 | 2024-09-04 06:30:21 | 23,728,410 | 20 | 2014-05-19 01:03:25 | 1,023,608 | 2024-09-04 06:29:16 | https://stackoverflow.com/q/22309648 | https://stackoverflow.com/a/23728410 | <p><code>nuget push</code> supports wildcards, so you could do something like this:</p>
<pre><code>REM delete existing nuget packages
del *.nupkg
nuget pack MyProject.csproj
nuget push *.nupkg
</code></pre>
| <p><code>nuget push</code> supports wildcards, so you could do something like this:</p> <pre><code>REM delete existing nuget packages del *.nupkg nuget pack MyProject.csproj nuget push *.nupkg </code></pre> | 7002, 62770 | batch-file, nuget | <h1>Nuget pack AND push within same batch script</h1>
<p>I'm having a heck of time writing a batch script to both pack and push the resulting <code>.nupkg</code> file up to my private nuget feed. I can call <code>pack</code> just fine, but I don't know how to parse the name of the nupkg out of the resulting output in o... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,923 | cmd | # Nuget pack AND push within same batch script
I'm having a heck of time writing a batch script to both pack and push the resulting `.nupkg` file up to my private nuget feed. I can call `pack` just fine, but I don't know how to parse the name of the nupkg out of the resulting output in order to do the `push`. Unfortun... | `nuget push` supports wildcards, so you could do something like this:
```
REM delete existing nuget packages
del *.nupkg
nuget pack MyProject.csproj
nuget push *.nupkg
``` |
11564594 | C++ Executing CMD Commands | 17 | 2012-07-19 15:51:19 | <p>I'm having a serious problem here. I need to execute a CMD command line via C++ without the console window displaying. Therefore I cannot use <code>system(cmd)</code>, since the window will display.</p>
<p>I have tried <code>winExec(cmd, SW_HIDE)</code>, but this does not work either. <code>CreateProcess</code> is ... | 57,972 | 1,459,654 | 2019-12-18 17:14:26 | 11,566,260 | 20 | 2012-07-19 17:33:36 | 292,432 | 2012-07-19 17:33:36 | https://stackoverflow.com/q/11564594 | https://stackoverflow.com/a/11566260 | <p>Redirecting the output to your own pipe is a tidier solution because it avoids creating the output file, but this works fine:</p>
<pre><code>ShellExecute(0, "open", "cmd.exe", "/C ipconfig > out.txt", 0, SW_HIDE);
</code></pre>
<p>You don't see the cmd window and the output is redirected as expected.</p>
<p>Yo... | <p>Redirecting the output to your own pipe is a tidier solution because it avoids creating the output file, but this works fine:</p> <pre><code>ShellExecute(0, "open", "cmd.exe", "/C ipconfig > out.txt", 0, SW_HIDE); </code></pre> <p>You don't see the cmd window and the output is redirected as expected.</p> <p>Yo... | 10, 64, 889, 2631, 40232 | c++, cmd, winapi, windows, windows-console | <h1>C++ Executing CMD Commands</h1>
<p>I'm having a serious problem here. I need to execute a CMD command line via C++ without the console window displaying. Therefore I cannot use <code>system(cmd)</code>, since the window will display.</p>
<p>I have tried <code>winExec(cmd, SW_HIDE)</code>, but this does not work ei... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,924 | cmd | # C++ Executing CMD Commands
I'm having a serious problem here. I need to execute a CMD command line via C++ without the console window displaying. Therefore I cannot use `system(cmd)`, since the window will display.
I have tried `winExec(cmd, SW_HIDE)`, but this does not work either. `CreateProcess` is another one I... | Redirecting the output to your own pipe is a tidier solution because it avoids creating the output file, but this works fine:
```
ShellExecute(0, "open", "cmd.exe", "/C ipconfig > out.txt", 0, SW_HIDE);
```
You don't see the cmd window and the output is redirected as expected.
Your code is probably failing (apart fr... |
6830906 | How to send Shutdown command to process through CMD Prompt on Windows | 17 | 2011-07-26 13:41:51 | <p>I'm currently working as software developer and I'm using bunch of tools, so I need to close them all when finished with the work. So what I have done I have created batch file with the tskill command and list of programs that i use e.g.</p>
<pre><code>tskill skype
tskill outlook
tskill devenv
tskill explorer
start... | 15,470 | 244,929 | 2014-09-01 01:02:25 | 6,860,723 | 20 | 2011-07-28 14:33:00 | 225,467 | 2011-07-28 14:39:37 | https://stackoverflow.com/q/6830906 | https://stackoverflow.com/a/6860723 | <p>Tested on Windows 7:</p>
<pre><code>taskkill /IM notepad.exe
</code></pre>
<p>Note that you have to specify the <code>.exe</code> extension. I assume this does what you need: It doesn't simply kill the process, but sends the "shutdown" signal, which will display the "Save unsaved changes?" dialog in Notepad and ot... | <p>Tested on Windows 7:</p> <pre><code>taskkill /IM notepad.exe </code></pre> <p>Note that you have to specify the <code>.exe</code> extension. I assume this does what you need: It doesn't simply kill the process, but sends the "shutdown" signal, which will display the "Save unsaved changes?" dialog in Notepad and ot... | 64, 1231, 4921, 7002 | batch-file, command-line, shutdown, windows | <h1>How to send Shutdown command to process through CMD Prompt on Windows</h1>
<p>I'm currently working as software developer and I'm using bunch of tools, so I need to close them all when finished with the work. So what I have done I have created batch file with the tskill command and list of programs that i use e.g.<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,925 | cmd | # How to send Shutdown command to process through CMD Prompt on Windows
I'm currently working as software developer and I'm using bunch of tools, so I need to close them all when finished with the work. So what I have done I have created batch file with the tskill command and list of programs that i use e.g.
```
tski... | Tested on Windows 7:
```
taskkill /IM notepad.exe
```
Note that you have to specify the `.exe` extension. I assume this does what you need: It doesn't simply kill the process, but sends the "shutdown" signal, which will display the "Save unsaved changes?" dialog in Notepad and other editors. |
38836068 | LF Versus CRLF Line Endings in Windows Batch Files | 16 | 2016-08-08 18:26:12 | <p>I have a mixed Ubuntu, OS X and Windows git repository containing <code>.bat</code> and <code>.cmd</code> files targeted for use on Windows 7 and greater. <code>core.autocrlf</code> is set to <code>input</code>, and so post-<code>git checkout</code> these files have <code>LF</code> line endings in my working directo... | 5,248 | 2,570,538 | 2019-05-24 06:37:03 | 38,836,221 | 20 | 2016-08-08 18:35:30 | 82,294 | 2016-08-08 18:35:30 | https://stackoverflow.com/q/38836068 | https://stackoverflow.com/a/38836221 | <p>You can override this for batch files using the following <code>.gitattributes</code> file:</p>
<pre><code>*.bat text eol=crlf
</code></pre>
<p>From <a href="https://serverfault.com/questions/429594/is-it-safe-to-write-batch-files-with-unix-line-endings">Is it safe to write batch files with Unix line endings?</a> ... | <p>You can override this for batch files using the following <code>.gitattributes</code> file:</p> <pre><code>*.bat text eol=crlf </code></pre> <p>From <a href="https://serverfault.com/questions/429594/is-it-safe-to-write-batch-files-with-unix-line-endings">Is it safe to write batch files with Unix line endings?</a> ... | 64, 119, 7002 | batch-file, git, windows | <h1>LF Versus CRLF Line Endings in Windows Batch Files</h1>
<p>I have a mixed Ubuntu, OS X and Windows git repository containing <code>.bat</code> and <code>.cmd</code> files targeted for use on Windows 7 and greater. <code>core.autocrlf</code> is set to <code>input</code>, and so post-<code>git checkout</code> these f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,926 | cmd | # LF Versus CRLF Line Endings in Windows Batch Files
I have a mixed Ubuntu, OS X and Windows git repository containing `.bat` and `.cmd` files targeted for use on Windows 7 and greater. `core.autocrlf` is set to `input`, and so post-`git checkout` these files have `LF` line endings in my working directory instead of t... | You can override this for batch files using the following `.gitattributes` file:
```
*.bat text eol=crlf
```
From [Is it safe to write batch files with Unix line endings?](https://serverfault.com/questions/429594/is-it-safe-to-write-batch-files-with-unix-line-endings) There is a comment about labels not working corre... |
14904033 | How can I do a batch insert into an Oracle database using Python? | 16 | 2013-02-15 21:58:37 | <p>I have some monthly weather data that I want to insert into an Oracle database table but I want to insert the corresponding records in a batch in order to be more efficient. Can anyone advise as to how I'd go about doing this in Python?</p>
<p>For example let's say my table has four fields: a station ID, a date, a... | 66,446 | 85,248 | 2016-05-26 05:08:10 | 14,905,823 | 20 | 2013-02-16 01:07:29 | 85,248 | 2013-02-16 01:07:29 | https://stackoverflow.com/q/14904033 | https://stackoverflow.com/a/14905823 | <p>Here's what I've come up with which appears to work well (but please comment if there's a way to improve this):</p>
<pre><code># build rows for each date and add to a list of rows we'll use to insert as a batch
rows = []
numberOfYears = endYear - startYear + 1
for i in range(numberOfYears):
for j in range(12)... | <p>Here's what I've come up with which appears to work well (but please comment if there's a way to improve this):</p> <pre><code># build rows for each date and add to a list of rows we'll use to insert as a batch rows = [] numberOfYears = endYear - startYear + 1 for i in range(numberOfYears): for j in range(12)... | 16, 2543, 58566, 59047, 165558 | batch-insert, cx-oracle, oracle-database, python, python-2.7 | <h1>How can I do a batch insert into an Oracle database using Python?</h1>
<p>I have some monthly weather data that I want to insert into an Oracle database table but I want to insert the corresponding records in a batch in order to be more efficient. Can anyone advise as to how I'd go about doing this in Python?</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,927 | cmd | # How can I do a batch insert into an Oracle database using Python?
I have some monthly weather data that I want to insert into an Oracle database table but I want to insert the corresponding records in a batch in order to be more efficient. Can anyone advise as to how I'd go about doing this in Python?
For example l... | Here's what I've come up with which appears to work well (but please comment if there's a way to improve this):
```
# build rows for each date and add to a list of rows we'll use to insert as a batch
rows = []
numberOfYears = endYear - startYear + 1
for i in range(numberOfYears):
for j in range(12):
# ma... |
34227607 | Windows Command: how do I push current directory using chdir for popping later? | 15 | 2015-12-11 15:57:37 | <p><strong>Context/Objective:</strong></p>
<p>In windows 7, I'm developing a batch script using regular windows commands. Within this batch, I need to save the current directory first thing so it can be restored when the script finishes running.</p>
<p><strong>What I have tried so for:</strong></p>
<p>I've attempte... | 13,525 | 70,147 | 2015-12-11 16:35:09 | 34,227,875 | 20 | 2015-12-11 16:12:52 | 2,441 | 2015-12-11 16:12:52 | https://stackoverflow.com/q/34227607 | https://stackoverflow.com/a/34227875 | <p>You can use <code>.</code> to represent the current diretory.</p>
<p>Try this:</p>
<pre><code>PUSHD .
REM The rest of you script
POPD
</code></pre>
| <p>You can use <code>.</code> to represent the current diretory.</p> <p>Try this:</p> <pre><code>PUSHD . REM The rest of you script POPD </code></pre> | 64, 1231, 1796, 2631, 7002 | batch-file, cmd, command, command-line, windows | <h1>Windows Command: how do I push current directory using chdir for popping later?</h1>
<p><strong>Context/Objective:</strong></p>
<p>In windows 7, I'm developing a batch script using regular windows commands. Within this batch, I need to save the current directory first thing so it can be restored when the script f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,928 | cmd | # Windows Command: how do I push current directory using chdir for popping later?
**Context/Objective:**
In windows 7, I'm developing a batch script using regular windows commands. Within this batch, I need to save the current directory first thing so it can be restored when the script finishes running.
**What I hav... | You can use `.` to represent the current diretory.
Try this:
```
PUSHD .
REM The rest of you script
POPD
``` |
19006067 | batch script subroutine: Passing arguments | 15 | 2013-09-25 13:18:10 | <p>My understanding is that in order to get the date from a file passed into a subroutine as an argument, you must re-set that argument as a variable within the subroutine. Is this correct? This doesn't make since to me, so I am wondering if I do not fully understand what is going on. I can use the passed in argumen... | 37,606 | 2,759,759 | 2017-09-15 16:59:08 | 19,006,979 | 20 | 2013-09-25 13:57:10 | 1,012,053 | 2017-09-15 16:59:08 | https://stackoverflow.com/q/19006067 | https://stackoverflow.com/a/19006979 | <p>Use <code>%1</code> to access the parameter, not <code>%i%</code>.</p>
<p>The argument variables have the same modifiers as FOR variables, so you can use <code>%~t1</code>.</p>
<p>No need to execute a command in your FOR /F. It is simpler to process a string literal using <code>in ("string")</code>.</p>
<p>No nee... | <p>Use <code>%1</code> to access the parameter, not <code>%i%</code>.</p> <p>The argument variables have the same modifiers as FOR variables, so you can use <code>%~t1</code>.</p> <p>No need to execute a command in your FOR /F. It is simpler to process a string literal using <code>in ("string")</code>.</p> <p>No nee... | 2313, 7002, 18362, 21395 | argument-passing, arguments, batch-file, subroutine | <h1>batch script subroutine: Passing arguments</h1>
<p>My understanding is that in order to get the date from a file passed into a subroutine as an argument, you must re-set that argument as a variable within the subroutine. Is this correct? This doesn't make since to me, so I am wondering if I do not fully understan... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,929 | cmd | # batch script subroutine: Passing arguments
My understanding is that in order to get the date from a file passed into a subroutine as an argument, you must re-set that argument as a variable within the subroutine. Is this correct? This doesn't make since to me, so I am wondering if I do not fully understand what is g... | Use `%1` to access the parameter, not `%i%`.
The argument variables have the same modifiers as FOR variables, so you can use `%~t1`.
No need to execute a command in your FOR /F. It is simpler to process a string literal using `in ("string")`.
No need for `:EOF` label. Every script has an implicit `:eof`. I like to u... |
10534911 | How can I exit a batch file from within a function? | 15 | 2012-05-10 13:21:32 | <p>I have a simple function written to check for directories:</p>
<pre><code>:direxist
if not exist %~1 (
echo %~1 could not be found, check to make sure your location is correct.
goto:end
) else (
echo %~1 is a real directory
goto:eof
)
</code></pre>
<p>:end is written as </p>
<pre><code>:en... | 61,114 | 1,344,232 | 2021-08-26 21:33:13 | 10,535,323 | 20 | 2012-05-10 13:44:45 | 463,115 | 2018-06-27 05:22:59 | https://stackoverflow.com/q/10534911 | https://stackoverflow.com/a/10535323 | <p>I suppose you are mixing <code>call</code> and <code>goto</code> statements here. </p>
<p>A label in a batch file can be used with a <code>call</code> or a <code>goto</code>, but the behaviour is different.<br>
If you <code>call</code> such a <em>function</em> it will return when the function reached the end of th... | <p>I suppose you are mixing <code>call</code> and <code>goto</code> statements here. </p> <p>A label in a batch file can be used with a <code>call</code> or a <code>goto</code>, but the behaviour is different.<br> If you <code>call</code> such a <em>function</em> it will return when the function reached the end of th... | 3996, 7002, 10871 | batch-file, exit, goto | <h1>How can I exit a batch file from within a function?</h1>
<p>I have a simple function written to check for directories:</p>
<pre><code>:direxist
if not exist %~1 (
echo %~1 could not be found, check to make sure your location is correct.
goto:end
) else (
echo %~1 is a real directory
goto:eof
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,930 | cmd | # How can I exit a batch file from within a function?
I have a simple function written to check for directories:
```
:direxist
if not exist %~1 (
echo %~1 could not be found, check to make sure your location is correct.
goto:end
) else (
echo %~1 is a real directory
goto:eof
)
```
:end is wri... | I suppose you are mixing `call` and `goto` statements here.
A label in a batch file can be used with a `call` or a `goto`, but the behaviour is different.
If you `call` such a *function* it will return when the function reached the end of the file or an explicit `exit /b` or `goto :eof` (like your `goto :end`).
The... |
8389312 | Find out windows version from non-privileged user command line | 15 | 2011-12-05 17:27:41 | <p>I need a way to find out what version of windows I'm running in using simple command line tools (no powershell). I need it to work from a non-privileged user, and I need to be able to parse out the difference between Windows XP, Vista, server 2008, and 7. I'm currently using:
<code>wmic os get Caption</code> but t... | 40,274 | 745,412 | 2017-04-09 02:20:49 | 8,391,431 | 20 | 2011-12-05 20:27:58 | 745,412 | 2011-12-05 20:27:58 | https://stackoverflow.com/q/8389312 | https://stackoverflow.com/a/8391431 | <p>I solved this problem by parsing the output of:</p>
<pre><code>reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName"
</code></pre>
| <p>I solved this problem by parsing the output of:</p> <pre><code>reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName" </code></pre> | 64, 2631 | cmd, windows | <h1>Find out windows version from non-privileged user command line</h1>
<p>I need a way to find out what version of windows I'm running in using simple command line tools (no powershell). I need it to work from a non-privileged user, and I need to be able to parse out the difference between Windows XP, Vista, server 2... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,931 | cmd | # Find out windows version from non-privileged user command line
I need a way to find out what version of windows I'm running in using simple command line tools (no powershell). I need it to work from a non-privileged user, and I need to be able to parse out the difference between Windows XP, Vista, server 2008, and 7... | I solved this problem by parsing the output of:
```
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName"
``` |
25444765 | Why does a non-interactive batch script think I've pressed control-C? | 14 | 2014-08-22 10:21:19 | <p>So my batch script is ticking along nicely when suddenly this appears in the output log:</p>
<pre><code>21:27:13.99 c:\apps\w7lab-scripting>some-command
Error 3221225786
^CTerminate batch job (Y/N)?
</code></pre>
<p>and the script stops dead.</p>
<p>The batch script is running in session zero, so I know it di... | 10,492 | 886,887 | 2020-12-09 09:07:41 | 25,444,766 | 20 | 2014-08-22 10:21:19 | 886,887 | 2017-11-25 02:23:32 | https://stackoverflow.com/q/25444765 | https://stackoverflow.com/a/25444766 | <p>The magic here is in exit code 3221225786, aka 0xC000013A or STATUS_CONTROL_C_EXIT.</p>
<p>The interactive application received a control-C, and didn't catch it, so as expected, it was aborted with STATUS_CONTROL_C_EXIT. The <code>some-command</code> application correctly reported this as the remote application's ... | <p>The magic here is in exit code 3221225786, aka 0xC000013A or STATUS_CONTROL_C_EXIT.</p> <p>The interactive application received a control-C, and didn't catch it, so as expected, it was aborted with STATUS_CONTROL_C_EXIT. The <code>some-command</code> application correctly reported this as the remote application's ... | 64, 7002 | batch-file, windows | <h1>Why does a non-interactive batch script think I've pressed control-C?</h1>
<p>So my batch script is ticking along nicely when suddenly this appears in the output log:</p>
<pre><code>21:27:13.99 c:\apps\w7lab-scripting>some-command
Error 3221225786
^CTerminate batch job (Y/N)?
</code></pre>
<p>and the script s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,932 | cmd | # Why does a non-interactive batch script think I've pressed control-C?
So my batch script is ticking along nicely when suddenly this appears in the output log:
```
21:27:13.99 c:\apps\w7lab-scripting>some-command
Error 3221225786
^CTerminate batch job (Y/N)?
```
and the script stops dead.
The batch script is runni... | The magic here is in exit code 3221225786, aka 0xC000013A or STATUS_CONTROL_C_EXIT.
The interactive application received a control-C, and didn't catch it, so as expected, it was aborted with STATUS_CONTROL_C_EXIT. The `some-command` application correctly reported this as the remote application's exit code, and passed ... |
23526361 | How to use batch file to give a folder permission to the Everyone group | 14 | 2014-05-07 19:15:08 | <p>Im trying to add the group <code>Everyone</code> and give it <code>modify</code> permissions on a folder. Im using a batch file to try this. so for I have <code>icacls "C:\Program Files (x86)\Program File" /grant:r Everyone:M</code>
But when I go and look at the permissions on the folder nothing has been changed.</p... | 66,054 | 3,537,335 | 2017-01-10 17:04:03 | 23,526,976 | 20 | 2014-05-07 19:46:39 | 2,746,670 | 2014-05-07 19:46:39 | https://stackoverflow.com/q/23526361 | https://stackoverflow.com/a/23526976 | <p>No need to put <code>:r</code> after <code>/grant</code>. Check the examples by typing <code>icacls /?</code></p>
<p>Do like this:</p>
<pre><code>icacls "C:\Program Files (x86)\Program File" /grant Everyone:M
</code></pre>
| <p>No need to put <code>:r</code> after <code>/grant</code>. Check the examples by typing <code>icacls /?</code></p> <p>Do like this:</p> <pre><code>icacls "C:\Program Files (x86)\Program File" /grant Everyone:M </code></pre> | 359, 2120, 7002, 95942 | batch-file, file-permissions, icacls, permissions | <h1>How to use batch file to give a folder permission to the Everyone group</h1>
<p>Im trying to add the group <code>Everyone</code> and give it <code>modify</code> permissions on a folder. Im using a batch file to try this. so for I have <code>icacls "C:\Program Files (x86)\Program File" /grant:r Everyone:M</code>
But... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,933 | cmd | # How to use batch file to give a folder permission to the Everyone group
Im trying to add the group `Everyone` and give it `modify` permissions on a folder. Im using a batch file to try this. so for I have `icacls "C:\Program Files (x86)\Program File" /grant:r Everyone:M`
But when I go and look at the permissions on ... | No need to put `:r` after `/grant`. Check the examples by typing `icacls /?`
Do like this:
```
icacls "C:\Program Files (x86)\Program File" /grant Everyone:M
``` |
8121238 | "start %comspec% /c script.cmd" vs "start cmd /C script.cmd" | 14 | 2011-11-14 11:59:23 | <p>What is the difference between following commands: </p>
<pre><code>start %comspec% /c script.cmd
start cmd /C script.cmd
</code></pre>
<p>I need that cmd window for script.cmd should close automatically when script.cmd is finished.</p>
| 59,067 | 167,739 | 2022-03-15 11:35:16 | 8,121,351 | 20 | 2011-11-14 12:09:22 | 1,045,436 | 2018-03-01 19:13:25 | https://stackoverflow.com/q/8121238 | https://stackoverflow.com/a/8121351 | <p><strong><code>%comspec%</code> just points to cmd.exe</strong>, so both commands will do the same thing. Other than that <code>/C</code> is correct, this will close the command prompt after execution</p>
| <p><strong><code>%comspec%</code> just points to cmd.exe</strong>, so both commands will do the same thing. Other than that <code>/C</code> is correct, this will close the command prompt after execution</p> | 64, 2631, 7002 | batch-file, cmd, windows | <h1>"start %comspec% /c script.cmd" vs "start cmd /C script.cmd"</h1>
<p>What is the difference between following commands: </p>
<pre><code>start %comspec% /c script.cmd
start cmd /C script.cmd
</code></pre>
<p>I need that cmd window for script.cmd should close automatically when script.cmd is finished.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,934 | cmd | # "start %comspec% /c script.cmd" vs "start cmd /C script.cmd"
What is the difference between following commands:
```
start %comspec% /c script.cmd
start cmd /C script.cmd
```
I need that cmd window for script.cmd should close automatically when script.cmd is finished. | **`%comspec%` just points to cmd.exe**, so both commands will do the same thing. Other than that `/C` is correct, this will close the command prompt after execution |
1869057 | How to delete multiple db entities with Nhibernate? | 14 | 2009-12-08 18:50:22 | <p>What is the best practice for this problem? Is there any batching features built-in? </p>
<p>Sample code:</p>
<pre><code>using (ITransaction transaction = _session.BeginTransaction())
{
_session.Delete("FROM myObject o WHERE o.Id = IN(1,2,...99999)");
transaction.Commit();
}
</code></pre>
<p>Thanks in adva... | 23,438 | 49,881 | 2019-07-04 16:22:28 | 1,869,214 | 20 | 2009-12-08 19:17:26 | 30,587 | 2019-07-04 16:22:28 | https://stackoverflow.com/q/1869057 | https://stackoverflow.com/a/1869214 | <p>HQL supports the IN clause, and if you use setParameterList you can even pass in a collection.</p>
<pre><code>var idList = new List<int>() { 5,3,6,7 };
_session.CreateQuery("DELETE MyDataClass o WHERE o.Id IN (:idList)")
.SetParameterList("idList", idList)
.ExecuteUpdate();
</code></pre>
<p>Be aware... | <p>HQL supports the IN clause, and if you use setParameterList you can even pass in a collection.</p> <pre><code>var idList = new List<int>() { 5,3,6,7 }; _session.CreateQuery("DELETE MyDataClass o WHERE o.Id IN (:idList)") .SetParameterList("idList", idList) .ExecuteUpdate(); </code></pre> <p>Be aware... | 9, 352, 2620, 7002, 30645 | batch-file, batch-processing, c#, hibernate, nhibernate | <h1>How to delete multiple db entities with Nhibernate?</h1>
<p>What is the best practice for this problem? Is there any batching features built-in? </p>
<p>Sample code:</p>
<pre><code>using (ITransaction transaction = _session.BeginTransaction())
{
_session.Delete("FROM myObject o WHERE o.Id = IN(1,2,...99999)")... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,935 | cmd | # How to delete multiple db entities with Nhibernate?
What is the best practice for this problem? Is there any batching features built-in?
Sample code:
```
using (ITransaction transaction = _session.BeginTransaction())
{
_session.Delete("FROM myObject o WHERE o.Id = IN(1,2,...99999)");
transaction.Commit();
}... | HQL supports the IN clause, and if you use setParameterList you can even pass in a collection.
```
var idList = new List<int>() { 5,3,6,7 };
_session.CreateQuery("DELETE MyDataClass o WHERE o.Id IN (:idList)")
.SetParameterList("idList", idList)
.ExecuteUpdate();
```
Be aware, like mentioned by ddango in a c... |
22247390 | How to get user input - batch? | 13 | 2014-03-07 10:21:46 | <p>So I want to code an optional, where the user can input y or n, shut down. And this is what I have been trying:</p>
<pre><code> @echo off
echo ---WARNING---
echo.
echo DO YOU WANT YOUR COMPUTER TO SHUTDOWN? (y/n)
If /I "%Input%"=="y" goto yes
If /I "%Input... | 33,770 | 3,392,119 | 2021-04-07 00:14:22 | 22,247,539 | 20 | 2014-03-07 10:28:02 | 2,964,427 | 2021-04-07 00:14:22 | https://stackoverflow.com/q/22247390 | https://stackoverflow.com/a/22247539 | <p>Try adding this.</p>
<pre><code>set /p Input=Enter Yes or No:
</code></pre>
<p>I have also added a <code>goto</code> because if you typed something that isn't a yes or a no then it would have automatically gone to yes. Failing the below code you could add this but the code at the bottom should work.</p>
<pre><code>s... | <p>Try adding this.</p> <pre><code>set /p Input=Enter Yes or No: </code></pre> <p>I have also added a <code>goto</code> because if you typed something that isn't a yes or a no then it would have automatically gone to yes. Failing the below code you could add this but the code at the bottom should work.</p> <pre><code>s... | 7002 | batch-file | <h1>How to get user input - batch?</h1>
<p>So I want to code an optional, where the user can input y or n, shut down. And this is what I have been trying:</p>
<pre><code> @echo off
echo ---WARNING---
echo.
echo DO YOU WANT YOUR COMPUTER TO SHUTDOWN? (y/n)
If /I "... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,936 | cmd | # How to get user input - batch?
So I want to code an optional, where the user can input y or n, shut down. And this is what I have been trying:
```
@echo off
echo ---WARNING---
echo.
echo DO YOU WANT YOUR COMPUTER TO SHUTDOWN? (y/n)
If /I "%Input%"=="y" goto y... | Try adding this.
```
set /p Input=Enter Yes or No:
```
I have also added a `goto` because if you typed something that isn't a yes or a no then it would have automatically gone to yes. Failing the below code you could add this but the code at the bottom should work.
```
set /P INPUT=Type input: %=%
If %INPUT%=="y" go... |
9905740 | Incorrect encoding after redirecting `dir` output to a file | 12 | 2012-03-28 10:36:32 | <p>I run this code on Windows cmd.exe in Europe and I use local settings here, for my language. So I use diacritics in names of the directories.</p>
<p>I try to list names of the directories and they are displayed correctly. Then I save them into file, but when I open it in notepad, the diacritics is not readable: for... | 14,486 | 1,141,649 | 2017-05-30 14:11:43 | 9,906,184 | 20 | 2012-03-28 11:04:49 | 835,945 | 2016-09-22 22:46:03 | https://stackoverflow.com/q/9905740 | https://stackoverflow.com/a/9906184 | <p>Try starting cmd.exe with /u switch. That will cause cmd to write in UTF-16.</p>
<p>Also you need to switch to code page 1250 (ANSI for Central Europe) using <code>chcp 1250</code>.</p>
<p>You can do it inside your batch script. I made one for you. The structure is:</p>
<pre><code>.\Jižní Morava
.\Jižní Morava\s... | <p>Try starting cmd.exe with /u switch. That will cause cmd to write in UTF-16.</p> <p>Also you need to switch to code page 1250 (ANSI for Central Europe) using <code>chcp 1250</code>.</p> <p>You can do it inside your batch script. I made one for you. The structure is:</p> <pre><code>.\Jižní Morava .\Jižní Morava\s... | 1124, 2631, 7002 | batch-file, cmd, encoding | <h1>Incorrect encoding after redirecting `dir` output to a file</h1>
<p>I run this code on Windows cmd.exe in Europe and I use local settings here, for my language. So I use diacritics in names of the directories.</p>
<p>I try to list names of the directories and they are displayed correctly. Then I save them into fil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,937 | cmd | # Incorrect encoding after redirecting `dir` output to a file
I run this code on Windows cmd.exe in Europe and I use local settings here, for my language. So I use diacritics in names of the directories.
I try to list names of the directories and they are displayed correctly. Then I save them into file, but when I op... | Try starting cmd.exe with /u switch. That will cause cmd to write in UTF-16.
Also you need to switch to code page 1250 (ANSI for Central Europe) using `chcp 1250`.
You can do it inside your batch script. I made one for you. The structure is:
```
.\Jižní Morava
.\Jižní Morava\scenery
.\Pelhřimov
.\Pelhřimov\scenery
.... |
4609390 | How to get the current line number? | 12 | 2011-01-05 21:28:07 | <p>I'm trying to build a generic batch file that can tell errors with a line number, where the error occours.<br>
But writing each line number in the code is a little bit annoying.</p>
<p>Is it possible to get the current line number, while a batch-file is running?<br>
So that the following code can work?</p>
<pre><c... | 8,476 | 463,115 | 2018-06-12 11:43:28 | 4,683,824 | 20 | 2011-01-13 18:37:11 | 463,115 | 2011-06-22 13:25:10 | https://stackoverflow.com/q/4609390 | https://stackoverflow.com/a/4683824 | <p>There is always way...<br>
I found not the perfect solution, but a good workaround I can use. </p>
<p>I call a function which searches the own batch file(<code>%~f0</code>) with findStr, for the function parameter <code><uniqueID></code>, so this works only if these <code><uniqueID></code>'s are really... | <p>There is always way...<br> I found not the perfect solution, but a good workaround I can use. </p> <p>I call a function which searches the own batch file(<code>%~f0</code>) with findStr, for the function parameter <code><uniqueID></code>, so this works only if these <code><uniqueID></code>'s are really... | 2631, 7002 | batch-file, cmd | <h1>How to get the current line number?</h1>
<p>I'm trying to build a generic batch file that can tell errors with a line number, where the error occours.<br>
But writing each line number in the code is a little bit annoying.</p>
<p>Is it possible to get the current line number, while a batch-file is running?<br>
So t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,938 | cmd | # How to get the current line number?
I'm trying to build a generic batch file that can tell errors with a line number, where the error occours.
But writing each line number in the code is a little bit annoying.
Is it possible to get the current line number, while a batch-file is running?
So that the following co... | There is always way...
I found not the perfect solution, but a good workaround I can use.
I call a function which searches the own batch file(`%~f0`) with findStr, for the function parameter `<uniqueID>`, so this works only if these `<uniqueID>`'s are really unique for the whole batch.
The linenumber is get from t... |
1655140 | Spring: Getting FactoryBean object instead of FactoryBean.getObject() | 12 | 2009-10-31 18:16:06 | <p><strong>Short question:</strong> If I have class that impelemnts FactoryBean interface, how can I get from FactoryBean object itself instead of FactoryBean.getObject()?</p>
<p><strong>Long question:</strong> I have to use 3-rd party Spring based library which is hardly use FactoryBean interface. Right now I always ... | 10,204 | 19,347 | 2012-08-20 10:05:05 | 1,656,128 | 20 | 2009-11-01 01:42:48 | 75,126 | 2012-08-20 10:05:05 | https://stackoverflow.com/q/1655140 | https://stackoverflow.com/a/1656128 | <p>It's the <code>&</code> (ampersand), not the At-symbol, see Spring Framework documentation: <a href="http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-factory-extension-factorybean" rel="noreferrer">Customizing instantiation logic using FactoryBeans</a></p>
<pre><code><property name... | <p>It's the <code>&</code> (ampersand), not the At-symbol, see Spring Framework documentation: <a href="http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-factory-extension-factorybean" rel="noreferrer">Customizing instantiation logic using FactoryBeans</a></p> <pre><code><property name... | 17, 1211, 2697, 41895 | factory, java, spring, spring-batch | <h1>Spring: Getting FactoryBean object instead of FactoryBean.getObject()</h1>
<p><strong>Short question:</strong> If I have class that impelemnts FactoryBean interface, how can I get from FactoryBean object itself instead of FactoryBean.getObject()?</p>
<p><strong>Long question:</strong> I have to use 3-rd party Spri... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,939 | cmd | # Spring: Getting FactoryBean object instead of FactoryBean.getObject()
**Short question:** If I have class that impelemnts FactoryBean interface, how can I get from FactoryBean object itself instead of FactoryBean.getObject()?
**Long question:** I have to use 3-rd party Spring based library which is hardly use Facto... | It's the `&` (ampersand), not the At-symbol, see Spring Framework documentation: [Customizing instantiation logic using FactoryBeans](http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-factory-extension-factorybean)
```
<property name="factoryBean" ref="&theFactoryBean" />
``` |
34942604 | Get Parent directory of a specific path in batch script | 11 | 2016-01-22 08:57:41 | <p>Hi I have full file path in a variable of batch file. How to get its first and second level parent directory path?</p>
<pre><code>set path=C:\SecondParent\FirstParent\testfile.ini
</code></pre>
| 28,836 | 2,586,626 | 2019-01-24 11:58:47 | 34,942,800 | 20 | 2016-01-22 09:07:51 | 388,389 | 2016-01-22 09:45:14 | https://stackoverflow.com/q/34942604 | https://stackoverflow.com/a/34942800 | <p>do not use variable <a href="http://ss64.com/nt/path.html" rel="noreferrer">PATH</a> for this. %PATH% is a built-in variable used by the command prompt.</p>
<pre><code>@echo off
set "_path=C:\SecondParent\FirstParent\testfile.ini"
for %%a in ("%_path%") do set "p_dir=%%~dpa"
echo %p_dir%
for %%a in (%p_dir:~0,-1%) ... | <p>do not use variable <a href="http://ss64.com/nt/path.html" rel="noreferrer">PATH</a> for this. %PATH% is a built-in variable used by the command prompt.</p> <pre><code>@echo off set "_path=C:\SecondParent\FirstParent\testfile.ini" for %%a in ("%_path%") do set "p_dir=%%~dpa" echo %p_dir% for %%a in (%p_dir:~0,-1%) ... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>Get Parent directory of a specific path in batch script</h1>
<p>Hi I have full file path in a variable of batch file. How to get its first and second level parent directory path?</p>
<pre><code>set path=C:\SecondParent\FirstParent\testfile.ini
</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,940 | cmd | # Get Parent directory of a specific path in batch script
Hi I have full file path in a variable of batch file. How to get its first and second level parent directory path?
```
set path=C:\SecondParent\FirstParent\testfile.ini
``` | do not use variable [PATH](http://ss64.com/nt/path.html) for this. %PATH% is a built-in variable used by the command prompt.
```
@echo off
set "_path=C:\SecondParent\FirstParent\testfile.ini"
for %%a in ("%_path%") do set "p_dir=%%~dpa"
echo %p_dir%
for %%a in (%p_dir:~0,-1%) do set "p2_dir=%%~dpa"
echo %p2_dir%
``` |
3253520 | IF EXIST C:\directory\ goto a else goto b problems windows XP batch files | 11 | 2010-07-15 07:52:27 | <p>whenever i run the <code>code</code> below it occurs to me I have made a mistake using the if exist lines, as no matter whether the directory exists or not, it acts as if the line was never there... either that or its not reading the else line.</p>
<hr>
<pre><code>echo off
echo
echo (c) Ryan Leach 2010
echo ... | 304,191 | 306,036 | 2018-10-19 05:57:39 | 3,253,622 | 20 | 2010-07-15 08:08:38 | 73,070 | 2010-07-15 08:22:47 | https://stackoverflow.com/q/3253520 | https://stackoverflow.com/a/3253622 | <p>Use parentheses to group the individual branches:</p>
<pre><code>IF EXIST D:\RPS_BACKUP\backups_to_zip\ (goto zipexist) else goto zipexistcontinue
</code></pre>
<p>In your case the parser won't ever see the <code>else</code> belonging to the <code>if</code> because <code>goto</code> will happily accept everything ... | <p>Use parentheses to group the individual branches:</p> <pre><code>IF EXIST D:\RPS_BACKUP\backups_to_zip\ (goto zipexist) else goto zipexistcontinue </code></pre> <p>In your case the parser won't ever see the <code>else</code> belonging to the <code>if</code> because <code>goto</code> will happily accept everything ... | 2216, 2773, 7002 | batch-file, if-statement, windows-xp | <h1>IF EXIST C:\directory\ goto a else goto b problems windows XP batch files</h1>
<p>whenever i run the <code>code</code> below it occurs to me I have made a mistake using the if exist lines, as no matter whether the directory exists or not, it acts as if the line was never there... either that or its not reading the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,942 | cmd | # IF EXIST C:\directory\ goto a else goto b problems windows XP batch files
whenever i run the `code` below it occurs to me I have made a mistake using the if exist lines, as no matter whether the directory exists or not, it acts as if the line was never there... either that or its not reading the else line.
---
```... | Use parentheses to group the individual branches:
```
IF EXIST D:\RPS_BACKUP\backups_to_zip\ (goto zipexist) else goto zipexistcontinue
```
In your case the parser won't ever see the `else` belonging to the `if` because `goto` will happily accept everything up to the end of the command. You can see a similar issue wh... |
8196314 | How do you change file association for .py Python files in XP? | 10 | 2011-11-19 18:39:35 | <p>When I type <code>assoc .py</code> I get <code>.py=py_auto_file</code>.
When I type <code>ftype py_auto_file</code> I get <code>py_auto_file="C:\Program Files\Adobe\Photoshop 7.0\Photoshop.exe" "%1"</code></p>
<p>How do I make <code>py_auto_file="C:\Python27"</code>?</p>
| 16,813 | null | 2022-10-11 04:31:33 | 8,196,691 | 20 | 2011-11-19 19:36:04 | 235,698 | 2011-11-19 19:36:04 | https://stackoverflow.com/q/8196314 | https://stackoverflow.com/a/8196691 | <p>It appears Photoshop may recognize a .py file format and has associated "py_auto_file" with the .py extension.</p>
<p>You can use the following command to locate the python file types:</p>
<pre><code>C:\>ftype | findstr -i python
Python.CompiledFile="C:\Python27\python.exe" "%1" %*
Python.File="C:\Python27\pyth... | <p>It appears Photoshop may recognize a .py file format and has associated "py_auto_file" with the .py extension.</p> <p>You can use the following command to locate the python file types:</p> <pre><code>C:\>ftype | findstr -i python Python.CompiledFile="C:\Python27\python.exe" "%1" %* Python.File="C:\Python27\pyth... | 16, 64, 2216, 2631, 15622 | cmd, file-association, python, windows, windows-xp | <h1>How do you change file association for .py Python files in XP?</h1>
<p>When I type <code>assoc .py</code> I get <code>.py=py_auto_file</code>.
When I type <code>ftype py_auto_file</code> I get <code>py_auto_file="C:\Program Files\Adobe\Photoshop 7.0\Photoshop.exe" "%1"</code></p>
<p>How do I make <code>py_auto_fil... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,943 | cmd | # How do you change file association for .py Python files in XP?
When I type `assoc .py` I get `.py=py_auto_file`.
When I type `ftype py_auto_file` I get `py_auto_file="C:\Program Files\Adobe\Photoshop 7.0\Photoshop.exe" "%1"`
How do I make `py_auto_file="C:\Python27"`? | It appears Photoshop may recognize a .py file format and has associated "py_auto_file" with the .py extension.
You can use the following command to locate the python file types:
```
C:\>ftype | findstr -i python
Python.CompiledFile="C:\Python27\python.exe" "%1" %*
Python.File="C:\Python27\python.exe" "%1" %*
Python.N... |
3295578 | Set Specific IIS 7 Site with AppCmd? | 10 | 2010-07-21 01:04:41 | <p>I have an IIS 7 machine with multiple apps/vdirs on the single default
web site. I would like to set two of them with this authentication:
anonymous - off
impersonation - on
forms auth - off
windows auth - on</p>
<p>I would like to do this with appcmd.exe but cannot seem to get the
syntax down right. Has anyone had... | 6,528 | 139,618 | 2015-11-04 20:40:18 | 3,296,095 | 20 | 2010-07-21 03:30:45 | 191,591 | 2010-07-21 03:30:45 | https://stackoverflow.com/q/3295578 | https://stackoverflow.com/a/3296095 | <p>You should try Configuration Editor (included in IIS 7.5 and available for download for IIS 7.0 at <a href="http://www.iis.net/download/AdministrationPack" rel="noreferrer">http://www.iis.net/download/AdministrationPack</a>), it can generate the AppCmd.exe commands automatically as well as javascript and managed cod... | <p>You should try Configuration Editor (included in IIS 7.5 and available for download for IIS 7.0 at <a href="http://www.iis.net/download/AdministrationPack" rel="noreferrer">http://www.iis.net/download/AdministrationPack</a>), it can generate the AppCmd.exe commands automatically as well as javascript and managed cod... | 183, 531, 1301, 7002 | authentication, batch-file, iis-7, scripting | <h1>Set Specific IIS 7 Site with AppCmd?</h1>
<p>I have an IIS 7 machine with multiple apps/vdirs on the single default
web site. I would like to set two of them with this authentication:
anonymous - off
impersonation - on
forms auth - off
windows auth - on</p>
<p>I would like to do this with appcmd.exe but cannot see... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,944 | cmd | # Set Specific IIS 7 Site with AppCmd?
I have an IIS 7 machine with multiple apps/vdirs on the single default
web site. I would like to set two of them with this authentication:
anonymous - off
impersonation - on
forms auth - off
windows auth - on
I would like to do this with appcmd.exe but cannot seem to get the
syn... | You should try Configuration Editor (included in IIS 7.5 and available for download for IIS 7.0 at <http://www.iis.net/download/AdministrationPack>), it can generate the AppCmd.exe commands automatically as well as javascript and managed code. Using it I generated the following (for default web site):
```
appcmd.exe s... |
27107723 | How to make notepad++ function like regular notepad in cmd? | 9 | 2014-11-24 14:58:27 | <p>I like using the command prompt to write and compile java.
To write the code I enter this in cmd:</p>
<p>notepad MyJavaClass.java</p>
<p>This opens notepad and asks if I want to create new file (If it doesn't already exist).
The problem for me is that I like using notepad++ as a text editor because it has nice fea... | 20,604 | 4,184,412 | 2025-02-27 06:05:22 | 27,107,912 | 20 | 2014-11-24 15:06:46 | 2,864,464 | 2019-08-14 09:12:24 | https://stackoverflow.com/q/27107723 | https://stackoverflow.com/a/27107912 | <p>Add notepad++ to your <code>path</code></p>
<p><strong>In Windows (Using GUI):</strong> </p>
<p>From the Start Menu, right-click Computer, select Advanced system settings in the left area, then select Environment Variables at the bottom in the window that pops up.</p>
<p>Go to the PATH user variable and click edi... | <p>Add notepad++ to your <code>path</code></p> <p><strong>In Windows (Using GUI):</strong> </p> <p>From the Start Menu, right-click Computer, select Advanced system settings in the left area, then select Environment Variables at the bottom in the window that pops up.</p> <p>Go to the PATH user variable and click edi... | 17, 2631, 8193 | cmd, java, notepad++ | <h1>How to make notepad++ function like regular notepad in cmd?</h1>
<p>I like using the command prompt to write and compile java.
To write the code I enter this in cmd:</p>
<p>notepad MyJavaClass.java</p>
<p>This opens notepad and asks if I want to create new file (If it doesn't already exist).
The problem for me is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,945 | cmd | # How to make notepad++ function like regular notepad in cmd?
I like using the command prompt to write and compile java.
To write the code I enter this in cmd:
notepad MyJavaClass.java
This opens notepad and asks if I want to create new file (If it doesn't already exist).
The problem for me is that I like using note... | Add notepad++ to your `path`
**In Windows (Using GUI):**
From the Start Menu, right-click Computer, select Advanced system settings in the left area, then select Environment Variables at the bottom in the window that pops up.
Go to the PATH user variable and click edit, and append YOUR path to notepad++ to the end.
... |
17908789 | how to add an item to registry to run at startup without UAC | 9 | 2013-07-28 13:39:10 | <p>i have a program that needs to be started when windows starts. I have created a string value in registry <code>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\</code><br>
For this application starts at startup but it shows an UAC prompt. Normally my application does not need UAC promt to start. If i make a shortc... | 64,027 | 2,371,021 | 2022-07-19 12:47:00 | 17,916,927 | 20 | 2013-07-29 05:56:16 | 379,840 | 2013-08-03 15:25:34 | https://stackoverflow.com/q/17908789 | https://stackoverflow.com/a/17916927 | <p>You can always start it for a single user, this command can be run by a normal user, and will enable the application on startup for just that user.</p>
<pre><code>REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "My App" /t REG_SZ /F /D "C:\MyAppPath\MyApp.exe"
</code></pre>
<p>You cannot add someth... | <p>You can always start it for a single user, this command can be run by a normal user, and will enable the application on startup for just that user.</p> <pre><code>REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "My App" /t REG_SZ /F /D "C:\MyAppPath\MyApp.exe" </code></pre> <p>You cannot add someth... | 263, 1980, 7002, 7457 | batch-file, registry, startup, uac | <h1>how to add an item to registry to run at startup without UAC</h1>
<p>i have a program that needs to be started when windows starts. I have created a string value in registry <code>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\</code><br>
For this application starts at startup but it shows an UAC prompt. Normal... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,946 | cmd | # how to add an item to registry to run at startup without UAC
i have a program that needs to be started when windows starts. I have created a string value in registry `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\`
For this application starts at startup but it shows an UAC prompt. Normally my application does... | You can always start it for a single user, this command can be run by a normal user, and will enable the application on startup for just that user.
```
REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "My App" /t REG_SZ /F /D "C:\MyAppPath\MyApp.exe"
```
You cannot add something to the local machine ru... |
12976848 | Exclude folders in batch-copy-script | 9 | 2012-10-19 14:52:31 | <p>I am using a batch file on a USB stick to backup my pictures. I use the following command:</p>
<pre><code>for /r C:\ %%x in (*.jpg *.png *.gif) do @copy /y %%x .
</code></pre>
<p>I want to exclude files in the mailfolder WINDOWS and PROGRAM FILES.</p>
<p>Does anyone have an idea how I can do this with a batch fil... | 20,192 | 1,759,708 | 2016-04-02 06:02:16 | 12,976,922 | 20 | 2012-10-19 14:55:40 | 246,342 | 2012-10-19 15:08:58 | https://stackoverflow.com/q/12976848 | https://stackoverflow.com/a/12976922 | <p>Drop <code>COPY</code> and use <a href="http://ss64.com/nt/robocopy.html" rel="noreferrer"><code>ROBOCOPY</code></a> which exists in Windows Vista+ & is downloadable for prior versions.</p>
<p>It supports <code>/XD</code> to exclude specific directories & <code>/XF</code> to exclude file masks at the comman... | <p>Drop <code>COPY</code> and use <a href="http://ss64.com/nt/robocopy.html" rel="noreferrer"><code>ROBOCOPY</code></a> which exists in Windows Vista+ & is downloadable for prior versions.</p> <p>It supports <code>/XD</code> to exclude specific directories & <code>/XF</code> to exclude file masks at the comman... | 7002, 48830 | batch-file, file-copying | <h1>Exclude folders in batch-copy-script</h1>
<p>I am using a batch file on a USB stick to backup my pictures. I use the following command:</p>
<pre><code>for /r C:\ %%x in (*.jpg *.png *.gif) do @copy /y %%x .
</code></pre>
<p>I want to exclude files in the mailfolder WINDOWS and PROGRAM FILES.</p>
<p>Does anyone h... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,947 | cmd | # Exclude folders in batch-copy-script
I am using a batch file on a USB stick to backup my pictures. I use the following command:
```
for /r C:\ %%x in (*.jpg *.png *.gif) do @copy /y %%x .
```
I want to exclude files in the mailfolder WINDOWS and PROGRAM FILES.
Does anyone have an idea how I can do this with a bat... | Drop `COPY` and use [`ROBOCOPY`](http://ss64.com/nt/robocopy.html) which exists in Windows Vista+ & is downloadable for prior versions.
It supports `/XD` to exclude specific directories & `/XF` to exclude file masks at the command line.
E.g.
```
robocopy.exe c:\ c:\destination\ *.jpg *.png *.gif /xd "Program files" ... |
59634780 | correct order for SpatialDropout2D, BatchNormalization and activation function? | 8 | 2020-01-07 19:20:39 | <p>For a CNN architecture I want to use SpatialDropout2D layer instead of Dropout layer.
Additionaly I want to use BatchNormalization.
So far I had always set the BatchNormalization directly after a Convolutional layer but before the activation function, as in the paper by Ioffe and Szegedy mentioned.
The dropout layer... | 5,801 | 10,629,062 | 2021-01-16 13:51:52 | 59,635,195 | 20 | 2020-01-07 19:50:25 | 2,097,240 | 2021-01-16 13:51:52 | https://stackoverflow.com/q/59634780 | https://stackoverflow.com/a/59635195 | <h2>Dropout vs BatchNormalization - Standard deviation issue</h2>
<p>There is a big problem that appears when you mix these layers, especially when <code>BatchNormalization</code> is right after <code>Dropout</code>.</p>
<p>Dropouts try to keep the same mean of the outputs without dropouts, but it does change the stand... | <h2>Dropout vs BatchNormalization - Standard deviation issue</h2> <p>There is a big problem that appears when you mix these layers, especially when <code>BatchNormalization</code> is right after <code>Dropout</code>.</p> <p>Dropouts try to keep the same mean of the outputs without dropouts, but it does change the stand... | 112144, 118183, 124994, 132077 | activation-function, batch-normalization, dropout, keras | <h1>correct order for SpatialDropout2D, BatchNormalization and activation function?</h1>
<p>For a CNN architecture I want to use SpatialDropout2D layer instead of Dropout layer.
Additionaly I want to use BatchNormalization.
So far I had always set the BatchNormalization directly after a Convolutional layer but before t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,948 | cmd | # correct order for SpatialDropout2D, BatchNormalization and activation function?
For a CNN architecture I want to use SpatialDropout2D layer instead of Dropout layer.
Additionaly I want to use BatchNormalization.
So far I had always set the BatchNormalization directly after a Convolutional layer but before the activa... | ## Dropout vs BatchNormalization - Standard deviation issue
There is a big problem that appears when you mix these layers, especially when `BatchNormalization` is right after `Dropout`.
Dropouts try to keep the same mean of the outputs without dropouts, but it does change the standard deviation, which will cause a hu... |
166044 | Sleeping in a batch file | 164 | 2008-10-03 09:10:29 | <p>When writing a batch file to automate something on a Windows box, I've needed to pause its execution for several seconds (usually in a test/wait loop, waiting for a process to start). At the time, the best solution I could find uses ping (I kid you not) to achieve the desired effect. I've found a better write-up of ... | 158,435 | 2,193 | 2024-09-20 17:24:59 | 166,290 | 19 | 2008-10-03 10:42:19 | 6,899 | 2020-01-23 13:30:27 | https://stackoverflow.com/q/166044 | https://stackoverflow.com/a/166290 | <h1>UPDATE</h1>
<p>The <code>timeout</code> command, available from Windows Vista and onwards should be the command used, as described in another <a href="https://stackoverflow.com/a/5483958/6899">answer</a> to this question. What follows here is an <em>old</em> answer.</p>
<h3>Old answer</h3>
<p>If you have Python in... | <h1>UPDATE</h1> <p>The <code>timeout</code> command, available from Windows Vista and onwards should be the command used, as described in another <a href="https://stackoverflow.com/a/5483958/6899">answer</a> to this question. What follows here is an <em>old</em> answer.</p> <h3>Old answer</h3> <p>If you have Python in... | 16, 7002 | batch-file, python | <h1>Sleeping in a batch file</h1>
<p>When writing a batch file to automate something on a Windows box, I've needed to pause its execution for several seconds (usually in a test/wait loop, waiting for a process to start). At the time, the best solution I could find uses ping (I kid you not) to achieve the desired effect... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,949 | cmd | # Sleeping in a batch file
When writing a batch file to automate something on a Windows box, I've needed to pause its execution for several seconds (usually in a test/wait loop, waiting for a process to start). At the time, the best solution I could find uses ping (I kid you not) to achieve the desired effect. I've fo... | # UPDATE
The `timeout` command, available from Windows Vista and onwards should be the command used, as described in another [answer](https://stackoverflow.com/a/5483958/6899) to this question. What follows here is an *old* answer.
### Old answer
If you have Python installed, or don't mind installing it (it has othe... |
31933766 | Start up cmder ConEmu console in a specific folder | 38 | 2015-08-11 05:20:27 | <p>I want start my Cmder console in this route <strong>C:\xampp\htdocs</strong>, but I don't understand the syntax of 'Task parameters'. For example:</p>
<pre><code> `/icon "%CMDER_ROOT%\cmder.exe`"
</code></pre>
<p>Can anyone translate for this? <code>C:\xampp\htdocs to -> /icon "%CMDER_ROOT%\cmder.exe</code>"</p... | 34,898 | 3,869,551 | 2022-06-15 05:02:32 | 31,936,054 | 19 | 2015-08-11 07:48:36 | 1,405,560 | 2015-08-11 07:48:36 | https://stackoverflow.com/q/31933766 | https://stackoverflow.com/a/31936054 | <p>Change <code>%USERPROFILE%</code> to desired folder instead.</p>
| <p>Change <code>%USERPROFILE%</code> to desired folder instead.</p> | 64, 2631, 85755, 106510 | cmd, cmder, conemu, windows | <h1>Start up cmder ConEmu console in a specific folder</h1>
<p>I want start my Cmder console in this route <strong>C:\xampp\htdocs</strong>, but I don't understand the syntax of 'Task parameters'. For example:</p>
<pre><code> `/icon "%CMDER_ROOT%\cmder.exe`"
</code></pre>
<p>Can anyone translate for this? <code>C:\xa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,950 | cmd | # Start up cmder ConEmu console in a specific folder
I want start my Cmder console in this route **C:\xampp\htdocs**, but I don't understand the syntax of 'Task parameters'. For example:
```
`/icon "%CMDER_ROOT%\cmder.exe`"
```
Can anyone translate for this? `C:\xampp\htdocs to -> /icon "%CMDER_ROOT%\cmder.exe`"
S... | Change `%USERPROFILE%` to desired folder instead. |
32781751 | What is the reason for the CD /D switch in Windows cmd? | 25 | 2015-09-25 12:00:46 | <p>First I would like to note that I <strong>do</strong> understand the purpose of the <code>/D</code> switch for the Windows Command Prompt <code>cd</code> command. I'm just curious why it works this way and not otherwise. As we know from the help:</p>
<blockquote>
<p>Use the <strong>/D</strong> switch to change curre... | 51,500 | 2,004,438 | 2023-03-02 03:21:02 | 32,781,842 | 19 | 2015-09-25 12:05:45 | 773,879 | 2023-03-02 03:21:02 | https://stackoverflow.com/q/32781751 | https://stackoverflow.com/a/32781842 | <p>Short answer: Because DOS behaved this way, and <code>cmd</code> tries to mimic DOS.</p>
<p>Originally, DOS had a 'current director' for each drive, so if you write <code>cd d:\folder</code> you change the current directory for the <code>D</code> drive.</p>
<p>You can read more about this here:
<a href="https://devb... | <p>Short answer: Because DOS behaved this way, and <code>cmd</code> tries to mimic DOS.</p> <p>Originally, DOS had a 'current director' for each drive, so if you write <code>cd d:\folder</code> you change the current directory for the <code>D</code> drive.</p> <p>You can read more about this here: <a href="https://devb... | 64, 1231, 2631, 3718, 9938 | cd, cmd, command-line, command-prompt, windows | <h1>What is the reason for the CD /D switch in Windows cmd?</h1>
<p>First I would like to note that I <strong>do</strong> understand the purpose of the <code>/D</code> switch for the Windows Command Prompt <code>cd</code> command. I'm just curious why it works this way and not otherwise. As we know from the help:</p>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,951 | cmd | # What is the reason for the CD /D switch in Windows cmd?
First I would like to note that I **do** understand the purpose of the `/D` switch for the Windows Command Prompt `cd` command. I'm just curious why it works this way and not otherwise. As we know from the help:
> Use the **/D** switch to change current drive ... | Short answer: Because DOS behaved this way, and `cmd` tries to mimic DOS.
Originally, DOS had a 'current director' for each drive, so if you write `cd d:\folder` you change the current directory for the `D` drive.
You can read more about this here:
<https://devblogs.microsoft.com/oldnewthing/20101011-00/?p=12563> |
42283939 | Set variable inside IF statement (windows batch file) | 22 | 2017-02-16 20:27:07 | <p>I'm trying to make a batch file that will check your computer's name, and then it will set your IP address to the corresponding IP address for that computer.</p>
<p>I have a variable called IPAddress that stores the new IP address. Then I have an IF statement to check the computer name and assign the new IP address... | 52,781 | 3,076,336 | 2017-02-16 21:14:49 | 42,284,332 | 19 | 2017-02-16 20:50:26 | 5,269,570 | 2017-02-16 20:50:26 | https://stackoverflow.com/q/42283939 | https://stackoverflow.com/a/42284332 | <p>You can either use <a href="https://stackoverflow.com/questions/10558316/example-of-delayed-expansion-in-batch-file">delayed expansion</a>, or simplify your script to call an external label which isn't bound to the limitations of the current expansion.<br></p>
<p>Simplified script:</p>
<pre><code>@echo off
SET "IP... | <p>You can either use <a href="https://stackoverflow.com/questions/10558316/example-of-delayed-expansion-in-batch-file">delayed expansion</a>, or simplify your script to call an external label which isn't bound to the limitations of the current expansion.<br></p> <p>Simplified script:</p> <pre><code>@echo off SET "IP... | 7002 | batch-file | <h1>Set variable inside IF statement (windows batch file)</h1>
<p>I'm trying to make a batch file that will check your computer's name, and then it will set your IP address to the corresponding IP address for that computer.</p>
<p>I have a variable called IPAddress that stores the new IP address. Then I have an IF sta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,952 | cmd | # Set variable inside IF statement (windows batch file)
I'm trying to make a batch file that will check your computer's name, and then it will set your IP address to the corresponding IP address for that computer.
I have a variable called IPAddress that stores the new IP address. Then I have an IF statement to check ... | You can either use [delayed expansion](https://stackoverflow.com/questions/10558316/example-of-delayed-expansion-in-batch-file), or simplify your script to call an external label which isn't bound to the limitations of the current expansion.
Simplified script:
```
@echo off
SET "IPAddress=192.168.1.1"
IF "%computerna... |
41163737 | How to connect to a WiFi using CMD only? | 20 | 2016-12-15 12:03:32 | <p>How to connect to a new WiFi by enter a password using CMD?</p>
<p>For my school project I have decided to make a WiFi_manager program using cmd.</p>
<p>I know to display all WiFi networks (in cmd):</p>
<pre><code>netsh wlan show networks
</code></pre>
<p>Now lets say I want to connect to a WiFi network that I n... | 68,774 | 3,393,326 | 2020-09-23 05:58:40 | 41,166,390 | 19 | 2016-12-15 14:18:20 | 1,838,048 | 2016-12-19 07:20:47 | https://stackoverflow.com/q/41163737 | https://stackoverflow.com/a/41166390 | <p>So you already know <code>netsh wlan</code></p>
<p>If you enter it you get a list of possible commands. One is <code>add</code>.</p>
<p>If you enter <code>netsh wlan add</code> you get another list of possible subcommands. One is <code>profile</code>.</p>
<p>If you enter <code>netsh wlan add profile</code> you ge... | <p>So you already know <code>netsh wlan</code></p> <p>If you enter it you get a list of possible commands. One is <code>add</code>.</p> <p>If you enter <code>netsh wlan add</code> you get another list of possible subcommands. One is <code>profile</code>.</p> <p>If you enter <code>netsh wlan add profile</code> you ge... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>How to connect to a WiFi using CMD only?</h1>
<p>How to connect to a new WiFi by enter a password using CMD?</p>
<p>For my school project I have decided to make a WiFi_manager program using cmd.</p>
<p>I know to display all WiFi networks (in cmd):</p>
<pre><code>netsh wlan show networks
</code></pre>
<p>Now let... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,954 | cmd | # How to connect to a WiFi using CMD only?
How to connect to a new WiFi by enter a password using CMD?
For my school project I have decided to make a WiFi_manager program using cmd.
I know to display all WiFi networks (in cmd):
```
netsh wlan show networks
```
Now lets say I want to connect to a WiFi network that ... | So you already know `netsh wlan`
If you enter it you get a list of possible commands. One is `add`.
If you enter `netsh wlan add` you get another list of possible subcommands. One is `profile`.
If you enter `netsh wlan add profile` you get a detailed explanation about all its possible parameters. One needed paramete... |
36374496 | Parse simple JSON string in Batch | 20 | 2016-04-02 14:25:38 | <p>How do you parse a simple JSON string in Batch?</p>
<p>For example, if I have the following JSON string:</p>
<p>{
"...":"...",
"year": 2016,
"time": "05:01",
"...":"...",
}</p>
<p>This JSON string has a number of elements and two of them are "year" and "time". From this string, I want to extract the value... | 73,454 | 4,086,836 | 2020-11-09 14:42:14 | 36,378,904 | 19 | 2016-04-02 21:26:19 | 1,683,264 | 2016-04-03 06:36:37 | https://stackoverflow.com/q/36374496 | https://stackoverflow.com/a/36378904 | <p>Here's a hybrid Batch + PowerShell solution. The PowerShell objectifies (deserializes) the JSON text and outputs it in key=value format to be captured and set as batch variables by the batch <code>for /f</code> loop. Save this with a .bat extension and give it a shot.</p>
<pre class="lang-perl prettyprint-overrid... | <p>Here's a hybrid Batch + PowerShell solution. The PowerShell objectifies (deserializes) the JSON text and outputs it in key=value format to be captured and set as batch variables by the batch <code>for /f</code> loop. Save this with a .bat extension and give it a shot.</p> <pre class="lang-perl prettyprint-overrid... | 7002 | batch-file | <h1>Parse simple JSON string in Batch</h1>
<p>How do you parse a simple JSON string in Batch?</p>
<p>For example, if I have the following JSON string:</p>
<p>{
"...":"...",
"year": 2016,
"time": "05:01",
"...":"...",
}</p>
<p>This JSON string has a number of elements and two of them are "year" and "time". Fr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,955 | cmd | # Parse simple JSON string in Batch
How do you parse a simple JSON string in Batch?
For example, if I have the following JSON string:
{
"...":"...",
"year": 2016,
"time": "05:01",
"...":"...",
}
This JSON string has a number of elements and two of them are "year" and "time". From this string, I want to extract the ... | Here's a hybrid Batch + PowerShell solution. The PowerShell objectifies (deserializes) the JSON text and outputs it in key=value format to be captured and set as batch variables by the batch `for /f` loop. Save this with a .bat extension and give it a shot.
```
<# : batch portion (contained within a PowerShell multi-l... |
10296162 | Escaping special characters in cmd | 20 | 2012-04-24 10:29:46 | <p>I have a Windows .bat script in which I try to run a command with password in parameter. The password I want to be able to use is <code>~!@#$%^&*()_+|-=\][{}';:"/.>?,<</code>.</p>
<p>From what I've read <a href="http://ss64.com/nt/syntax-esc.html">here</a>, I should escape <code>^&|\<></code> wi... | 94,269 | 142,827 | 2018-08-03 13:01:26 | 10,297,571 | 19 | 2012-04-24 12:11:44 | 21,567 | 2012-04-24 12:11:44 | https://stackoverflow.com/q/10296162 | https://stackoverflow.com/a/10297571 | <p>Double the quote in the password and make sure the complete password is enclosed in quotes as well:</p>
<pre><code>runme.exe /password:"~!@#$%%^^^&*()_+^|-=\][{}';:""/.>?,<"
</code></pre>
| <p>Double the quote in the password and make sure the complete password is enclosed in quotes as well:</p> <pre><code>runme.exe /password:"~!@#$%%^^^&*()_+^|-=\][{}';:""/.>?,<" </code></pre> | 2631, 4804 | cmd, escaping | <h1>Escaping special characters in cmd</h1>
<p>I have a Windows .bat script in which I try to run a command with password in parameter. The password I want to be able to use is <code>~!@#$%^&*()_+|-=\][{}';:"/.>?,<</code>.</p>
<p>From what I've read <a href="http://ss64.com/nt/syntax-esc.html">here</a>, I sh... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,956 | cmd | # Escaping special characters in cmd
I have a Windows .bat script in which I try to run a command with password in parameter. The password I want to be able to use is `~!@#$%^&*()_+|-=\][{}';:"/.>?,<`.
From what I've read [here](http://ss64.com/nt/syntax-esc.html), I should escape `^&|\<>` with `^`. From what I assum... | Double the quote in the password and make sure the complete password is enclosed in quotes as well:
```
runme.exe /password:"~!@#$%%^^^&*()_+^|-=\][{}';:""/.>?,<"
``` |
26744462 | What's the difference between the "Node.js command prompt" and the Windows command prompt? | 18 | 2014-11-04 20:31:42 | <p>What's the difference between the "Node.js command prompt" and the Windows command prompt? </p>
<p>Or, more to the point, why does it even exist when you can run node programs from the Windows command prompt?</p>
<p>Note: I'm asking about this guy, <em>not</em> the REPL:</p>
<p><img src="https://i.sstatic.net/vOT... | 7,862 | 933,879 | 2023-04-04 11:42:01 | 26,746,285 | 19 | 2014-11-04 22:29:57 | 400,654 | 2014-11-04 22:36:12 | https://stackoverflow.com/q/26744462 | https://stackoverflow.com/a/26746285 | <p>Read the property of the shortcut. It simply executes cmd.exe with an argument that executes a .bat file and then returns to the prompt.</p>
<pre><code>C:\Windows\System32\cmd.exe /k "C:\Program Files\nodejs\nodevars.bat"
</code></pre>
<p>All it really does is ensure that the path is setup properly for using node ... | <p>Read the property of the shortcut. It simply executes cmd.exe with an argument that executes a .bat file and then returns to the prompt.</p> <pre><code>C:\Windows\System32\cmd.exe /k "C:\Program Files\nodejs\nodevars.bat" </code></pre> <p>All it really does is ensure that the path is setup properly for using node ... | 1231, 2631, 46426 | cmd, command-line, node.js | <h1>What's the difference between the "Node.js command prompt" and the Windows command prompt?</h1>
<p>What's the difference between the "Node.js command prompt" and the Windows command prompt? </p>
<p>Or, more to the point, why does it even exist when you can run node programs from the Windows command prompt?</p>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,957 | cmd | # What's the difference between the "Node.js command prompt" and the Windows command prompt?
What's the difference between the "Node.js command prompt" and the Windows command prompt?
Or, more to the point, why does it even exist when you can run node programs from the Windows command prompt?
Note: I'm asking about ... | Read the property of the shortcut. It simply executes cmd.exe with an argument that executes a .bat file and then returns to the prompt.
```
C:\Windows\System32\cmd.exe /k "C:\Program Files\nodejs\nodevars.bat"
```
All it really does is ensure that the path is setup properly for using node and npm. I've never needed ... |
7426094 | Codeigniter - Batch Update with Multiple Where Conditions | 16 | 2011-09-15 05:05:10 | <p>For starters, the Codeigniter documentation on update_batch does not exist. kenjis was kind enough to provide some documentation and submit it to the repository. Hopefully they pull it soon. </p>
<p>Does anyone know how to add multiple where conditions to Codeigniters update_batch command?</p>
<p><strong>My Desire... | 38,876 | 726,312 | 2025-09-23 20:24:11 | 7,426,385 | 19 | 2011-09-15 05:49:58 | 172,185 | 2012-03-15 20:09:21 | https://stackoverflow.com/q/7426094 | https://stackoverflow.com/a/7426385 | <p>You can't add multiple where clauses to <code>update_batch()</code>. It only accepts a string as the third parameter for the where clause so I'm sure there's no way to do this the way the method is currently written.</p>
<p>From the <a href="https://github.com/EllisLab/CodeIgniter/blob/develop/system/database/DB_ac... | <p>You can't add multiple where clauses to <code>update_batch()</code>. It only accepts a string as the third parameter for the where clause so I'm sure there's no way to do this the way the method is currently written.</p> <p>From the <a href="https://github.com/EllisLab/CodeIgniter/blob/develop/system/database/DB_ac... | 5, 3988, 28708, 35561, 65592 | batch-updates, codeigniter, codeigniter-2, php, query-builder | <h1>Codeigniter - Batch Update with Multiple Where Conditions</h1>
<p>For starters, the Codeigniter documentation on update_batch does not exist. kenjis was kind enough to provide some documentation and submit it to the repository. Hopefully they pull it soon. </p>
<p>Does anyone know how to add multiple where conditi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,958 | cmd | # Codeigniter - Batch Update with Multiple Where Conditions
For starters, the Codeigniter documentation on update_batch does not exist. kenjis was kind enough to provide some documentation and submit it to the repository. Hopefully they pull it soon.
Does anyone know how to add multiple where conditions to Codeignite... | You can't add multiple where clauses to `update_batch()`. It only accepts a string as the third parameter for the where clause so I'm sure there's no way to do this the way the method is currently written.
From the [source](https://github.com/EllisLab/CodeIgniter/blob/develop/system/database/DB_active_rec.php):
```
/... |
18473652 | How can pass Hudson/Jenkins parameters to windows batch command | 15 | 2013-08-27 19:13:37 | <p>well i need to execute a batch file in my Hudson Job, I have a parameter(Jenkis parameter) and i need to pass this value like param to batch file, i tried this:</p>
<pre><code>Deploy.cmd -configuration=${DEPLOYCONFIGURATION} -source=${DeploySource}
</code></pre>
<p>My Deploy.cmd is configurated for get this values... | 35,806 | 2,708,534 | 2015-03-12 04:09:59 | 18,484,742 | 19 | 2013-08-28 09:57:28 | 1,517,180 | 2015-03-12 04:09:59 | https://stackoverflow.com/q/18473652 | https://stackoverflow.com/a/18484742 | <p>Execute your Batch file as like the below</p>
<pre><code>Deploy.cmd -configuration=%DEPLOYCONFIGURATION% -source=%DeploySource%
</code></pre>
<p>In case your Jenkins server run in unix/ Linux machine use "export" command to set environment variable for windows use "set" command like the below</p>
<p>For Windows:<... | <p>Execute your Batch file as like the below</p> <pre><code>Deploy.cmd -configuration=%DEPLOYCONFIGURATION% -source=%DeploySource% </code></pre> <p>In case your Jenkins server run in unix/ Linux machine use "export" command to set environment variable for windows use "set" command like the below</p> <p>For Windows:<... | 64, 360, 3858, 7002, 64999 | batch-file, hudson, jenkins, parameters, windows | <h1>How can pass Hudson/Jenkins parameters to windows batch command</h1>
<p>well i need to execute a batch file in my Hudson Job, I have a parameter(Jenkis parameter) and i need to pass this value like param to batch file, i tried this:</p>
<pre><code>Deploy.cmd -configuration=${DEPLOYCONFIGURATION} -source=${DeploySo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,959 | cmd | # How can pass Hudson/Jenkins parameters to windows batch command
well i need to execute a batch file in my Hudson Job, I have a parameter(Jenkis parameter) and i need to pass this value like param to batch file, i tried this:
```
Deploy.cmd -configuration=${DEPLOYCONFIGURATION} -source=${DeploySource}
```
My Deploy... | Execute your Batch file as like the below
```
Deploy.cmd -configuration=%DEPLOYCONFIGURATION% -source=%DeploySource%
```
In case your Jenkins server run in unix/ Linux machine use "export" command to set environment variable for windows use "set" command like the below
For Windows:
```
set DEPLOYCONFIGURATION=DEV
s... |
44886723 | Tell AzCopy batch to overwrite files? | 14 | 2017-07-03 13:23:38 | <p>So I'm using an AzCopy which is run manually at the moment but I was to run it through Task Scheduler on one of our servers. This copies files from one container to another and runs perfectly if I manually execute the batch file.
However, it asks me:</p>
<blockquote>
<p>Overwrite https://.file.core.windows.net// ... | 21,155 | 5,259,507 | 2021-09-29 15:27:20 | 44,886,878 | 19 | 2017-07-03 13:29:54 | 188,096 | 2017-07-03 13:29:54 | https://stackoverflow.com/q/44886723 | https://stackoverflow.com/a/44886878 | <p>Please try it with <code>/Y</code> option. From <a href="https://learn.microsoft.com/en-us/azure/storage/storage-use-azcopy#azcopy-parameters" rel="noreferrer"><code>AzCopy Parameters</code></a>:</p>
<blockquote>
<h1>/Y</h1>
<p>Suppresses all AzCopy confirmation prompts.</p>
</blockquote>
| <p>Please try it with <code>/Y</code> option. From <a href="https://learn.microsoft.com/en-us/azure/storage/storage-use-azcopy#azcopy-parameters" rel="noreferrer"><code>AzCopy Parameters</code></a>:</p> <blockquote> <h1>/Y</h1> <p>Suppresses all AzCopy confirmation prompts.</p> </blockquote> | 7002, 9299, 14158, 97912 | azcopy, azure, batch-file, scheduled-tasks | <h1>Tell AzCopy batch to overwrite files?</h1>
<p>So I'm using an AzCopy which is run manually at the moment but I was to run it through Task Scheduler on one of our servers. This copies files from one container to another and runs perfectly if I manually execute the batch file.
However, it asks me:</p>
<blockquote>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,960 | cmd | # Tell AzCopy batch to overwrite files?
So I'm using an AzCopy which is run manually at the moment but I was to run it through Task Scheduler on one of our servers. This copies files from one container to another and runs perfectly if I manually execute the batch file.
However, it asks me:
> Overwrite https://.file.c... | Please try it with `/Y` option. From [`AzCopy Parameters`](https://learn.microsoft.com/en-us/azure/storage/storage-use-azcopy#azcopy-parameters):
> # /Y
>
> Suppresses all AzCopy confirmation prompts. |
11025645 | .bat file to open executable within Console2 | 14 | 2012-06-14 01:44:26 | <p>I am aiming to create a .bat launcher that will execute a command line .exe program within <a href="http://sourceforge.net/projects/console/" rel="noreferrer">Console2</a>.<br>
My best guess would be that it should go something like:</p>
<pre><code>@echo off
start "" Console.exe program.exe
</code></pre>
<p>but al... | 7,454 | 499,006 | 2012-06-14 08:22:19 | 11,025,712 | 19 | 2012-06-14 01:56:46 | 30,225 | 2012-06-14 01:56:46 | https://stackoverflow.com/q/11025645 | https://stackoverflow.com/a/11025712 | <p>Ok I looked in source for the Console.exe and drilled down into the compiled help.</p>
<p>You need a -r </p>
<p>So: <code>Console.exe -r program.exe</code></p>
<pre><code>Command line parameters
Console supports these command line parameters:
-c <configuration file>
Specifies a configuration file.
... | <p>Ok I looked in source for the Console.exe and drilled down into the compiled help.</p> <p>You need a -r </p> <p>So: <code>Console.exe -r program.exe</code></p> <pre><code>Command line parameters Console supports these command line parameters: -c <configuration file> Specifies a configuration file. ... | 7002, 24124 | batch-file, console2 | <h1>.bat file to open executable within Console2</h1>
<p>I am aiming to create a .bat launcher that will execute a command line .exe program within <a href="http://sourceforge.net/projects/console/" rel="noreferrer">Console2</a>.<br>
My best guess would be that it should go something like:</p>
<pre><code>@echo off
sta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,961 | cmd | # .bat file to open executable within Console2
I am aiming to create a .bat launcher that will execute a command line .exe program within [Console2](http://sourceforge.net/projects/console/).
My best guess would be that it should go something like:
```
@echo off
start "" Console.exe program.exe
```
but all that do... | Ok I looked in source for the Console.exe and drilled down into the compiled help.
You need a -r
So: `Console.exe -r program.exe`
```
Command line parameters
Console supports these command line parameters:
-c <configuration file>
Specifies a configuration file.
-w <main window title>
Sets main window... |
28318643 | Getting the exit code of an application started with the "cmd" and "start" commands | 13 | 2015-02-04 10:09:49 | <p>I have a console application. Interaction with this application is done via TCP/IP. </p>
<p>I also have a test framework for it, which is basically a collection of BATCH scripts (...not my fault). What this test framework does for each test is basically this: </p>
<ol>
<li><code>start /min "myapplication.exe"</cod... | 26,020 | 1,085,062 | 2018-07-16 11:23:13 | 28,320,388 | 19 | 2015-02-04 11:35:49 | 1,012,053 | 2018-07-16 11:23:13 | https://stackoverflow.com/q/28318643 | https://stackoverflow.com/a/28320388 | <p>Normal expansion like <code>%errorLevel%</code> occurs when the statement is parsed, and the entire CMD /C command line is parsed in one pass, so the value you get is the value that existed before the commands were run (always 0).</p>
<p>You can get a more precise explanation at <a href="https://stackoverflow.com/a... | <p>Normal expansion like <code>%errorLevel%</code> occurs when the statement is parsed, and the entire CMD /C command line is parsed in one pass, so the value you get is the value that existed before the commands were run (always 0).</p> <p>You can get a more precise explanation at <a href="https://stackoverflow.com/a... | 64, 7002, 9938, 10021, 10631 | batch-file, command-prompt, console-application, exit-code, windows | <h1>Getting the exit code of an application started with the "cmd" and "start" commands</h1>
<p>I have a console application. Interaction with this application is done via TCP/IP. </p>
<p>I also have a test framework for it, which is basically a collection of BATCH scripts (...not my fault). What this test framework d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,964 | cmd | # Getting the exit code of an application started with the "cmd" and "start" commands
I have a console application. Interaction with this application is done via TCP/IP.
I also have a test framework for it, which is basically a collection of BATCH scripts (...not my fault). What this test framework does for each test... | Normal expansion like `%errorLevel%` occurs when the statement is parsed, and the entire CMD /C command line is parsed in one pass, so the value you get is the value that existed before the commands were run (always 0).
You can get a more precise explanation at <https://stackoverflow.com/a/4095133/1012053>. It can be ... |
28133052 | Saving a batch variable in a text file | 13 | 2015-01-25 03:56:24 | <p>I am trying to save a batch variable into a text file. I currently have this code:</p>
<pre><code>@echo off
Set var=6
@echo %var%>txt.txt
For /f "tokens*" %%i in (txt.txt) do @echo %%i
Pause
</code></pre>
<p>It's supposed to save the 6 into the variable var and then write the variable in a text file. I want t... | 58,008 | 4,491,222 | 2018-09-30 19:11:29 | 28,260,620 | 19 | 2015-02-01 07:47:49 | 2,152,082 | 2018-02-28 11:15:42 | https://stackoverflow.com/q/28133052 | https://stackoverflow.com/a/28260620 | <p>There is a little problem with redirection. You are redirecting a "stream"; they are numbered 0-9. 0 is for "Standard Input" (STDIN), 1 is for "Standard Output" (STDOUT), 2 is for "Error Output" (STDERR).</p>
<p>If you use the redirection symbol <code>></code> without a stream number, it defaults to "1".</p>
<p... | <p>There is a little problem with redirection. You are redirecting a "stream"; they are numbered 0-9. 0 is for "Standard Input" (STDIN), 1 is for "Standard Output" (STDOUT), 2 is for "Error Output" (STDERR).</p> <p>If you use the redirection symbol <code>></code> without a stream number, it defaults to "1".</p> <p... | 276, 7002, 9581, 26698 | batch-file, io-redirection, save, variables | <h1>Saving a batch variable in a text file</h1>
<p>I am trying to save a batch variable into a text file. I currently have this code:</p>
<pre><code>@echo off
Set var=6
@echo %var%>txt.txt
For /f "tokens*" %%i in (txt.txt) do @echo %%i
Pause
</code></pre>
<p>It's supposed to save the 6 into the variable var and ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,965 | cmd | # Saving a batch variable in a text file
I am trying to save a batch variable into a text file. I currently have this code:
```
@echo off
Set var=6
@echo %var%>txt.txt
For /f "tokens*" %%i in (txt.txt) do @echo %%i
Pause
```
It's supposed to save the 6 into the variable var and then write the variable in a text fi... | There is a little problem with redirection. You are redirecting a "stream"; they are numbered 0-9. 0 is for "Standard Input" (STDIN), 1 is for "Standard Output" (STDOUT), 2 is for "Error Output" (STDERR).
If you use the redirection symbol `>` without a stream number, it defaults to "1".
So `echo text>txt.txt` is just... |
17829884 | Use batch file timeout without echoing command? | 13 | 2013-07-24 09:18:52 | <p>I'm fairly new to batch scripting but reasonably competent with programming in general. I'm currently calling a perl script from a batch file and am displaying the result from the perl script in the Windows command window for 10 seconds before exiting the command window.</p>
<p>I'm using the command</p>
<pre><code... | 86,331 | 2,336,962 | 2022-11-05 19:57:14 | 17,830,086 | 19 | 2013-07-24 09:27:58 | 2,545,784 | 2013-07-24 09:27:58 | https://stackoverflow.com/q/17829884 | https://stackoverflow.com/a/17830086 | <p>If you want to avoid echoing one command, prefix it with <code>@</code>:</p>
<pre><code>@timeout /t 10 /nobreak
</code></pre>
<p>You can disable echoing at all with command</p>
<pre><code>echo off
</code></pre>
<p>Normally, you put</p>
<pre><code>@echo off
</code></pre>
<p>at beginning of batch file, so comman... | <p>If you want to avoid echoing one command, prefix it with <code>@</code>:</p> <pre><code>@timeout /t 10 /nobreak </code></pre> <p>You can disable echoing at all with command</p> <pre><code>echo off </code></pre> <p>Normally, you put</p> <pre><code>@echo off </code></pre> <p>at beginning of batch file, so comman... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>Use batch file timeout without echoing command?</h1>
<p>I'm fairly new to batch scripting but reasonably competent with programming in general. I'm currently calling a perl script from a batch file and am displaying the result from the perl script in the Windows command window for 10 seconds before exiting the comm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,966 | cmd | # Use batch file timeout without echoing command?
I'm fairly new to batch scripting but reasonably competent with programming in general. I'm currently calling a perl script from a batch file and am displaying the result from the perl script in the Windows command window for 10 seconds before exiting the command windo... | If you want to avoid echoing one command, prefix it with `@`:
```
@timeout /t 10 /nobreak
```
You can disable echoing at all with command
```
echo off
```
Normally, you put
```
@echo off
```
at beginning of batch file, so commands are not outputed. |
7077325 | windows bat file: undo NET USE | 13 | 2011-08-16 11:15:01 | <p>In a batch-file I use the following syntax to map a network drive:</p>
<p>NET USE N: \\someserver\somedirectory.</p>
<p>While this works fine, it also gives an error if the letter n is already used. Is it possible to suppress this error message?</p>
<p>Also, is there a way to unmap a network drive?</p>
<p>I imag... | 22,759 | 97,688 | 2014-12-19 22:34:43 | 7,077,383 | 19 | 2011-08-16 11:19:23 | 246,342 | 2012-02-15 11:45:07 | https://stackoverflow.com/q/7077325 | https://stackoverflow.com/a/7077383 | <p>After </p>
<pre><code>NET USE N: \\somserver\somedirectory
</code></pre>
<p>to remove simply:</p>
<pre><code>NET USE N: /DELETE
</code></pre>
<p>To test for an existing mapping you can;</p>
<pre><code>IF NOT EXIST N:\. GOTO BLABLA
</code></pre>
| <p>After </p> <pre><code>NET USE N: \\somserver\somedirectory </code></pre> <p>to remove simply:</p> <pre><code>NET USE N: /DELETE </code></pre> <p>To test for an existing mapping you can;</p> <pre><code>IF NOT EXIST N:\. GOTO BLABLA </code></pre> | 64, 7002 | batch-file, windows | <h1>windows bat file: undo NET USE</h1>
<p>In a batch-file I use the following syntax to map a network drive:</p>
<p>NET USE N: \\someserver\somedirectory.</p>
<p>While this works fine, it also gives an error if the letter n is already used. Is it possible to suppress this error message?</p>
<p>Also, is there a way ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,967 | cmd | # windows bat file: undo NET USE
In a batch-file I use the following syntax to map a network drive:
NET USE N: \\someserver\somedirectory.
While this works fine, it also gives an error if the letter n is already used. Is it possible to suppress this error message?
Also, is there a way to unmap a network drive?
I i... | After
```
NET USE N: \\somserver\somedirectory
```
to remove simply:
```
NET USE N: /DELETE
```
To test for an existing mapping you can;
```
IF NOT EXIST N:\. GOTO BLABLA
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.