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
411247
Running a CMD or BAT in silent mode
62
2009-01-04 16:45:34
<p>How can I run a CMD or .bat file in silent mode? I'm looking to prevent the CMD interface from being shown to the user.</p>
502,614
2,140,183
2021-11-03 04:31:25
411,270
40
2009-01-04 16:57:52
6,309
2016-11-10 11:30:16
https://stackoverflow.com/q/411247
https://stackoverflow.com/a/411270
<p>I have proposed in StackOverflow question a way to <a href="https://stackoverflow.com/questions/298562">run a batch file in the background (<strong>no DOS windows displayed</strong>)</a></p> <p>That should answer your question.</p> <p>Here it is:</p> <hr> <p>From your first script, call your second script with t...
<p>I have proposed in StackOverflow question a way to <a href="https://stackoverflow.com/questions/298562">run a batch file in the background (<strong>no DOS windows displayed</strong>)</a></p> <p>That should answer your question.</p> <p>Here it is:</p> <hr> <p>From your first script, call your second script with t...
531, 2631, 7002
batch-file, cmd, scripting
<h1>Running a CMD or BAT in silent mode</h1> <p>How can I run a CMD or .bat file in silent mode? I'm looking to prevent the CMD interface from being shown to the user.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,411
cmd
# Running a CMD or BAT in silent mode How can I run a CMD or .bat file in silent mode? I'm looking to prevent the CMD interface from being shown to the user.
I have proposed in StackOverflow question a way to [run a batch file in the background (**no DOS windows displayed**)](https://stackoverflow.com/questions/298562) That should answer your question. Here it is: --- From your first script, call your second script with the following line: ``` wscript.exe invis.vbs run...
1687014
How do I compare timestamps of files in a batch script?
34
2009-11-06 11:28:22
<p>In DOS batch files, the method of achieving certain things is somewhat obfuscated. Fortunately, there is a fantastic reference site for batch scripting: <a href="http://ss64.com/nt/" rel="noreferrer">Simon Sheppard's SS64</a>. (The same site also has plenty of information about <em>Bash</em>.)</p> <p>One difficulty...
93,296
202,130
2025-03-16 07:38:53
1,687,076
40
2009-11-06 11:42:47
3,171
2009-11-06 12:08:45
https://stackoverflow.com/q/1687014
https://stackoverflow.com/a/1687076
<p>You can find the newer of two files with one line of batch script. Just list the files in date order, oldest first, which means the last file listed must be the newer file. So if you save the file name each time, the last name put in your variable will be the newest file.</p> <p>For, example:</p> <pre><code>SET ...
<p>You can find the newer of two files with one line of batch script. Just list the files in date order, oldest first, which means the last file listed must be the newer file. So if you save the file name each time, the last name put in your variable will be the newest file.</p> <p>For, example:</p> <pre><code>SET ...
99, 2631, 7002
batch-file, cmd, filesystems
<h1>How do I compare timestamps of files in a batch script?</h1> <p>In DOS batch files, the method of achieving certain things is somewhat obfuscated. Fortunately, there is a fantastic reference site for batch scripting: <a href="http://ss64.com/nt/" rel="noreferrer">Simon Sheppard's SS64</a>. (The same site also has p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,412
cmd
# How do I compare timestamps of files in a batch script? In DOS batch files, the method of achieving certain things is somewhat obfuscated. Fortunately, there is a fantastic reference site for batch scripting: [Simon Sheppard's SS64](http://ss64.com/nt/). (The same site also has plenty of information about *Bash*.) ...
You can find the newer of two files with one line of batch script. Just list the files in date order, oldest first, which means the last file listed must be the newer file. So if you save the file name each time, the last name put in your variable will be the newest file. For, example: ``` SET FILE1=foo.txt SET FILE2...
13515254
How to set a timeout for a process under Windows 7?
33
2012-11-22 14:53:00
<p>I would like to start a program with a Windows batch file. But the program should stop after a certain timeout value. For example: Run the program 60 seconds and stop it after 60 seconds.</p> <p>Under Linux, there is this nice <code>timeout</code> command to do what I want. Windows has also a <code>timeout</code> co...
56,124
1,406,176
2023-06-19 01:11:26
13,515,320
40
2012-11-22 14:57:46
799,586
2012-11-22 14:57:46
https://stackoverflow.com/q/13515254
https://stackoverflow.com/a/13515320
<pre><code>start yourprogram.exe timeout /t 60 taskkill /im yourprogram.exe /f </code></pre>
<pre><code>start yourprogram.exe timeout /t 60 taskkill /im yourprogram.exe /f </code></pre>
64, 2702, 7002, 34595
batch-file, timeout, windows, windows-7
<h1>How to set a timeout for a process under Windows 7?</h1> <p>I would like to start a program with a Windows batch file. But the program should stop after a certain timeout value. For example: Run the program 60 seconds and stop it after 60 seconds.</p> <p>Under Linux, there is this nice <code>timeout</code> command ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,413
cmd
# How to set a timeout for a process under Windows 7? I would like to start a program with a Windows batch file. But the program should stop after a certain timeout value. For example: Run the program 60 seconds and stop it after 60 seconds. Under Linux, there is this nice `timeout` command to do what I want. Windows...
``` start yourprogram.exe timeout /t 60 taskkill /im yourprogram.exe /f ```
12021033
How do I request and receive user input in a .bat and use it to run a certain program?
31
2012-08-18 18:09:28
<p>This is what I have so far</p> <pre><code>@echo off :Ask echo Would you like to use developer mode?(Y/N) set INPUT= set /P INPUT=Type input: %=% If %INPUT%=="y" goto yes If %INPUT%=="n" goto no If %INPUT%=="Y" goto yes If %INPUT%=="N" goto no :yes java -jar lib/RSBot-4030.jar -dev echo Starting RSbot in developer ...
112,334
1,377,037
2019-09-03 06:52:57
12,021,798
40
2012-08-18 19:55:59
297,408
2013-12-13 12:36:39
https://stackoverflow.com/q/12021033
https://stackoverflow.com/a/12021798
<p>If the input is, say, <code>N</code>, your IF lines evaluate like this:</p> <pre><code>If N=="y" goto yes If N=="n" goto no … </code></pre> <p>That is, you are comparing <code>N</code> with <code>"y"</code>, then <code>"n"</code> etc. including <code>"N"</code>. You are never going to get a match unless the user ...
<p>If the input is, say, <code>N</code>, your IF lines evaluate like this:</p> <pre><code>If N=="y" goto yes If N=="n" goto no … </code></pre> <p>That is, you are comparing <code>N</code> with <code>"y"</code>, then <code>"n"</code> etc. including <code>"N"</code>. You are never going to get a match unless the user ...
5486, 7002
batch-file, input
<h1>How do I request and receive user input in a .bat and use it to run a certain program?</h1> <p>This is what I have so far</p> <pre><code>@echo off :Ask echo Would you like to use developer mode?(Y/N) set INPUT= set /P INPUT=Type input: %=% If %INPUT%=="y" goto yes If %INPUT%=="n" goto no If %INPUT%=="Y" goto yes ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,414
cmd
# How do I request and receive user input in a .bat and use it to run a certain program? This is what I have so far ``` @echo off :Ask echo Would you like to use developer mode?(Y/N) set INPUT= set /P INPUT=Type input: %=% If %INPUT%=="y" goto yes If %INPUT%=="n" goto no If %INPUT%=="Y" goto yes If %INPUT%=="N" goto...
If the input is, say, `N`, your IF lines evaluate like this: ``` If N=="y" goto yes If N=="n" goto no … ``` That is, you are comparing `N` with `"y"`, then `"n"` etc. including `"N"`. You are never going to get a match unless the user somehow decides to input `"N"` or `"y"` (i.e. either of the four characters, but e...
5023545
Shortest Windows batch file code to get first line of a file set to a variable?
22
2011-02-16 23:38:04
<p>I am looking for the shortest amount of code possible that will get the first line of a text file and set it to a variable in Windows.</p> <p>There are lots of examples of this kind of thing in other threads on this StackExchange site but I am <strong>not</strong> looking for how to loop through and display all lin...
53,190
118,228
2021-03-23 11:04:01
5,023,579
40
2011-02-16 23:44:31
256,272
2011-02-16 23:44:31
https://stackoverflow.com/q/5023545
https://stackoverflow.com/a/5023579
<pre><code>set /p var= &lt;Text.txt echo %var% </code></pre> <p>Referenced from: <a href="http://forums.techguy.org/software-development/551867-batch-file-read-line-text.html" rel="noreferrer">http://forums.techguy.org/software-development/551867-batch-file-read-line-text.html</a> Ironically the poster is able to get ...
<pre><code>set /p var= &lt;Text.txt echo %var% </code></pre> <p>Referenced from: <a href="http://forums.techguy.org/software-development/551867-batch-file-read-line-text.html" rel="noreferrer">http://forums.techguy.org/software-development/551867-batch-file-read-line-text.html</a> Ironically the poster is able to get ...
64, 2631, 7002
batch-file, cmd, windows
<h1>Shortest Windows batch file code to get first line of a file set to a variable?</h1> <p>I am looking for the shortest amount of code possible that will get the first line of a text file and set it to a variable in Windows.</p> <p>There are lots of examples of this kind of thing in other threads on this StackExchan...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,415
cmd
# Shortest Windows batch file code to get first line of a file set to a variable? I am looking for the shortest amount of code possible that will get the first line of a text file and set it to a variable in Windows. There are lots of examples of this kind of thing in other threads on this StackExchange site but I am...
``` set /p var= <Text.txt echo %var% ``` Referenced from: <http://forums.techguy.org/software-development/551867-batch-file-read-line-text.html> Ironically the poster is able to get the first line but wanted to loop through the whole file!
21660249
How do I make one particular line of a batch file a different color then the others?
20
2014-02-09 14:26:25
<p>I'm working on a program which generates the day's weather for D&amp;D games. I want the program to display a warning in red text when a storm is generated so the DM is aware that this weather is not typical. To reduce the number of keystrokes, it must do this on the same screen as the text detailing the weather its...
68,893
2,195,713
2024-08-12 19:51:44
21,666,354
40
2014-02-09 23:05:08
2,946,716
2014-02-09 23:16:47
https://stackoverflow.com/q/21660249
https://stackoverflow.com/a/21666354
<p>I was having the same problem yesterday, I did some research and <em>this</em> worked for me. EDIT: This is <strong>NOT</strong> the same code as the other one.</p> <pre><code>@Echo Off SETLOCAL EnableDelayedExpansion for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# &amp; echo on &amp; for %%b in (1) do re...
<p>I was having the same problem yesterday, I did some research and <em>this</em> worked for me. EDIT: This is <strong>NOT</strong> the same code as the other one.</p> <pre><code>@Echo Off SETLOCAL EnableDelayedExpansion for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# &amp; echo on &amp; for %%b in (1) do re...
7002
batch-file
<h1>How do I make one particular line of a batch file a different color then the others?</h1> <p>I'm working on a program which generates the day's weather for D&amp;D games. I want the program to display a warning in red text when a storm is generated so the DM is aware that this weather is not typical. To reduce the ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,416
cmd
# How do I make one particular line of a batch file a different color then the others? I'm working on a program which generates the day's weather for D&D games. I want the program to display a warning in red text when a storm is generated so the DM is aware that this weather is not typical. To reduce the number of key...
I was having the same problem yesterday, I did some research and *this* worked for me. EDIT: This is **NOT** the same code as the other one. ``` @Echo Off SETLOCAL EnableDelayedExpansion for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( set "DEL=%%a" ) call :colorEch...
19379828
loop through directory names using a batch file?
20
2013-10-15 11:14:02
<p>Assume I have this structure:</p> <pre><code>d:/ -- /alpha/ -- /beta/ -- /gamma/ -- /delta/ </code></pre> <p>I'm trying to execute a batch file that goes through those folders (but not through sub-folders within them).</p> <p>How do I get this result using a FOR LOOP (assuming I don't know the name and qu...
73,060
1,281,492
2022-04-10 09:44:38
19,380,194
40
2013-10-15 11:32:33
1,035,521
2022-04-10 09:44:38
https://stackoverflow.com/q/19379828
https://stackoverflow.com/a/19380194
<p>This is all you should need -- directly at the command prompt:</p> <pre><code>for /D %i in (*) do rename &quot;%i&quot; &quot;%i1&quot; </code></pre> <p>or in a batch file (note the doubled <code>%</code>):</p> <pre><code>for /D %%i in (*) do rename &quot;%%i&quot; &quot;%%i1&quot; </code></pre> <p>The <strong>/D</s...
<p>This is all you should need -- directly at the command prompt:</p> <pre><code>for /D %i in (*) do rename &quot;%i&quot; &quot;%i1&quot; </code></pre> <p>or in a batch file (note the doubled <code>%</code>):</p> <pre><code>for /D %%i in (*) do rename &quot;%%i&quot; &quot;%%i1&quot; </code></pre> <p>The <strong>/D</s...
2314, 7002
batch-file, loops
<h1>loop through directory names using a batch file?</h1> <p>Assume I have this structure:</p> <pre><code>d:/ -- /alpha/ -- /beta/ -- /gamma/ -- /delta/ </code></pre> <p>I'm trying to execute a batch file that goes through those folders (but not through sub-folders within them).</p> <p>How do I get this resu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,417
cmd
# loop through directory names using a batch file? Assume I have this structure: ``` d:/ -- /alpha/ -- /beta/ -- /gamma/ -- /delta/ ``` I'm trying to execute a batch file that goes through those folders (but not through sub-folders within them). How do I get this result using a FOR LOOP (assuming I don't kn...
This is all you should need -- directly at the command prompt: ``` for /D %i in (*) do rename "%i" "%i1" ``` or in a batch file (note the doubled `%`): ``` for /D %%i in (*) do rename "%%i" "%%i1" ``` The **/D** performs the command against the directory names, as per the help, which can be obtained using the comma...
16150152
Secure FTP using Windows batch script
20
2013-04-22 14:53:22
<p>I currently have batch scripts on different servers that transfer a csv file to an FTP server at a different location. My script looks similar to this:</p> <pre><code>echo user ftp_user&gt; ftpcmd.dat echo password&gt;&gt; ftpcmd.dat echo put c:\directory\%1-export-%date%.csv&gt;&gt; ftpcmd.dat echo quit&gt;&gt; ft...
175,392
862,132
2023-10-27 08:41:00
16,151,814
40
2013-04-22 16:16:45
850,848
2022-09-07 16:48:52
https://stackoverflow.com/q/16150152
https://stackoverflow.com/a/16151814
<p>First, make sure you understand, if you need to use <a href="https://en.wikipedia.org/wiki/FTPS" rel="nofollow noreferrer">Secure FTP</a> (=FTPS, as per your text) or <a href="https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol" rel="nofollow noreferrer">SFTP</a> (as per tag you have used).</p> <p>Neither is su...
<p>First, make sure you understand, if you need to use <a href="https://en.wikipedia.org/wiki/FTPS" rel="nofollow noreferrer">Secure FTP</a> (=FTPS, as per your text) or <a href="https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol" rel="nofollow noreferrer">SFTP</a> (as per tag you have used).</p> <p>Neither is su...
64, 261, 1290, 7002
batch-file, ftp, sftp, windows
<h1>Secure FTP using Windows batch script</h1> <p>I currently have batch scripts on different servers that transfer a csv file to an FTP server at a different location. My script looks similar to this:</p> <pre><code>echo user ftp_user&gt; ftpcmd.dat echo password&gt;&gt; ftpcmd.dat echo put c:\directory\%1-export-%da...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,418
cmd
# Secure FTP using Windows batch script I currently have batch scripts on different servers that transfer a csv file to an FTP server at a different location. My script looks similar to this: ``` echo user ftp_user> ftpcmd.dat echo password>> ftpcmd.dat echo put c:\directory\%1-export-%date%.csv>> ftpcmd.dat echo qui...
First, make sure you understand, if you need to use [Secure FTP](https://en.wikipedia.org/wiki/FTPS) (=FTPS, as per your text) or [SFTP](https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol) (as per tag you have used). Neither is supported by Windows command-line `ftp.exe`. As you have suggested, you can use [WinS...
671642
How can I compare two files in a batch file?
19
2009-03-22 21:30:33
<p>How can I compare two files in a batch file, and perform an action based on whether or not they match? I've tried something like:</p> <pre><code>if file1.txt NEQ file2.txt goto label </code></pre> <p>but it compares the actual string "file1.txt" rather than the file. I've read about the COMP command, but it doesn'...
84,564
81,093
2017-12-05 23:18:34
671,649
40
2009-03-22 21:35:40
72,346
2009-03-22 21:35:40
https://stackoverflow.com/q/671642
https://stackoverflow.com/a/671649
<p>I believe you can use the "FC" command and then check the errorlevel. Here's some code:</p> <pre><code>@echo off :main fc c:\filename r:\filemame &gt; nul if errorlevel 1 goto error :next echo insert next CD pause goto main :error echo failed check </code></pre> <p>(Pulled from <a href="http://www.computing.net/...
<p>I believe you can use the "FC" command and then check the errorlevel. Here's some code:</p> <pre><code>@echo off :main fc c:\filename r:\filemame &gt; nul if errorlevel 1 goto error :next echo insert next CD pause goto main :error echo failed check </code></pre> <p>(Pulled from <a href="http://www.computing.net/...
588, 2773, 5310, 7002
batch-file, comparison, file, if-statement
<h1>How can I compare two files in a batch file?</h1> <p>How can I compare two files in a batch file, and perform an action based on whether or not they match? I've tried something like:</p> <pre><code>if file1.txt NEQ file2.txt goto label </code></pre> <p>but it compares the actual string "file1.txt" rather than the...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,419
cmd
# How can I compare two files in a batch file? How can I compare two files in a batch file, and perform an action based on whether or not they match? I've tried something like: ``` if file1.txt NEQ file2.txt goto label ``` but it compares the actual string "file1.txt" rather than the file. I've read about the COMP c...
I believe you can use the "FC" command and then check the errorlevel. Here's some code: ``` @echo off :main fc c:\filename r:\filemame > nul if errorlevel 1 goto error :next echo insert next CD pause goto main :error echo failed check ``` (Pulled from <http://www.computing.net/answers/dos/batch-file-command/15753.h...
11720681
Windows batch copy files from subfolders to one folder
16
2012-07-30 11:33:21
<p>I had tried to make batch script that copies all *.tif files located in D:\images(random named subfolders here) to d:\all.</p> <pre><code>xcopy D:\Downloads\*.TIF D:\temp\ /s </code></pre> <p>works, but it copies with all folder tree. I tried to use other keys, but its dont works. Thanks for help!</p>
81,793
1,300,782
2015-09-05 15:45:23
11,721,037
40
2012-07-30 11:54:49
30,447
2015-04-24 14:58:20
https://stackoverflow.com/q/11720681
https://stackoverflow.com/a/11721037
<p><code>FOR</code> is your friend. Read <code>HELP FOR</code> on the <code>/R</code> option and the <code>%~nx</code> variable substitution; and then try this very simple code.</p> <pre><code> pushd d:\downloads for /r %%a in (*.tif) do ( echo COPY "%%a" "d:\temp\%%~nxa" ) popd </code></pre> <p>watch...
<p><code>FOR</code> is your friend. Read <code>HELP FOR</code> on the <code>/R</code> option and the <code>%~nx</code> variable substitution; and then try this very simple code.</p> <pre><code> pushd d:\downloads for /r %%a in (*.tif) do ( echo COPY "%%a" "d:\temp\%%~nxa" ) popd </code></pre> <p>watch...
64, 4330, 4710, 7002
batch-file, copy, windows, xcopy
<h1>Windows batch copy files from subfolders to one folder</h1> <p>I had tried to make batch script that copies all *.tif files located in D:\images(random named subfolders here) to d:\all.</p> <pre><code>xcopy D:\Downloads\*.TIF D:\temp\ /s </code></pre> <p>works, but it copies with all folder tree. I tried to use o...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,420
cmd
# Windows batch copy files from subfolders to one folder I had tried to make batch script that copies all *.tif files located in D:\images(random named subfolders here) to d:\all. ``` xcopy D:\Downloads\*.TIF D:\temp\ /s ``` works, but it copies with all folder tree. I tried to use other keys, but its dont works. Th...
`FOR` is your friend. Read `HELP FOR` on the `/R` option and the `%~nx` variable substitution; and then try this very simple code. ``` pushd d:\downloads for /r %%a in (*.tif) do ( echo COPY "%%a" "d:\temp\%%~nxa" ) popd ``` watch carefully the results and then remove the `ECHO` command. You will ha...
12572718
How to change text color of cmd with windows batch script every 1 second
48
2012-09-24 20:50:53
<p>The color command has to do with changing color of windows command promt background/text</p> <p>color 0A - where 0 is the background color and A is the text color</p> <p>I want to change these color of text every 1 second in windows batch script using an array with 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F witch are the color...
266,151
1,263,737
2024-01-08 21:05:53
12,610,301
39
2012-09-26 20:59:42
1,518,974
2012-09-26 20:59:42
https://stackoverflow.com/q/12572718
https://stackoverflow.com/a/12610301
<p>This should fit the bill. Sounds like a super-annoying thing to have going on, but there you have it:</p> <pre><code>@echo off set NUM=0 1 2 3 4 5 6 7 8 9 A B C D E F for %%x in (%NUM%) do ( for %%y in (%NUM%) do ( color %%x%%y timeout 1 &gt;nul ) ) </code></pre>
<p>This should fit the bill. Sounds like a super-annoying thing to have going on, but there you have it:</p> <pre><code>@echo off set NUM=0 1 2 3 4 5 6 7 8 9 A B C D E F for %%x in (%NUM%) do ( for %%y in (%NUM%) do ( color %%x%%y timeout 1 &gt;nul ) ) </code></pre>
2631, 7002
batch-file, cmd
<h1>How to change text color of cmd with windows batch script every 1 second</h1> <p>The color command has to do with changing color of windows command promt background/text</p> <p>color 0A - where 0 is the background color and A is the text color</p> <p>I want to change these color of text every 1 second in windows ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,421
cmd
# How to change text color of cmd with windows batch script every 1 second The color command has to do with changing color of windows command promt background/text color 0A - where 0 is the background color and A is the text color I want to change these color of text every 1 second in windows batch script using an a...
This should fit the bill. Sounds like a super-annoying thing to have going on, but there you have it: ``` @echo off set NUM=0 1 2 3 4 5 6 7 8 9 A B C D E F for %%x in (%NUM%) do ( for %%y in (%NUM%) do ( color %%x%%y timeout 1 >nul ) ) ```
48582952
Execute Batch file in Windows Subsystem for Linux
36
2018-02-02 12:41:48
<p>Is it possible to execute a <code>.bat</code> file from a Windows Subsystem for Linux (eg. Ubuntu)?</p> <p>It is trivial to run an <code>.exe</code> file from a WSL, but I haven't found a trivial way to run a <code>.bat</code>. The only way I found is to open <code>cmd.exe</code>, but that is a bit cumbersome to do...
36,608
1,647,057
2021-02-18 03:44:25
48,583,228
39
2018-02-02 12:57:28
6,738,015
2018-02-02 12:57:28
https://stackoverflow.com/q/48582952
https://stackoverflow.com/a/48583228
<p>Unfortunately at the moment you cannot do so without either using:</p> <pre class="lang-bash prettyprint-override"><code>cmd.exe /c foo.bat </code></pre> <p>…or the following hack using binfmt:</p> <pre class="lang-bash prettyprint-override"><code>sudo sh -c "echo :WindowsBatch:E::bat::/init: &gt; /proc/sys/fs/bi...
<p>Unfortunately at the moment you cannot do so without either using:</p> <pre class="lang-bash prettyprint-override"><code>cmd.exe /c foo.bat </code></pre> <p>…or the following hack using binfmt:</p> <pre class="lang-bash prettyprint-override"><code>sudo sh -c "echo :WindowsBatch:E::bat::/init: &gt; /proc/sys/fs/bi...
64, 7002, 119526
batch-file, windows, windows-subsystem-for-linux
<h1>Execute Batch file in Windows Subsystem for Linux</h1> <p>Is it possible to execute a <code>.bat</code> file from a Windows Subsystem for Linux (eg. Ubuntu)?</p> <p>It is trivial to run an <code>.exe</code> file from a WSL, but I haven't found a trivial way to run a <code>.bat</code>. The only way I found is to op...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,424
cmd
# Execute Batch file in Windows Subsystem for Linux Is it possible to execute a `.bat` file from a Windows Subsystem for Linux (eg. Ubuntu)? It is trivial to run an `.exe` file from a WSL, but I haven't found a trivial way to run a `.bat`. The only way I found is to open `cmd.exe`, but that is a bit cumbersome to do ...
Unfortunately at the moment you cannot do so without either using: ``` cmd.exe /c foo.bat ``` …or the following hack using binfmt: ``` sudo sh -c "echo :WindowsBatch:E::bat::/init: > /proc/sys/fs/binfmt_misc/register" ``` You could then just type: ``` foo.bat ``` *The problems with this method are that you'd need...
35687470
C# mongodb driver 2.0 - How to upsert in a bulk operation?
30
2016-02-28 19:53:48
<p>I migrated from 1.9 to 2.2 and <a href="http://mongodb.github.io/mongo-csharp-driver/2.0/getting_started/quick_tour/#bulk-writes" rel="noreferrer">reading the documentation</a> I was surprised to discover that is not possible to upsert during a bulk operation anymore, since operations don't allow options.</p> <pre>...
23,284
2,010,764
2022-08-05 10:36:24
35,688,613
39
2016-02-28 21:39:02
1,259,510
2022-08-05 10:36:24
https://stackoverflow.com/q/35687470
https://stackoverflow.com/a/35688613
<p>Set the <a href="http://api.mongodb.org/csharp/2.0/html/P_MongoDB_Driver_UpdateOneModel_1_IsUpsert.htm" rel="noreferrer"><code>IsUpsert</code></a> property of the <code>UpdateOneModel</code> to true to turn the update into an upsert.</p> <pre><code>var bulkOps = new List&lt;WriteModel&lt;BsonDocument&gt;&gt;(); // C...
<p>Set the <a href="http://api.mongodb.org/csharp/2.0/html/P_MongoDB_Driver_UpdateOneModel_1_IsUpsert.htm" rel="noreferrer"><code>IsUpsert</code></a> property of the <code>UpdateOneModel</code> to true to turn the update into an upsert.</p> <pre><code>var bulkOps = new List&lt;WriteModel&lt;BsonDocument&gt;&gt;(); // C...
9, 8676, 30073, 30645, 112919
batch-processing, bulk, c#, mongodb, mongodb-.net-driver
<h1>C# mongodb driver 2.0 - How to upsert in a bulk operation?</h1> <p>I migrated from 1.9 to 2.2 and <a href="http://mongodb.github.io/mongo-csharp-driver/2.0/getting_started/quick_tour/#bulk-writes" rel="noreferrer">reading the documentation</a> I was surprised to discover that is not possible to upsert during a bulk...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,425
cmd
# C# mongodb driver 2.0 - How to upsert in a bulk operation? I migrated from 1.9 to 2.2 and [reading the documentation](http://mongodb.github.io/mongo-csharp-driver/2.0/getting_started/quick_tour/#bulk-writes) I was surprised to discover that is not possible to upsert during a bulk operation anymore, since operations ...
Set the [`IsUpsert`](http://api.mongodb.org/csharp/2.0/html/P_MongoDB_Driver_UpdateOneModel_1_IsUpsert.htm) property of the `UpdateOneModel` to true to turn the update into an upsert. ``` var bulkOps = new List<WriteModel<BsonDocument>>(); // Create and add one or more write models to list var upsertOne = new UpdateOn...
17923980
Hide XCOPY confirmation of number of files copied
30
2013-07-29 12:25:35
<p>I've had a look at the switches for XCOPY and can't seem to find one that suppresses the confirmation of the <b>number of files</b> that have been copied.</p> <p>Do you know if this is possible?</p> <p>Thanks in advance,</p> <p>Dave</p>
25,915
2,314,636
2018-09-04 09:07:53
17,924,069
39
2013-07-29 12:28:43
2,098,699
2013-07-29 12:28:43
https://stackoverflow.com/q/17923980
https://stackoverflow.com/a/17924069
<p>you can simply send it to <code>nul</code>:</p> <pre><code>xcopy source destination options &gt; nul </code></pre>
<p>you can simply send it to <code>nul</code>:</p> <pre><code>xcopy source destination options &gt; nul </code></pre>
4710, 7002
batch-file, xcopy
<h1>Hide XCOPY confirmation of number of files copied</h1> <p>I've had a look at the switches for XCOPY and can't seem to find one that suppresses the confirmation of the <b>number of files</b> that have been copied.</p> <p>Do you know if this is possible?</p> <p>Thanks in advance,</p> <p>Dave</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,426
cmd
# Hide XCOPY confirmation of number of files copied I've had a look at the switches for XCOPY and can't seem to find one that suppresses the confirmation of the **number of files** that have been copied. Do you know if this is possible? Thanks in advance, Dave
you can simply send it to `nul`: ``` xcopy source destination options > nul ```
188850
How to launch multiple Internet Explorer windows/tabs from batch file?
21
2008-10-09 19:36:22
<p>I would like a batch file to launch two separate programs then have the command line window close. Actually, to clarify, I am launching Internet Explorer with two different URLs.</p> <p>So far I have something like this:</p> <pre><code>start "~\iexplore.exe" "url1" start "~\iexplore.exe" "url2" </code></pre> <p>W...
251,372
10,552
2021-06-17 06:53:18
188,930
39
2008-10-09 19:54:31
5,667
2009-10-10 12:25:21
https://stackoverflow.com/q/188850
https://stackoverflow.com/a/188930
<p>Try this in your batch file:</p> <pre><code>@echo off start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE www.google.com start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE www.yahoo.com </code></pre>
<p>Try this in your batch file:</p> <pre><code>@echo off start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE www.google.com start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE www.yahoo.com </code></pre>
1189, 7002
batch-file, internet-explorer
<h1>How to launch multiple Internet Explorer windows/tabs from batch file?</h1> <p>I would like a batch file to launch two separate programs then have the command line window close. Actually, to clarify, I am launching Internet Explorer with two different URLs.</p> <p>So far I have something like 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,427
cmd
# How to launch multiple Internet Explorer windows/tabs from batch file? I would like a batch file to launch two separate programs then have the command line window close. Actually, to clarify, I am launching Internet Explorer with two different URLs. So far I have something like this: ``` start "~\iexplore.exe" "ur...
Try this in your batch file: ``` @echo off start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE www.google.com start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE www.yahoo.com ```
975521
How to SET a variable to the path of parent directory on windows?
20
2009-06-10 13:18:25
<p>Struggling with command line again, I have figure out that I can store the current working directory in a variable like so:</p> <pre><code>SET current=%cd% </code></pre> <p>How would I set parent though? <code>SET parent=%..%</code> does not work, as it echoes <code>%..%</code></p> <p>Basically, calling a batch s...
31,793
81,520
2009-06-11 01:43:03
975,530
39
2009-06-10 13:19:53
18,797
2009-06-10 13:21:40
https://stackoverflow.com/q/975521
https://stackoverflow.com/a/975530
<p>Move up a directory, remembering the current, set the parent, and then pop down a directory, back to where you started</p> <pre><code>@echo off set current=%cd% pushd .. set parent=%cd% popd echo current %current% echo parent %parent% </code></pre>
<p>Move up a directory, remembering the current, set the parent, and then pop down a directory, back to where you started</p> <pre><code>@echo off set current=%cd% pushd .. set parent=%cd% popd echo current %current% echo parent %parent% </code></pre>
64, 1231, 7002
batch-file, command-line, windows
<h1>How to SET a variable to the path of parent directory on windows?</h1> <p>Struggling with command line again, I have figure out that I can store the current working directory in a variable like so:</p> <pre><code>SET current=%cd% </code></pre> <p>How would I set parent though? <code>SET parent=%..%</code> does no...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,428
cmd
# How to SET a variable to the path of parent directory on windows? Struggling with command line again, I have figure out that I can store the current working directory in a variable like so: ``` SET current=%cd% ``` How would I set parent though? `SET parent=%..%` does not work, as it echoes `%..%` Basically, call...
Move up a directory, remembering the current, set the parent, and then pop down a directory, back to where you started ``` @echo off set current=%cd% pushd .. set parent=%cd% popd echo current %current% echo parent %parent% ```
29107607
Best Spring batch scaling strategy
18
2015-03-17 19:04:44
<p>We have simple batch processes which are working fine. Recently we have new reqmnt to implement new batch process to generate reports. We have diff source of data to read to prepare this reports. Specifically we might have one view for each report.</p> <p>Now we want to scale this process in such a way that, it can...
15,025
509,755
2016-08-22 16:02:57
29,108,483
39
2015-03-17 19:54:51
953,327
2016-08-22 16:02:57
https://stackoverflow.com/q/29107607
https://stackoverflow.com/a/29108483
<p><strong>TLDR;</strong></p> <p>Based on your description I think you could try Multi-threaded Step with Synchronized Reader since you mention processing and writing are the more expensive part of your step.</p> <p>However, seeing as your reader is a database, I think getting a partitioned step configured and workin...
<p><strong>TLDR;</strong></p> <p>Based on your description I think you could try Multi-threaded Step with Synchronized Reader since you mention processing and writing are the more expensive part of your step.</p> <p>However, seeing as your reader is a database, I think getting a partitioned step configured and workin...
353, 1211, 3219, 41895
parallel-processing, scalability, spring, spring-batch
<h1>Best Spring batch scaling strategy</h1> <p>We have simple batch processes which are working fine. Recently we have new reqmnt to implement new batch process to generate reports. We have diff source of data to read to prepare this reports. Specifically we might have one view for each report.</p> <p>Now we want to s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,429
cmd
# Best Spring batch scaling strategy We have simple batch processes which are working fine. Recently we have new reqmnt to implement new batch process to generate reports. We have diff source of data to read to prepare this reports. Specifically we might have one view for each report. Now we want to scale this proces...
**TLDR;** Based on your description I think you could try Multi-threaded Step with Synchronized Reader since you mention processing and writing are the more expensive part of your step. However, seeing as your reader is a database, I think getting a partitioned step configured and working would be very beneficial. It...
20254666
Keep command line window open when running scheduled task executing batch file
18
2013-11-27 22:53:38
<p>I would like to have the console window kept open when running a scheduled task which executes a batch file. If I run it manually - meaning execute the batch file - the window stays open. However, using task scheduler, the console window doesn't open even though I can see the task is running. I put a pause at the en...
64,230
425,481
2024-05-13 13:04:04
20,255,000
39
2013-11-27 23:17:15
62,576
2013-11-29 14:23:23
https://stackoverflow.com/q/20254666
https://stackoverflow.com/a/20255000
<p>In the Scheduled Task dialog, just before the name of the batch file it's going to run (it's labeled <code>Program/script</code>. You now have something like:</p> <pre><code>myscript.bat </code></pre> <p>Change it to </p> <pre><code>cmd </code></pre> <p>Add the following to the **Add Arguments (optional) entry:...
<p>In the Scheduled Task dialog, just before the name of the batch file it's going to run (it's labeled <code>Program/script</code>. You now have something like:</p> <pre><code>myscript.bat </code></pre> <p>Change it to </p> <pre><code>cmd </code></pre> <p>Add the following to the **Add Arguments (optional) entry:...
9299, 30645, 40232
batch-processing, scheduled-tasks, windows-console
<h1>Keep command line window open when running scheduled task executing batch file</h1> <p>I would like to have the console window kept open when running a scheduled task which executes a batch file. If I run it manually - meaning execute the batch file - the window stays open. However, using task scheduler, the consol...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,430
cmd
# Keep command line window open when running scheduled task executing batch file I would like to have the console window kept open when running a scheduled task which executes a batch file. If I run it manually - meaning execute the batch file - the window stays open. However, using task scheduler, the console window ...
In the Scheduled Task dialog, just before the name of the batch file it's going to run (it's labeled `Program/script`. You now have something like: ``` myscript.bat ``` Change it to ``` cmd ``` Add the following to the **Add Arguments (optional) entry: ``` /k "C:\My Batch File Folder\MyScript.bat" ``` Tested on m...
3949978
Why does this batch variable never change even when set?
16
2010-10-16 17:31:56
<pre><code>@echo off SET first=0 FOR %%N IN (hello bye) DO ( SET first=1 echo %first% echo %%N ) </code></pre> <p>It seems that the variable "first" is always 0. Why?</p>
32,760
234,287
2018-11-21 18:55:21
3,950,000
39
2010-10-16 17:37:11
27,528
2010-10-16 17:37:11
https://stackoverflow.com/q/3949978
https://stackoverflow.com/a/3950000
<p>With batch files, variables are expanded when their command is read - so that would be as soon as the <code>for</code> executes. At that point, it no longer says <code>echo %first%</code>, it literally says <code>echo 0</code>, because that was the value at the point of expansion.</p> <p>To get around that, you nee...
<p>With batch files, variables are expanded when their command is read - so that would be as soon as the <code>for</code> executes. At that point, it no longer says <code>echo %first%</code>, it literally says <code>echo 0</code>, because that was the value at the point of expansion.</p> <p>To get around that, you nee...
64, 7002
batch-file, windows
<h1>Why does this batch variable never change even when set?</h1> <pre><code>@echo off SET first=0 FOR %%N IN (hello bye) DO ( SET first=1 echo %first% echo %%N ) </code></pre> <p>It seems that the variable "first" is always 0. Why?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,431
cmd
# Why does this batch variable never change even when set? ``` @echo off SET first=0 FOR %%N IN (hello bye) DO ( SET first=1 echo %first% echo %%N ) ``` It seems that the variable "first" is always 0. Why?
With batch files, variables are expanded when their command is read - so that would be as soon as the `for` executes. At that point, it no longer says `echo %first%`, it literally says `echo 0`, because that was the value at the point of expansion. To get around that, you need to use delayed expansion by surrounding y...
23723364
Windows 7 - 'make' is not recognized as an internal or external command, operable program or batch file
77
2014-05-18 15:06:51
<p>I have Windows 7 and tried to use the 'make' command but 'make' is not recognized as an internal or external command.</p> <p>I did <code>Start -&gt; cmd -&gt; run -&gt; make</code>, which outputs:</p> <blockquote> <p>'make' is not recognized as an internal or external command,operable program or batch file.</p> ...
372,752
805,660
2022-03-08 17:49:11
23,734,705
38
2014-05-19 09:53:17
193,789
2015-10-21 15:16:38
https://stackoverflow.com/q/23723364
https://stackoverflow.com/a/23734705
<p>Your problem is most likely that the shell does not know where to find your <code>make</code> program. If you want to use it from "anywhere", then you must do this, or else you will need to add the full path each time you want to call it, which is quite cumbersome. For instance:</p> <pre><code>"c:\program files\gnu...
<p>Your problem is most likely that the shell does not know where to find your <code>make</code> program. If you want to use it from "anywhere", then you must do this, or else you will need to add the full path each time you want to call it, which is quite cumbersome. For instance:</p> <pre><code>"c:\program files\gnu...
64, 2631, 4301
cmd, makefile, windows
<h1>Windows 7 - 'make' is not recognized as an internal or external command, operable program or batch file</h1> <p>I have Windows 7 and tried to use the 'make' command but 'make' is not recognized as an internal or external command.</p> <p>I did <code>Start -&gt; cmd -&gt; run -&gt; make</code>, which outputs:</p> <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,432
cmd
# Windows 7 - 'make' is not recognized as an internal or external command, operable program or batch file I have Windows 7 and tried to use the 'make' command but 'make' is not recognized as an internal or external command. I did `Start -> cmd -> run -> make`, which outputs: > 'make' is not recognized as an internal...
Your problem is most likely that the shell does not know where to find your `make` program. If you want to use it from "anywhere", then you must do this, or else you will need to add the full path each time you want to call it, which is quite cumbersome. For instance: ``` "c:\program files\gnuwin32\bin\make.exe" optio...
5215729
Is there a way to pass parameters "by name" (and not by order) to a batch .bat file?
61
2011-03-07 04:09:25
<p>I need to be able to pass parameters to a windows batch file BY NAME (and NOT by order). My purpose here is to give end user the flexibility to pass parameters in any order, and the batch file should still be able to process them.</p> <p>An example to make my question clearer:</p> <p>in the command line, user does...
50,135
647,594
2024-07-31 12:53:13
5,215,844
38
2011-03-07 04:31:37
416,627
2011-03-07 16:02:37
https://stackoverflow.com/q/5215729
https://stackoverflow.com/a/5215844
<p>Yeah you could do something like that though I don't think you can use "=" as a token delimiter. You could use say a colon ":", <code>somebatchfile.bat "SOURC:originalFile.txt" "TARGET:newFile.txt"</code>. Here is an example of how you might split the tokens:</p> <pre><code>@echo off set foo=%1 echo input: %foo% ...
<p>Yeah you could do something like that though I don't think you can use "=" as a token delimiter. You could use say a colon ":", <code>somebatchfile.bat "SOURC:originalFile.txt" "TARGET:newFile.txt"</code>. Here is an example of how you might split the tokens:</p> <pre><code>@echo off set foo=%1 echo input: %foo% ...
7002
batch-file
<h1>Is there a way to pass parameters "by name" (and not by order) to a batch .bat file?</h1> <p>I need to be able to pass parameters to a windows batch file BY NAME (and NOT by order). My purpose here is to give end user the flexibility to pass parameters in any order, and the batch file should still be able to proces...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,433
cmd
# Is there a way to pass parameters "by name" (and not by order) to a batch .bat file? I need to be able to pass parameters to a windows batch file BY NAME (and NOT by order). My purpose here is to give end user the flexibility to pass parameters in any order, and the batch file should still be able to process them. ...
Yeah you could do something like that though I don't think you can use "=" as a token delimiter. You could use say a colon ":", `somebatchfile.bat "SOURC:originalFile.txt" "TARGET:newFile.txt"`. Here is an example of how you might split the tokens: ``` @echo off set foo=%1 echo input: %foo% for /f "tokens=1,2 delims...
27773805
What does /p mean in set /p?
53
2015-01-05 05:18:16
<p>What does <code>/p</code> stand for in <code>set /p=</code>? I know that <code>/</code> enables a switch, and I'm fairly sure that I know <code>/a</code> is for <code>arithmetic</code>. I've heard numerous rumours, some saying <code>/p</code> is for <code>prompt</code>, others stating it stands for <code>print</code...
215,251
4,390,980
2025-09-02 01:49:28
27,773,874
38
2015-01-05 05:27:52
4,158,862
2025-09-02 01:49:28
https://stackoverflow.com/q/27773805
https://stackoverflow.com/a/27773874
<p>For future reference, you can get help for any command by using the <code>/?</code> switch, which should explain what switches do what.</p> <p>According to the <code>set /?</code> screen, the format for <code>set /p</code> is <code>SET /P variable=[promptString]</code> which would indicate that the p in <code>/p</co...
<p>For future reference, you can get help for any command by using the <code>/?</code> switch, which should explain what switches do what.</p> <p>According to the <code>set /?</code> screen, the format for <code>set /p</code> is <code>SET /P variable=[promptString]</code> which would indicate that the p in <code>/p</co...
64, 7002, 14253
abbreviation, batch-file, windows
<h1>What does /p mean in set /p?</h1> <p>What does <code>/p</code> stand for in <code>set /p=</code>? I know that <code>/</code> enables a switch, and I'm fairly sure that I know <code>/a</code> is for <code>arithmetic</code>. I've heard numerous rumours, some saying <code>/p</code> is for <code>prompt</code>, others s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,434
cmd
# What does /p mean in set /p? What does `/p` stand for in `set /p=`? I know that `/` enables a switch, and I'm fairly sure that I know `/a` is for `arithmetic`. I've heard numerous rumours, some saying `/p` is for `prompt`, others stating it stands for `print`. The only reason I slightly doubt it is `prompt` is becau...
For future reference, you can get help for any command by using the `/?` switch, which should explain what switches do what. According to the `set /?` screen, the format for `set /p` is `SET /P variable=[promptString]` which would indicate that the p in `/p` is "prompt." It just prints in your example because `<nul` p...
906586
Changing a batch file when its running
50
2009-05-25 12:42:57
<p>I am running a long running batch file. I now realize that I have to add some more commands at the end of the batch file (no changes to exisiting content, just some extra commands). Is it possible to do this, given that most batch files are read incrementally and executed one by one? Or does the system read the enti...
18,552
18,548
2020-06-22 12:05:56
906,629
38
2009-05-25 12:54:48
18,797
2009-05-25 12:54:48
https://stackoverflow.com/q/906586
https://stackoverflow.com/a/906629
<p>I just tried it, and against my intuition, it picked up the new commands at the end (on Windows XP)</p> <p>I created a batch file containing</p> <pre><code>echo Hello pause echo world </code></pre> <p>I ran the file, and while it was paused, added </p> <pre><code>echo Salute </code></pre> <p>Saved it and presse...
<p>I just tried it, and against my intuition, it picked up the new commands at the end (on Windows XP)</p> <p>I created a batch file containing</p> <pre><code>echo Hello pause echo world </code></pre> <p>I ran the file, and while it was paused, added </p> <pre><code>echo Salute </code></pre> <p>Saved it and presse...
64, 7002
batch-file, windows
<h1>Changing a batch file when its running</h1> <p>I am running a long running batch file. I now realize that I have to add some more commands at the end of the batch file (no changes to exisiting content, just some extra commands). Is it possible to do this, given that most batch files are read incrementally and execu...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,435
cmd
# Changing a batch file when its running I am running a long running batch file. I now realize that I have to add some more commands at the end of the batch file (no changes to exisiting content, just some extra commands). Is it possible to do this, given that most batch files are read incrementally and executed one b...
I just tried it, and against my intuition, it picked up the new commands at the end (on Windows XP) I created a batch file containing ``` echo Hello pause echo world ``` I ran the file, and while it was paused, added ``` echo Salute ``` Saved it and pressed enter to contine the pause, all three prompts were echoed...
2874911
Halt batch file until service stop is complete?
45
2010-05-20 14:54:27
<p>I'm using a batch file to stop a Windows service. I'm using the <code>sc</code> command, but I'm open to other ideas, given the question below. The problem is that the batch file proceeds <em>while</em> the service is stopping (the <code>stop</code> argument to <code>sc</code> seems only to <em>request</em> the st...
72,403
116,895
2022-09-21 18:16:55
2,874,964
38
2010-05-20 15:00:24
326,480
2019-12-12 09:21:11
https://stackoverflow.com/q/2874911
https://stackoverflow.com/a/2874964
<p>You can use <code>NET stop</code>, which is synchronous, i.e it will wait until the service stops.</p> <p>See - <a href="https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_stop.mspx?mfr=true" rel="noreferrer">NET stop</a></p>
<p>You can use <code>NET stop</code>, which is synchronous, i.e it will wait until the service stops.</p> <p>See - <a href="https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_stop.mspx?mfr=true" rel="noreferrer">NET stop</a></p>
7002, 17841
batch-file, servicecontroller
<h1>Halt batch file until service stop is complete?</h1> <p>I'm using a batch file to stop a Windows service. I'm using the <code>sc</code> command, but I'm open to other ideas, given the question below. The problem is that the batch file proceeds <em>while</em> the service is stopping (the <code>stop</code> argument...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,436
cmd
# Halt batch file until service stop is complete? I'm using a batch file to stop a Windows service. I'm using the `sc` command, but I'm open to other ideas, given the question below. The problem is that the batch file proceeds *while* the service is stopping (the `stop` argument to `sc` seems only to *request* the sto...
You can use `NET stop`, which is synchronous, i.e it will wait until the service stops. See - [NET stop](https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_stop.mspx?mfr=true)
6979747
Read stdin stream in a batch file
43
2011-08-08 08:57:47
<p>Is it possible to use a piped stdin stream inside a batch file?</p> <p>I want to be able to redirect the output of one command into my batch file <code>process.bat</code> list so:</p> <pre><code>C:\&gt;someOtherProgram.exe | process.bat </code></pre> <p>My first attempt looked like:</p> <pre><code>echo OFF setlo...
41,257
305,264
2022-03-09 06:41:04
6,980,605
38
2011-08-08 10:11:32
463,115
2022-03-09 06:41:04
https://stackoverflow.com/q/6979747
https://stackoverflow.com/a/6980605
<p><code>set /p</code> doesn't work with pipes, it takes one (randomly) line from the input.<br /> But you can use <code>more</code> inside of an for-loop.</p> <pre><code>@echo off setlocal for /F &quot;tokens=*&quot; %%a in ('more') do ( echo #%%a ) </code></pre> <p>But this fails with lines beginning with a semicol...
<p><code>set /p</code> doesn't work with pipes, it takes one (randomly) line from the input.<br /> But you can use <code>more</code> inside of an for-loop.</p> <pre><code>@echo off setlocal for /F &quot;tokens=*&quot; %%a in ('more') do ( echo #%%a ) </code></pre> <p>But this fails with lines beginning with a semicol...
64, 1701, 4867, 7002
batch-file, stdin, stdout, windows
<h1>Read stdin stream in a batch file</h1> <p>Is it possible to use a piped stdin stream inside a batch file?</p> <p>I want to be able to redirect the output of one command into my batch file <code>process.bat</code> list so:</p> <pre><code>C:\&gt;someOtherProgram.exe | process.bat </code></pre> <p>My first attempt ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,437
cmd
# Read stdin stream in a batch file Is it possible to use a piped stdin stream inside a batch file? I want to be able to redirect the output of one command into my batch file `process.bat` list so: ``` C:\>someOtherProgram.exe | process.bat ``` My first attempt looked like: ``` echo OFF setlocal :again set /p inp...
`set /p` doesn't work with pipes, it takes one (randomly) line from the input. But you can use `more` inside of an for-loop. ``` @echo off setlocal for /F "tokens=*" %%a in ('more') do ( echo #%%a ) ``` But this fails with lines beginning with a semicolon (as the FOR-LOOP-standard of eol is `;`). And it can't r...
18139756
How to run a .class file that is part of a package from cmd?
42
2013-08-09 03:46:31
<p>I keep getting errors when I make my <code>.class</code> part of a <code>package</code> and try to run it from cmd.</p> <p>Here's the code that works after using <code>javac</code> and then java:</p> <pre><code>class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!...
82,574
null
2022-11-13 20:30:12
18,139,799
38
2013-08-09 03:54:42
2,658,854
2018-12-11 17:20:29
https://stackoverflow.com/q/18139756
https://stackoverflow.com/a/18139799
<p>Suppose you did <code>cd C:/projects</code> and <code>HelloWorld.class</code> is in <code>C:/projects/com</code>, then just type:</p> <pre><code>java com.HelloWorld </code></pre>
<p>Suppose you did <code>cd C:/projects</code> and <code>HelloWorld.class</code> is in <code>C:/projects/com</code>, then just type:</p> <pre><code>java com.HelloWorld </code></pre>
17, 2631, 5187, 7427, 13613
class, cmd, java, javac, package
<h1>How to run a .class file that is part of a package from cmd?</h1> <p>I keep getting errors when I make my <code>.class</code> part of a <code>package</code> and try to run it from cmd.</p> <p>Here's the code that works after using <code>javac</code> and then java:</p> <pre><code>class HelloWorld { public stat...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,438
cmd
# How to run a .class file that is part of a package from cmd? I keep getting errors when I make my `.class` part of a `package` and try to run it from cmd. Here's the code that works after using `javac` and then java: ``` class HelloWorld { public static void main(String[] args) { System.out.println("He...
Suppose you did `cd C:/projects` and `HelloWorld.class` is in `C:/projects/com`, then just type: ``` java com.HelloWorld ```
2888976
How to make .BAT file delete it self after completion?
41
2010-05-22 17:05:56
<p>How to make .BAT file delete it self after completion? I have a simple bat file that terminates a process. I want that .BAT file to delete itself.</p>
111,776
434,051
2021-10-05 12:46:32
2,889,684
38
2010-05-22 20:44:00
232,593
2016-07-31 05:56:17
https://stackoverflow.com/q/2888976
https://stackoverflow.com/a/2889684
<pre><code>@ECHO OFF SETLOCAL SET someOtherProgram=SomeOtherProgram.exe TASKKILL /IM "%someOtherProgram%" ECHO "This script will now self-destruct. Please ignore the next error message" DEL "%~f0" </code></pre> <p>Note that the DEL line better be the last thing you intend to execute inside the batch file, otherwise ...
<pre><code>@ECHO OFF SETLOCAL SET someOtherProgram=SomeOtherProgram.exe TASKKILL /IM "%someOtherProgram%" ECHO "This script will now self-destruct. Please ignore the next error message" DEL "%~f0" </code></pre> <p>Note that the DEL line better be the last thing you intend to execute inside the batch file, otherwise ...
5910, 7002, 37510
batch-file, delete-file, process
<h1>How to make .BAT file delete it self after completion?</h1> <p>How to make .BAT file delete it self after completion? I have a simple bat file that terminates a process. I want that .BAT file to delete itself.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,439
cmd
# How to make .BAT file delete it self after completion? How to make .BAT file delete it self after completion? I have a simple bat file that terminates a process. I want that .BAT file to delete itself.
``` @ECHO OFF SETLOCAL SET someOtherProgram=SomeOtherProgram.exe TASKKILL /IM "%someOtherProgram%" ECHO "This script will now self-destruct. Please ignore the next error message" DEL "%~f0" ``` Note that the DEL line better be the last thing you intend to execute inside the batch file, otherwise you're out of luck :...
18391932
How can I shorten the path of a DOS prompt?
38
2013-08-22 22:38:58
<p>My path on my DOS prompt is ridiculously long. How can I shorten this?</p> <pre><code>C:\RUBY\Ruby_Practice\prep-work-master\coding-test-2\practice-problems\spec&gt; </code></pre>
27,050
2,694,389
2025-05-18 22:22:21
18,391,954
38
2013-08-22 22:42:18
2,587,816
2017-01-05 14:57:35
https://stackoverflow.com/q/18391932
https://stackoverflow.com/a/18391954
<p>Right-click on My Computer|Properties. Then from the Advanced Tab, click Environment Variables, then add a new User Variable called PROMPT and set it to <code>$p$_$+$g</code>.</p> <p><a href="http://www.hanselman.com/blog/ABetterPROMPTForCMDEXEOrCoolPromptEnvironmentVariablesAndANiceTransparentMultiprompt.aspx" rel...
<p>Right-click on My Computer|Properties. Then from the Advanced Tab, click Environment Variables, then add a new User Variable called PROMPT and set it to <code>$p$_$+$g</code>.</p> <p><a href="http://www.hanselman.com/blog/ABetterPROMPTForCMDEXEOrCoolPromptEnvironmentVariablesAndANiceTransparentMultiprompt.aspx" rel...
2631, 5003
cmd, prompt
<h1>How can I shorten the path of a DOS prompt?</h1> <p>My path on my DOS prompt is ridiculously long. How can I shorten this?</p> <pre><code>C:\RUBY\Ruby_Practice\prep-work-master\coding-test-2\practice-problems\spec&gt; </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,440
cmd
# How can I shorten the path of a DOS prompt? My path on my DOS prompt is ridiculously long. How can I shorten this? ``` C:\RUBY\Ruby_Practice\prep-work-master\coding-test-2\practice-problems\spec> ```
Right-click on My Computer|Properties. Then from the Advanced Tab, click Environment Variables, then add a new User Variable called PROMPT and set it to `$p$_$+$g`. <http://www.hanselman.com/blog/ABetterPROMPTForCMDEXEOrCoolPromptEnvironmentVariablesAndANiceTransparentMultiprompt.aspx>
1648172
Invoke EXE from batch file *without* waiting
34
2009-10-30 05:32:54
<p>How do I invoke an EXE from a batch file without having the latter waiting for the EXE to finish? Something like the Cygwin 'cygstart'?</p>
41,210
129,543
2016-03-11 20:45:01
1,648,175
38
2009-10-30 05:34:06
7,256
2016-03-11 20:45:01
https://stackoverflow.com/q/1648172
https://stackoverflow.com/a/1648175
<p>Use "<code>start</code>". Type "<code>start /?</code>" at a command prompt.</p>
<p>Use "<code>start</code>". Type "<code>start /?</code>" at a command prompt.</p>
7002
batch-file
<h1>Invoke EXE from batch file *without* waiting</h1> <p>How do I invoke an EXE from a batch file without having the latter waiting for the EXE to finish? Something like the Cygwin 'cygstart'?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,441
cmd
# Invoke EXE from batch file *without* waiting How do I invoke an EXE from a batch file without having the latter waiting for the EXE to finish? Something like the Cygwin 'cygstart'?
Use "`start`". Type "`start /?`" at a command prompt.
17279114
split path and take last folder name in batch script
32
2013-06-24 15:21:46
<p>I want to split the string (having a path) with <code>\</code>and take last folder name in a variable. Please help.</p> <p>e.g<br> mypath=D:\FOLDER1\FOLDER2\FOLDER3\</p> <p>I want FOLDER3 in a variable.</p> <p>I tried with the command below which is working if the the last character is not <code>\</code> : </p> ...
55,064
2,357,780
2022-11-21 07:10:25
17,279,910
38
2013-06-24 16:02:38
922,712
2022-10-17 12:37:12
https://stackoverflow.com/q/17279114
https://stackoverflow.com/a/17279910
<pre><code>@echo off set MYDIR=C:\FOLDER1\FOLDER2\FOLDER3\ if &quot;%MYDIR:~-1%&quot; == &quot;\&quot; set &quot;MYDIR1=%MYDIR:~0,-1%&quot; for %%f in (&quot;%MYDIR1%&quot;) do set &quot;myfolder=%%~nxf&quot; echo %myfolder% </code></pre> <p>outputs</p> <pre><code>FOLDER3 </code></pre>
<pre><code>@echo off set MYDIR=C:\FOLDER1\FOLDER2\FOLDER3\ if &quot;%MYDIR:~-1%&quot; == &quot;\&quot; set &quot;MYDIR1=%MYDIR:~0,-1%&quot; for %%f in (&quot;%MYDIR1%&quot;) do set &quot;myfolder=%%~nxf&quot; echo %myfolder% </code></pre> <p>outputs</p> <pre><code>FOLDER3 </code></pre>
64, 218, 2531, 2631, 7002
batch-file, cmd, directory, for-loop, windows
<h1>split path and take last folder name in batch script</h1> <p>I want to split the string (having a path) with <code>\</code>and take last folder name in a variable. Please help.</p> <p>e.g<br> mypath=D:\FOLDER1\FOLDER2\FOLDER3\</p> <p>I want FOLDER3 in a variable.</p> <p>I tried with the command below which is wo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,442
cmd
# split path and take last folder name in batch script I want to split the string (having a path) with `\`and take last folder name in a variable. Please help. e.g mypath=D:\FOLDER1\FOLDER2\FOLDER3\ I want FOLDER3 in a variable. I tried with the command below which is working if the the last character is not `\` ...
``` @echo off set MYDIR=C:\FOLDER1\FOLDER2\FOLDER3\ if "%MYDIR:~-1%" == "\" set "MYDIR1=%MYDIR:~0,-1%" for %%f in ("%MYDIR1%") do set "myfolder=%%~nxf" echo %myfolder% ``` outputs ``` FOLDER3 ```
3551888
Pausing a batch file when double-clicked but not when run from a console window?
29
2010-08-23 21:33:10
<p>Is there a way for a batch file (in this case, running on Windows XP) to determine whether it was launched from a command line (i.e. inside a console window) or launched via the shell (e.g. by double-clicking)?</p> <p>I have a script which I'd like to have pause at certain points when run via the shell, but not whe...
12,039
46,387
2025-06-11 18:44:24
3,552,659
38
2010-08-24 00:14:02
73,070
2019-08-06 15:45:49
https://stackoverflow.com/q/3551888
https://stackoverflow.com/a/3552659
<p>Found one :-) – After desperately thinking of what <code>cmd</code> might do when run interactively but not when launching a batch file directly ... I finally found one.</p> <p>The pseudo-variable <code>%cmdcmdline%</code> contains the command line that was used to launch <code>cmd</code>. In case <code>cmd</code> ...
<p>Found one :-) – After desperately thinking of what <code>cmd</code> might do when run interactively but not when launching a batch file directly ... I finally found one.</p> <p>The pseudo-variable <code>%cmdcmdline%</code> contains the command line that was used to launch <code>cmd</code>. In case <code>cmd</code> ...
64, 7002
batch-file, windows
<h1>Pausing a batch file when double-clicked but not when run from a console window?</h1> <p>Is there a way for a batch file (in this case, running on Windows XP) to determine whether it was launched from a command line (i.e. inside a console window) or launched via the shell (e.g. by double-clicking)?</p> <p>I have a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,443
cmd
# Pausing a batch file when double-clicked but not when run from a console window? Is there a way for a batch file (in this case, running on Windows XP) to determine whether it was launched from a command line (i.e. inside a console window) or launched via the shell (e.g. by double-clicking)? I have a script which I'...
Found one :-) – After desperately thinking of what `cmd` might do when run interactively but not when launching a batch file directly ... I finally found one. The pseudo-variable `%cmdcmdline%` contains the command line that was used to launch `cmd`. In case `cmd` was started normally this contains something akin to t...
21086649
Execute command line from a specific folder
28
2014-01-13 08:21:39
<p>I have a project , running from c:\work\SomeVariantFolder\MySolution\MyProject\Bin\Debug, and I need to execute a command line from this project from one of the subfolders : c:\work\SomeVariantDev. The problem I am facing is to get from the folder where my project running from to the folder where i am suppose to run...
36,245
3,150,947
2014-01-13 08:44:08
21,086,978
38
2014-01-13 08:44:08
3,165,255
2014-01-13 08:44:08
https://stackoverflow.com/q/21086649
https://stackoverflow.com/a/21086978
<p>Try setting the <code>WorkingDirectory</code> property of <code>ProcessStartInfo</code> to sets the initial directory for the process to be started.</p> <pre><code>var startInfo = new System.Diagnostics.ProcessStartInfo { WorkingDirectory = @"The\Process\Working\Directory", WindowStyle = System.Diagnostics.Proc...
<p>Try setting the <code>WorkingDirectory</code> property of <code>ProcessStartInfo</code> to sets the initial directory for the process to be started.</p> <pre><code>var startInfo = new System.Diagnostics.ProcessStartInfo { WorkingDirectory = @"The\Process\Working\Directory", WindowStyle = System.Diagnostics.Proc...
9, 2631
c#, cmd
<h1>Execute command line from a specific folder</h1> <p>I have a project , running from c:\work\SomeVariantFolder\MySolution\MyProject\Bin\Debug, and I need to execute a command line from this project from one of the subfolders : c:\work\SomeVariantDev. The problem I am facing is to get from the folder where my project...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,444
cmd
# Execute command line from a specific folder I have a project , running from c:\work\SomeVariantFolder\MySolution\MyProject\Bin\Debug, and I need to execute a command line from this project from one of the subfolders : c:\work\SomeVariantDev. The problem I am facing is to get from the folder where my project running ...
Try setting the `WorkingDirectory` property of `ProcessStartInfo` to sets the initial directory for the process to be started. ``` var startInfo = new System.Diagnostics.ProcessStartInfo { WorkingDirectory = @"The\Process\Working\Directory", WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal, FileName = ...
9699976
Batch script to merge files without Hex char 1A at the end
24
2012-03-14 10:19:54
<p>I'm merging two ASCII files via a simple batch script like this</p> <pre><code>COPY a.txt+b.txt c.txt /y /a </code></pre> <p>The problem is, the very last character in C gets set to <code>1A</code>, the HEX notation for <code>SUB</code>. c.txt is fed into another executable which does not like the <code>1A</code> ...
16,983
315,828
2025-12-29 23:09:40
9,700,264
38
2012-03-14 10:36:20
1,204,258
2012-03-14 10:36:20
https://stackoverflow.com/q/9699976
https://stackoverflow.com/a/9700264
<p>The placing of <code>/a</code> and <code>/b</code> switches is critical. They perform differently depending on whether they are placed after the source filename(s) or the target filename.</p> <p>When used with a target filename, <code>/a</code> causes the end-of-file marker (ASCII 26) to be added. You are actually s...
<p>The placing of <code>/a</code> and <code>/b</code> switches is critical. They perform differently depending on whether they are placed after the source filename(s) or the target filename.</p> <p>When used with a target filename, <code>/a</code> causes the end-of-file marker (ASCII 26) to be added. You are actually s...
7002
batch-file
<h1>Batch script to merge files without Hex char 1A at the end</h1> <p>I'm merging two ASCII files via a simple batch script like this</p> <pre><code>COPY a.txt+b.txt c.txt /y /a </code></pre> <p>The problem is, the very last character in C gets set to <code>1A</code>, the HEX notation for <code>SUB</code>. c.txt is ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,445
cmd
# Batch script to merge files without Hex char 1A at the end I'm merging two ASCII files via a simple batch script like this ``` COPY a.txt+b.txt c.txt /y /a ``` The problem is, the very last character in C gets set to `1A`, the HEX notation for `SUB`. c.txt is fed into another executable which does not like the `1A...
The placing of `/a` and `/b` switches is critical. They perform differently depending on whether they are placed after the source filename(s) or the target filename. When used with a target filename, `/a` causes the end-of-file marker (ASCII 26) to be added. You are actually specifying this! ### When used with the so...
57833235
SSL Certificate add failed, Error: 183 Cannot create a file when that file already exists - How to bound certificate to ipport?
20
2019-09-07 11:26:48
<p>I'm trying to execute this command in CMD:</p> <pre><code>netsh http add sslcert ipport=0.0.0.0:443 certhash=‎89857a42309423c239f42392384a appid={214124cd-d05b-4309-9af9-13123454a52b} </code></pre> <p>and got error message:</p> <blockquote> <p>SSL Certificate add failed, Error: 183 Cannot create a file when that fil...
37,248
4,865,599
2025-01-30 10:42:28
57,833,583
38
2019-09-07 12:14:15
4,865,599
2021-01-28 09:50:36
https://stackoverflow.com/q/57833235
https://stackoverflow.com/a/57833583
<p>It means that the port has already bounded a certificate. If we want to bound new certificate we need to delete the old one and bound new one.</p> <ol> <li><p>Check if port has bounded a cert:</p> <p><code>netsh http show sslcert &gt; c:\result.txt</code></p> </li> <li><p>Open the result.txt and search for the port ...
<p>It means that the port has already bounded a certificate. If we want to bound new certificate we need to delete the old one and bound new one.</p> <ol> <li><p>Check if port has bounded a cert:</p> <p><code>netsh http show sslcert &gt; c:\result.txt</code></p> </li> <li><p>Open the result.txt and search for the port ...
642, 2631, 5954, 14423, 42672
certificate, cmd, https, netsh, ssl-certificate
<h1>SSL Certificate add failed, Error: 183 Cannot create a file when that file already exists - How to bound certificate to ipport?</h1> <p>I'm trying to execute this command in CMD:</p> <pre><code>netsh http add sslcert ipport=0.0.0.0:443 certhash=‎89857a42309423c239f42392384a appid={214124cd-d05b-4309-9af9-13123454a5...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,446
cmd
# SSL Certificate add failed, Error: 183 Cannot create a file when that file already exists - How to bound certificate to ipport? I'm trying to execute this command in CMD: ``` netsh http add sslcert ipport=0.0.0.0:443 certhash=‎89857a42309423c239f42392384a appid={214124cd-d05b-4309-9af9-13123454a52b} ``` and got er...
It means that the port has already bounded a certificate. If we want to bound new certificate we need to delete the old one and bound new one. 1. Check if port has bounded a cert: `netsh http show sslcert > c:\result.txt` 2. Open the result.txt and search for the port (in my case 443) 3. Delete the old certificate...
36040704
Unicode symbols in a batch file
20
2016-03-16 15:52:52
<p>If I type this command into a cmd: "<em>echo █</em>", then it displays the " █ " symbol. But if I type the command "<em>echo █</em>" into a batch (.bat) file I get what is shown in the pic below.</p> <p><a href="https://i.sstatic.net/3w5f2.png" rel="noreferrer"><img src="https://i.sstatic.net/3w5f2.png" alt="enter ...
17,224
6,072,562
2017-12-11 22:32:22
47,762,524
38
2017-12-11 22:32:22
912,946
2017-12-11 22:32:22
https://stackoverflow.com/q/36040704
https://stackoverflow.com/a/47762524
<p>You can manually set the codepage to UTF-8 by typing <code>chcp 65001</code> at the top of your batch file.</p>
<p>You can manually set the codepage to UTF-8 by typing <code>chcp 65001</code> at the top of your batch file.</p>
7002
batch-file
<h1>Unicode symbols in a batch file</h1> <p>If I type this command into a cmd: "<em>echo █</em>", then it displays the " █ " symbol. But if I type the command "<em>echo █</em>" into a batch (.bat) file I get what is shown in the pic below.</p> <p><a href="https://i.sstatic.net/3w5f2.png" rel="noreferrer"><img src="htt...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,447
cmd
# Unicode symbols in a batch file If I type this command into a cmd: "*echo █*", then it displays the " █ " symbol. But if I type the command "*echo █*" into a batch (.bat) file I get what is shown in the pic below. [![enter image description here](https://i.sstatic.net/3w5f2.png)](https://i.sstatic.net/3w5f2.png) H...
You can manually set the codepage to UTF-8 by typing `chcp 65001` at the top of your batch file.
42693320
Why does my batch script stop after activating a new conda env?
20
2017-03-09 10:48:40
<p>This is enough to reproduce the issue:</p> <p>Save as <code>test.bat</code></p> <pre><code>:: Create Conda env set name=%1 conda create -n %name% python -y activate %name% echo "Never gets here" :: script should continue below... </code></pre> <p>Run from cmd.</p> <pre><code>&gt;test.bat "testname" </code></pre>...
10,418
1,706,564
2021-08-24 02:31:45
42,693,586
38
2017-03-09 11:00:26
2,128,947
2017-03-09 11:00:26
https://stackoverflow.com/q/42693320
https://stackoverflow.com/a/42693586
<p>use</p> <pre><code>call activate %name% </code></pre> <ul> <li>I'm assuming that <code>activate</code> is a batch file. If you <code>call</code> it, processing will return after that batch is finished. Without the <code>call</code>, execution is transferred to <code>activate</code> and ends when <code>activate</co...
<p>use</p> <pre><code>call activate %name% </code></pre> <ul> <li>I'm assuming that <code>activate</code> is a batch file. If you <code>call</code> it, processing will return after that batch is finished. Without the <code>call</code>, execution is transferred to <code>activate</code> and ends when <code>activate</co...
7002, 96537, 102830
batch-file, conda, miniconda
<h1>Why does my batch script stop after activating a new conda env?</h1> <p>This is enough to reproduce the issue:</p> <p>Save as <code>test.bat</code></p> <pre><code>:: Create Conda env set name=%1 conda create -n %name% python -y activate %name% echo "Never gets here" :: script should continue below... </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,448
cmd
# Why does my batch script stop after activating a new conda env? This is enough to reproduce the issue: Save as `test.bat` ``` :: Create Conda env set name=%1 conda create -n %name% python -y activate %name% echo "Never gets here" :: script should continue below... ``` Run from cmd. ``` >test.bat "testname" ``` ...
use ``` call activate %name% ``` - I'm assuming that `activate` is a batch file. If you `call` it, processing will return after that batch is finished. Without the `call`, execution is transferred to `activate` and ends when `activate` ends.
905500
Fastest way to delete a tree of directories in batch file
19
2009-05-25 05:58:24
<p>I need to write a batch file that received a directory that contains a huge number of empty sub-directories and deletes them all.</p> <p>What's the fastest way of doing this? (by fast I mean not like what Windows Explorer does when you try to delete such a directory...)</p> <p><strong>Clarification:</strong></p> ...
11,425
11,208
2011-11-02 18:17:15
905,511
38
2009-05-25 06:00:32
47,181
2009-05-25 06:00:32
https://stackoverflow.com/q/905500
https://stackoverflow.com/a/905511
<pre><code>rd yourdirname /s/q </code></pre> <p>Will do the job regardless of whether they are empty or not.</p>
<pre><code>rd yourdirname /s/q </code></pre> <p>Will do the job regardless of whether they are empty or not.</p>
64, 724, 7002
batch-file, file-io, windows
<h1>Fastest way to delete a tree of directories in batch file</h1> <p>I need to write a batch file that received a directory that contains a huge number of empty sub-directories and deletes them all.</p> <p>What's the fastest way of doing this? (by fast I mean not like what Windows Explorer does when you try to delete...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,449
cmd
# Fastest way to delete a tree of directories in batch file I need to write a batch file that received a directory that contains a huge number of empty sub-directories and deletes them all. What's the fastest way of doing this? (by fast I mean not like what Windows Explorer does when you try to delete such a director...
``` rd yourdirname /s/q ``` Will do the job regardless of whether they are empty or not.
138819
batch find file extension
19
2008-09-26 11:15:30
<p>If I am iterating over each file using :</p> <pre><code>@echo off FOR %%f IN (*\*.\**) DO ( echo %%f ) </code></pre> <p>how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code : <code>echo "%t:~-3%"</code> to print but with no success.</p>
55,075
11,234
2011-09-19 15:47:08
138,847
38
2008-09-26 11:22:49
1,377,325
2008-09-26 11:24:21
https://stackoverflow.com/q/138819
https://stackoverflow.com/a/138847
<p>The FOR command has several built-in switches that allow you to modify file names. Try the following:</p> <pre><code>@echo off for %%i in (*.*) do echo "%%~xi" </code></pre> <p>For further details, use <code>help for</code> to get a complete list of the modifiers - there are quite a few!</p>
<p>The FOR command has several built-in switches that allow you to modify file names. Try the following:</p> <pre><code>@echo off for %%i in (*.*) do echo "%%~xi" </code></pre> <p>For further details, use <code>help for</code> to get a complete list of the modifiers - there are quite a few!</p>
64, 5370, 7002
batch-file, dos, windows
<h1>batch find file extension</h1> <p>If I am iterating over each file using :</p> <pre><code>@echo off FOR %%f IN (*\*.\**) DO ( echo %%f ) </code></pre> <p>how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code : <code>echo "%t:~-3%"</code> to print...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,450
cmd
# batch find file extension If I am iterating over each file using : ``` @echo off FOR %%f IN (*\*.\**) DO ( echo %%f ) ``` how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code : `echo "%t:~-3%"` to print but with no success.
The FOR command has several built-in switches that allow you to modify file names. Try the following: ``` @echo off for %%i in (*.*) do echo "%%~xi" ``` For further details, use `help for` to get a complete list of the modifiers - there are quite a few!
6711615
Using multiple IF statements in a batch file
18
2011-07-15 18:29:53
<p>When using more than 1 IF statement, is there a special guideline that should be followed? Should they be grouped? Should I use parenthesis to wrap the command(s)?</p> <p>An example to use would be:</p> <pre><code>IF EXIST somefile.txt IF EXIST someotherfile.txt SET var=somefile.txt,someotherfile.txt </code></pre>...
163,918
781,339
2015-08-06 05:07:47
6,711,887
38
2011-07-15 18:56:29
232,593
2011-07-15 23:32:32
https://stackoverflow.com/q/6711615
https://stackoverflow.com/a/6711887
<blockquote> <p>is there a special guideline that should be followed</p> </blockquote> <p>There is no "standard" way to do batch files, because the vast majority of their authors and maintainers either don't understand programming concepts, or they think they don't apply to batch files.</p> <p>But I am a programmer...
<blockquote> <p>is there a special guideline that should be followed</p> </blockquote> <p>There is no "standard" way to do batch files, because the vast majority of their authors and maintainers either don't understand programming concepts, or they think they don't apply to batch files.</p> <p>But I am a programmer...
2631, 2773, 7002
batch-file, cmd, if-statement
<h1>Using multiple IF statements in a batch file</h1> <p>When using more than 1 IF statement, is there a special guideline that should be followed? Should they be grouped? Should I use parenthesis to wrap the command(s)?</p> <p>An example to use would be:</p> <pre><code>IF EXIST somefile.txt IF EXIST someotherfile.tx...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,451
cmd
# Using multiple IF statements in a batch file When using more than 1 IF statement, is there a special guideline that should be followed? Should they be grouped? Should I use parenthesis to wrap the command(s)? An example to use would be: ``` IF EXIST somefile.txt IF EXIST someotherfile.txt SET var=somefile.txt,some...
> is there a special guideline that should be followed There is no "standard" way to do batch files, because the vast majority of their authors and maintainers either don't understand programming concepts, or they think they don't apply to batch files. But I am a programmer. I'm used to compiling, and I'm used to deb...
5588264
Batch command to move files to a new directory
18
2011-04-07 22:09:20
<p>I want to write a batch job that when executed will grab all the files in the <code>C:\Test\Log</code> folder and move them to a new directory in the <code>C:\Test</code>. This new directory will have a name called "Backup-" and CURRENT DATE. </p> <p>So once completed, the log folder should be empty with all the f...
137,974
697,671
2017-03-17 13:39:23
5,588,502
38
2011-04-07 22:42:10
62,576
2011-04-07 23:14:18
https://stackoverflow.com/q/5588264
https://stackoverflow.com/a/5588502
<p>Something like this might help:</p> <pre><code>SET Today=%Date:~10,4%%Date:~4,2%%Date:~7,2% mkdir C:\Test\Backup-%Today% move C:\Test\Log\*.* C:\Test\Backup-%Today%\ SET Today= </code></pre> <p>The important part is the first line. It takes the output of the internal <code>DATE</code> value and parses it into an e...
<p>Something like this might help:</p> <pre><code>SET Today=%Date:~10,4%%Date:~4,2%%Date:~7,2% mkdir C:\Test\Backup-%Today% move C:\Test\Log\*.* C:\Test\Backup-%Today%\ SET Today= </code></pre> <p>The important part is the first line. It takes the output of the internal <code>DATE</code> value and parses it into an e...
64, 2631, 7002
batch-file, cmd, windows
<h1>Batch command to move files to a new directory</h1> <p>I want to write a batch job that when executed will grab all the files in the <code>C:\Test\Log</code> folder and move them to a new directory in the <code>C:\Test</code>. This new directory will have a name called "Backup-" and CURRENT DATE. </p> <p>So once ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,452
cmd
# Batch command to move files to a new directory I want to write a batch job that when executed will grab all the files in the `C:\Test\Log` folder and move them to a new directory in the `C:\Test`. This new directory will have a name called "Backup-" and CURRENT DATE. So once completed, the log folder should be empt...
Something like this might help: ``` SET Today=%Date:~10,4%%Date:~4,2%%Date:~7,2% mkdir C:\Test\Backup-%Today% move C:\Test\Log\*.* C:\Test\Backup-%Today%\ SET Today= ``` The important part is the first line. It takes the output of the internal `DATE` value and parses it into an environmental variable named `Today`, i...
3716422
Mapping a network drive without hardcoding a drive letter in a batch file
18
2010-09-15 09:40:23
<p>I need to map a network drive with a batch file, but don't want to specify the drive letter.</p> <p>The batch file is used as part of a deployment process; I call the batch file from <code>CruiseControl.Net</code>, the batch file needs to map a UNC path which requires credentials to authenticate. Then the batch fil...
89,489
96,505
2017-01-31 18:10:57
3,716,594
38
2010-09-15 10:03:59
152,522
2010-09-15 12:14:56
https://stackoverflow.com/q/3716422
https://stackoverflow.com/a/3716594
<p>If you don't have multiple network shares connected simultaniously, you can make <code>net use *</code> assign a free drive letter for you. Afterwards you can use <code>robocopy</code> to access the share via its UNC path and release any connected share with <code>net use * /delete</code>.</p> <p>Something like thi...
<p>If you don't have multiple network shares connected simultaniously, you can make <code>net use *</code> assign a free drive letter for you. Afterwards you can use <code>robocopy</code> to access the share via its UNC path and release any connected share with <code>net use * /delete</code>.</p> <p>Something like thi...
7002, 10269
batch-file, network-drive
<h1>Mapping a network drive without hardcoding a drive letter in a batch file</h1> <p>I need to map a network drive with a batch file, but don't want to specify the drive letter.</p> <p>The batch file is used as part of a deployment process; I call the batch file from <code>CruiseControl.Net</code>, the batch file nee...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,453
cmd
# Mapping a network drive without hardcoding a drive letter in a batch file I need to map a network drive with a batch file, but don't want to specify the drive letter. The batch file is used as part of a deployment process; I call the batch file from `CruiseControl.Net`, the batch file needs to map a UNC path which ...
If you don't have multiple network shares connected simultaniously, you can make `net use *` assign a free drive letter for you. Afterwards you can use `robocopy` to access the share via its UNC path and release any connected share with `net use * /delete`. Something like this: ``` @echo off net use * \\192.168.0.1\S...
3835518
Can a script.bat make changes to Windows PATH Environment Variable
17
2010-09-30 23:28:31
<p>I'm trying to write a script that when clicked will add a couple of entries to the PATH Environment variable in Windows, instead of making the changes manually. I see .bat files being used all the time on Windows for a variety of reasons, so can a .bat script help me with something like that? </p> <p>I actually nee...
42,570
407,723
2022-02-10 20:24:44
3,835,539
38
2010-09-30 23:33:09
441,149
2013-08-31 20:53:40
https://stackoverflow.com/q/3835518
https://stackoverflow.com/a/3835539
<p>If you wish to change/update the PATH permanently in the environment variable, you can use the SETX command e.g.</p> <pre><code>setx path "%PATH%;C:\New Folder" </code></pre> <p>For more details information on %PATH% and other variables to access to system folder, refer to <a href="http://vlaurie.com/computers2/A...
<p>If you wish to change/update the PATH permanently in the environment variable, you can use the SETX command e.g.</p> <pre><code>setx path "%PATH%;C:\New Folder" </code></pre> <p>For more details information on %PATH% and other variables to access to system folder, refer to <a href="http://vlaurie.com/computers2/A...
64, 6268, 7002, 9013
batch-file, environment-variables, path, windows
<h1>Can a script.bat make changes to Windows PATH Environment Variable</h1> <p>I'm trying to write a script that when clicked will add a couple of entries to the PATH Environment variable in Windows, instead of making the changes manually. I see .bat files being used all the time on Windows for a variety of reasons, so...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,454
cmd
# Can a script.bat make changes to Windows PATH Environment Variable I'm trying to write a script that when clicked will add a couple of entries to the PATH Environment variable in Windows, instead of making the changes manually. I see .bat files being used all the time on Windows for a variety of reasons, so can a .b...
If you wish to change/update the PATH permanently in the environment variable, you can use the SETX command e.g. ``` setx path "%PATH%;C:\New Folder" ``` For more details information on %PATH% and other variables to access to system folder, refer to <http://vlaurie.com/computers2/Articles/environment.htm>
44870656
Heroku: http-error 410. Invalid response from API (I am not behind a proxy)
6
2017-07-02 12:08:05
<p>I am currently having some issues with heroku. I just installed it and tried to <code>heroku create</code>. It takes my credentials but so far i just get this</p> <pre><code> ! HTTP Error: https://api.heroku.com/login 410 Gone ! Invalid response from API. ! HTTP 410 ! {myMail myPw} ! ! Are you b...
5,351
5,766,143
2018-12-17 10:51:39
44,879,715
38
2017-07-03 07:13:13
4,974,793
2018-04-14 09:58:18
https://stackoverflow.com/q/44870656
https://stackoverflow.com/a/44879715
<p>I had the same problem today. When I type </p> <pre><code>heroku </code></pre> <p>in my Command Prompt, it promotes me to enter my email and after that my password. Then I got the same error message as you. After that instead "heroku" I typed</p> <pre><code>heroku login </code></pre> <p>I entered the same email ...
<p>I had the same problem today. When I type </p> <pre><code>heroku </code></pre> <p>in my Command Prompt, it promotes me to enter my email and after that my password. Then I got the same error message as you. After that instead "heroku" I typed</p> <pre><code>heroku login </code></pre> <p>I entered the same email ...
2631, 8279
cmd, heroku
<h1>Heroku: http-error 410. Invalid response from API (I am not behind a proxy)</h1> <p>I am currently having some issues with heroku. I just installed it and tried to <code>heroku create</code>. It takes my credentials but so far i just get this</p> <pre><code> ! HTTP Error: https://api.heroku.com/login 410 Gone ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,455
cmd
# Heroku: http-error 410. Invalid response from API (I am not behind a proxy) I am currently having some issues with heroku. I just installed it and tried to `heroku create`. It takes my credentials but so far i just get this ``` ! HTTP Error: https://api.heroku.com/login 410 Gone ! Invalid response from API....
I had the same problem today. When I type ``` heroku ``` in my Command Prompt, it promotes me to enter my email and after that my password. Then I got the same error message as you. After that instead "heroku" I typed ``` heroku login ``` I entered the same email and password and everything was fine.
11638705
Why does calling a nested batch file without prepending "call" to the line exit the parent batch file?
38
2012-07-24 20:21:18
<p>I understand how to call nested batch files from within a parent file using the <code>call</code> command, as there are plenty of resources on that:</p> <ul> <li><em><a href="http://www.robvanderwoude.com/call.php" rel="noreferrer">CALL</a></em></li> <li><em><a href="http://ss64.com/nt/call.html" rel="noreferrer">C...
26,863
1,381,755
2018-11-03 16:21:13
11,639,337
37
2012-07-24 21:08:58
1,370,425
2012-07-24 21:18:54
https://stackoverflow.com/q/11638705
https://stackoverflow.com/a/11639337
<p>DOS used simple text processing (back when you had things like <code>FILES=20</code> in config.sys to allow <em>20</em> file handles), so opened the file, read the next line, closed the file, then executed the line just read. If the file called another, then the processing continued with that file, so only 1 file ha...
<p>DOS used simple text processing (back when you had things like <code>FILES=20</code> in config.sys to allow <em>20</em> file handles), so opened the file, read the next line, closed the file, then executed the line just read. If the file called another, then the processing continued with that file, so only 1 file ha...
2631, 7002
batch-file, cmd
<h1>Why does calling a nested batch file without prepending "call" to the line exit the parent batch file?</h1> <p>I understand how to call nested batch files from within a parent file using the <code>call</code> command, as there are plenty of resources on that:</p> <ul> <li><em><a href="http://www.robvanderwoude.com...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,456
cmd
# Why does calling a nested batch file without prepending "call" to the line exit the parent batch file? I understand how to call nested batch files from within a parent file using the `call` command, as there are plenty of resources on that: - *[CALL](http://www.robvanderwoude.com/call.php)* - *[CALL](http://ss64.co...
DOS used simple text processing (back when you had things like `FILES=20` in config.sys to allow *20* file handles), so opened the file, read the next line, closed the file, then executed the line just read. If the file called another, then the processing continued with that file, so only 1 file handle would be require...
6728691
Batch File: Return to caller?
38
2011-07-18 04:40:13
<p>What is the equivalent of the <code>return</code> statement for a batch file subroutine?</p>
42,217
541,686
2012-06-10 16:16:17
6,728,702
37
2011-07-18 04:43:54
893
2011-07-18 04:43:54
https://stackoverflow.com/q/6728691
https://stackoverflow.com/a/6728702
<p>It is:</p> <pre><code>goto :eof </code></pre> <p>This is understandably unusual for somebody accustomed to normal programming languages.</p> <p>I found this info <a href="http://www.robvanderwoude.com/call.php" rel="noreferrer">here</a>.</p>
<p>It is:</p> <pre><code>goto :eof </code></pre> <p>This is understandably unusual for somebody accustomed to normal programming languages.</p> <p>I found this info <a href="http://www.robvanderwoude.com/call.php" rel="noreferrer">here</a>.</p>
64, 4705, 7002, 9206
batch-file, return, return-value, windows
<h1>Batch File: Return to caller?</h1> <p>What is the equivalent of the <code>return</code> statement for a batch file subroutine?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,457
cmd
# Batch File: Return to caller? What is the equivalent of the `return` statement for a batch file subroutine?
It is: ``` goto :eof ``` This is understandably unusual for somebody accustomed to normal programming languages. I found this info [here](http://www.robvanderwoude.com/call.php).
15206849
How to execute a hello world javascript file in node.js
37
2013-03-04 16:59:29
<p>I have <code>hello_world.js</code> file located on my computer at the following location -</p> <pre><code>C:\Users\Ankur\Downloads\NodeJS\working </code></pre> <p>It has the following code-</p> <pre><code>console.log("Hellow World"); </code></pre> <p>I was reading a beginners tutorial <a href="http://www.nodebeg...
97,113
1,827,375
2019-01-11 22:15:08
15,206,954
37
2013-03-04 17:04:48
1,353,011
2013-03-04 17:04:48
https://stackoverflow.com/q/15206849
https://stackoverflow.com/a/15206954
<p>Use <code>Node.js command prompt</code>, then type in <code>node C:\Users\Ankur\Downloads\NodeJS\working\hello_world.js</code></p>
<p>Use <code>Node.js command prompt</code>, then type in <code>node C:\Users\Ankur\Downloads\NodeJS\working\hello_world.js</code></p>
3, 2631, 46426
cmd, javascript, node.js
<h1>How to execute a hello world javascript file in node.js</h1> <p>I have <code>hello_world.js</code> file located on my computer at the following location -</p> <pre><code>C:\Users\Ankur\Downloads\NodeJS\working </code></pre> <p>It has the following code-</p> <pre><code>console.log("Hellow World"); </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,458
cmd
# How to execute a hello world javascript file in node.js I have `hello_world.js` file located on my computer at the following location - ``` C:\Users\Ankur\Downloads\NodeJS\working ``` It has the following code- ``` console.log("Hellow World"); ``` I was reading a beginners tutorial [here](http://www.nodebeginner...
Use `Node.js command prompt`, then type in `node C:\Users\Ankur\Downloads\NodeJS\working\hello_world.js`
8328338
How do you utilize more than 9 arguments when calling a label in a CMD batch-script?
34
2011-11-30 15:25:16
<p>I would like to know how to call more than 9 argument within a batch script when calling a label. For example, the following shows that I have 12 arguments assigned along with attempting to echo all of them.</p> <pre><code>CALL:LABEL "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twe...
35,520
781,339
2024-10-06 17:09:37
8,328,669
37
2011-11-30 15:44:18
897,024
2022-06-11 20:49:02
https://stackoverflow.com/q/8328338
https://stackoverflow.com/a/8328669
<p>Use the <a href="http://technet.microsoft.com/en-us/library/bb491002.aspx" rel="nofollow noreferrer"><code>shift</code> command</a> if you want to work with more than 9 parameters.<br /> (actually more than 10 parameters if you count the <code>%0</code> parameter)</p> <blockquote> <p>You can [...] use the shift comm...
<p>Use the <a href="http://technet.microsoft.com/en-us/library/bb491002.aspx" rel="nofollow noreferrer"><code>shift</code> command</a> if you want to work with more than 9 parameters.<br /> (actually more than 10 parameters if you count the <code>%0</code> parameter)</p> <blockquote> <p>You can [...] use the shift comm...
64, 7002, 31134
batch-file, command-line-arguments, windows
<h1>How do you utilize more than 9 arguments when calling a label in a CMD batch-script?</h1> <p>I would like to know how to call more than 9 argument within a batch script when calling a label. For example, the following shows that I have 12 arguments assigned along with attempting to echo all of them.</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,459
cmd
# How do you utilize more than 9 arguments when calling a label in a CMD batch-script? I would like to know how to call more than 9 argument within a batch script when calling a label. For example, the following shows that I have 12 arguments assigned along with attempting to echo all of them. ``` CALL:LABEL "one" "t...
Use the [`shift` command](http://technet.microsoft.com/en-us/library/bb491002.aspx) if you want to work with more than 9 parameters. (actually more than 10 parameters if you count the `%0` parameter) > You can [...] use the shift command to create a batch file that can accept more than 10 batch parameters. If you sp...
17412677
Batch File: ( was unexpected at this time
29
2013-07-01 20:00:31
<p>I am getting this error:</p> <blockquote> <p>( was unexpected at this time</p> </blockquote> <p>The error occurs after accepting the value of <code>a</code>. I tried and checked for null values that could cause such a problem,, but was unsuccessful.</p> <pre><code>echo off cls title ~USB Wizard~ echo What do yo...
206,061
2,540,289
2023-07-02 13:45:25
17,414,084
37
2013-07-01 21:33:12
891,976
2013-07-01 21:33:12
https://stackoverflow.com/q/17412677
https://stackoverflow.com/a/17414084
<p>You are getting that error because when the <code>param1</code> if statements are evaluated, param is always null due to being scoped variables without delayed expansion.</p> <p>When parentheses are used, all the commands and variables within those parentheses are expanded. And at that time, param1 has no value ma...
<p>You are getting that error because when the <code>param1</code> if statements are evaluated, param is always null due to being scoped variables without delayed expansion.</p> <p>When parentheses are used, all the commands and variables within those parentheses are expanded. And at that time, param1 has no value ma...
2631, 2773, 7002
batch-file, cmd, if-statement
<h1>Batch File: ( was unexpected at this time</h1> <p>I am getting this error:</p> <blockquote> <p>( was unexpected at this time</p> </blockquote> <p>The error occurs after accepting the value of <code>a</code>. I tried and checked for null values that could cause such a problem,, but was unsuccessful.</p> <pre><c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,460
cmd
# Batch File: ( was unexpected at this time I am getting this error: > ( was unexpected at this time The error occurs after accepting the value of `a`. I tried and checked for null values that could cause such a problem,, but was unsuccessful. ``` echo off cls title ~USB Wizard~ echo What do you want to do? echo 1....
You are getting that error because when the `param1` if statements are evaluated, param is always null due to being scoped variables without delayed expansion. When parentheses are used, all the commands and variables within those parentheses are expanded. And at that time, param1 has no value making the if statements...
22871544
Batch file to delete files with .bak extension
24
2014-04-04 19:31:25
<p>In batch, I want to delete all files *.bak in various folders on disk <code>c:\</code>.<br> Can anyone help me?</p> <p>ex.:</p> <pre><code>all c: del *.bak /s /a </code></pre> <p>Thank you.</p>
53,687
2,799,129
2020-10-08 17:11:23
22,875,507
37
2014-04-05 01:27:16
2,299,431
2014-04-05 01:27:16
https://stackoverflow.com/q/22871544
https://stackoverflow.com/a/22875507
<p>It can be a single command.</p> <pre><code>del /s /q /f c:\*.bak </code></pre>
<p>It can be a single command.</p> <pre><code>del /s /q /f c:\*.bak </code></pre>
7002, 37510
batch-file, delete-file
<h1>Batch file to delete files with .bak extension</h1> <p>In batch, I want to delete all files *.bak in various folders on disk <code>c:\</code>.<br> Can anyone help me?</p> <p>ex.:</p> <pre><code>all c: del *.bak /s /a </code></pre> <p>Thank you.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,461
cmd
# Batch file to delete files with .bak extension In batch, I want to delete all files *.bak in various folders on disk `c:\`. Can anyone help me? ex.: ``` all c: del *.bak /s /a ``` Thank you.
It can be a single command. ``` del /s /q /f c:\*.bak ```
14306117
Rename files in multiple directories to the name of the directory
20
2013-01-13 17:25:19
<p>I have something like this:</p> <pre><code>v_1/file.txt v_2/file.txt v_3/file.txt ... </code></pre> <p>and I want to rename those files to something like this:</p> <pre><code>v_1.txt v_2.txt v_3.txt ... </code></pre> <p>in the same directory.</p> <p>I guess I can use <code>rename</code> but I can't figure out h...
31,271
1,071,236
2017-08-20 02:07:30
14,306,213
37
2013-01-13 17:35:08
680,982
2013-01-13 18:39:10
https://stackoverflow.com/q/14306117
https://stackoverflow.com/a/14306213
<p>The result can be achieved with a bash for loop and <code>mv</code>:</p> <pre><code>for subdir in *; do mv $subdir/file.txt $subdir.txt; done; </code></pre> <p>Note that the solution above will not work if the directory name contains spaces. Related <a href="https://unix.stackexchange.com/questions/9496/looping-th...
<p>The result can be achieved with a bash for loop and <code>mv</code>:</p> <pre><code>for subdir in *; do mv $subdir/file.txt $subdir.txt; done; </code></pre> <p>Note that the solution above will not work if the directory name contains spaces. Related <a href="https://unix.stackexchange.com/questions/9496/looping-th...
58, 4510, 13475
batch-rename, linux, rename
<h1>Rename files in multiple directories to the name of the directory</h1> <p>I have something like this:</p> <pre><code>v_1/file.txt v_2/file.txt v_3/file.txt ... </code></pre> <p>and I want to rename those files to something like this:</p> <pre><code>v_1.txt v_2.txt v_3.txt ... </code></pre> <p>in the same direct...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,462
cmd
# Rename files in multiple directories to the name of the directory I have something like this: ``` v_1/file.txt v_2/file.txt v_3/file.txt ... ``` and I want to rename those files to something like this: ``` v_1.txt v_2.txt v_3.txt ... ``` in the same directory. I guess I can use `rename` but I can't figure out h...
The result can be achieved with a bash for loop and `mv`: ``` for subdir in *; do mv $subdir/file.txt $subdir.txt; done; ``` Note that the solution above will not work if the directory name contains spaces. Related [link](https://unix.stackexchange.com/questions/9496/looping-through-files-with-spaces-in-the-names). ...
20841622
Error: "|" was unexpected at this time batch script
17
2013-12-30 14:35:48
<p>When I run this script, I receive </p> <blockquote> <p>| was unexpected at this time.</p> </blockquote> <p>This is code:</p> <pre><code>@ECHO Off REM Mapeo de unidad U, path de usuario net use u: \\server\usuarios\%username% pause REM ***** Description group **** for /f %%i in ('net user %username% /dom...
10,089
3,146,665
2021-07-29 08:31:43
20,841,821
37
2013-12-30 14:47:44
2,982,225
2013-12-30 14:55:40
https://stackoverflow.com/q/20841622
https://stackoverflow.com/a/20841821
<p>The condition inside the <code>for</code> must be parsed by the batch parser before it can pass it to the IN() clause as an executable command and since the pipe is a special character in DOS, you need to use escape character(^) before pipe to preserve it during the initial batch parsing, as shown below:</p> <pre><...
<p>The condition inside the <code>for</code> must be parsed by the batch parser before it can pass it to the IN() clause as an executable command and since the pipe is a special character in DOS, you need to use escape character(^) before pipe to preserve it during the initial batch parsing, as shown below:</p> <pre><...
2631, 7002
batch-file, cmd
<h1>Error: "|" was unexpected at this time batch script</h1> <p>When I run this script, I receive </p> <blockquote> <p>| was unexpected at this time.</p> </blockquote> <p>This is code:</p> <pre><code>@ECHO Off REM Mapeo de unidad U, path de usuario net use u: \\server\usuarios\%username% pause REM ***** Des...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,463
cmd
# Error: "|" was unexpected at this time batch script When I run this script, I receive > | was unexpected at this time. This is code: ``` @ECHO Off REM Mapeo de unidad U, path de usuario net use u: \\server\usuarios\%username% pause REM ***** Description group **** for /f %%i in ('net user %username% /doma...
The condition inside the `for` must be parsed by the batch parser before it can pass it to the IN() clause as an executable command and since the pipe is a special character in DOS, you need to use escape character(^) before pipe to preserve it during the initial batch parsing, as shown below: ``` for /f %%i in ('net ...
10149194
Something like a function/method in batch files?
104
2012-04-13 22:37:53
<p>is there anything that mimicks a method like one knows it from Java, C# etc.? I have 5 lines of commands in a batch file, those 5 lines are used at more than one place inside the batch file. I can't use a goto, because depending on the errorlevel created by those 5 lines I have different actions that follow. I tried...
146,274
298,288
2022-12-28 13:48:09
10,149,219
36
2012-04-13 22:42:22
366,904
2012-04-13 22:42:22
https://stackoverflow.com/q/10149194
https://stackoverflow.com/a/10149219
<p>Placing the reusable functions into a separate batch file would certainly work to simulate a function.</p> <p>The catch is that you have to use the <code>call</code> command in order to ensure that control returns to the caller after the second batch file finishes executing.</p> <pre><code>call 5lines.bat echo thi...
<p>Placing the reusable functions into a separate batch file would certainly work to simulate a function.</p> <p>The catch is that you have to use the <code>call</code> command in order to ensure that control returns to the caller after the second batch file finishes executing.</p> <pre><code>call 5lines.bat echo thi...
64, 1231, 7002
batch-file, command-line, windows
<h1>Something like a function/method in batch files?</h1> <p>is there anything that mimicks a method like one knows it from Java, C# etc.? I have 5 lines of commands in a batch file, those 5 lines are used at more than one place inside the batch file. I can't use a goto, because depending on the errorlevel created by t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,465
cmd
# Something like a function/method in batch files? is there anything that mimicks a method like one knows it from Java, C# etc.? I have 5 lines of commands in a batch file, those 5 lines are used at more than one place inside the batch file. I can't use a goto, because depending on the errorlevel created by those 5 li...
Placing the reusable functions into a separate batch file would certainly work to simulate a function. The catch is that you have to use the `call` command in order to ensure that control returns to the caller after the second batch file finishes executing. ``` call 5lines.bat echo this will now get called ```
9450120
openssl hangs and does not exit
92
2012-02-26 02:55:15
<p>I am trying to use openssl to get a certificate, and it seems to keep hanging. I have done a lot of research but not all of the available options seem to work on Windows.</p> <pre><code>openssl s_client -showcerts -connect google.com:443 &gt; cert.txt </code></pre> <p>I have tried this:</p> <pre><code>openssl s_c...
71,859
1,233,313
2024-05-06 18:59:52
9,471,788
36
2012-02-27 20:27:22
785,536
2012-02-27 20:27:22
https://stackoverflow.com/q/9450120
https://stackoverflow.com/a/9471788
<p>It looks like some OpenSSL distributions for Windows are expecting an additional keypress, independant of standard input. Quit.txt gets correctly piped into openssl's STDIN (the server receives QUIT command), but nothing happens until you press any key.</p> <p>This problem does not exist in <a href="http://www.cygw...
<p>It looks like some OpenSSL distributions for Windows are expecting an additional keypress, independant of standard input. Quit.txt gets correctly piped into openssl's STDIN (the server receives QUIT command), but nothing happens until you press any key.</p> <p>This problem does not exist in <a href="http://www.cygw...
1999, 2631, 23931
cmd, openssl, quit
<h1>openssl hangs and does not exit</h1> <p>I am trying to use openssl to get a certificate, and it seems to keep hanging. I have done a lot of research but not all of the available options seem to work on Windows.</p> <pre><code>openssl s_client -showcerts -connect google.com:443 &gt; cert.txt </code></pre> <p>I hav...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,466
cmd
# openssl hangs and does not exit I am trying to use openssl to get a certificate, and it seems to keep hanging. I have done a lot of research but not all of the available options seem to work on Windows. ``` openssl s_client -showcerts -connect google.com:443 > cert.txt ``` I have tried this: ``` openssl s_client ...
It looks like some OpenSSL distributions for Windows are expecting an additional keypress, independant of standard input. Quit.txt gets correctly piped into openssl's STDIN (the server receives QUIT command), but nothing happens until you press any key. This problem does not exist in [Cygwin's](http://www.cygwin.com/)...
9138172
Enable tcp\ip remote connections to sql server express already installed database with code or script(query)
42
2012-02-04 03:30:43
<p>I am deploying sql express with my application. I will like that database engine to accept remote connections. I know how to configure that manual by launching the sql server configuration manager, enabling tcp/ip connections, specifying the ports etc.. I am wondering if it will be possible to do the same thing from...
126,083
637,142
2017-05-20 07:26:08
9,202,530
36
2012-02-08 22:30:40
260,391
2013-11-22 15:06:40
https://stackoverflow.com/q/9138172
https://stackoverflow.com/a/9202530
<p>I tested below code with <a href="http://www.microsoft.com/en-gb/download/details.aspx?id=30438" rel="nofollow noreferrer">SQL Server 2008 R2 Express</a> and I believe we should have solution for all 6 steps you outlined. Let's take on them one-by-one:</p> <h2>1 - Enable TCP/IP</h2> <p>We can enable TCP/IP protoco...
<p>I tested below code with <a href="http://www.microsoft.com/en-gb/download/details.aspx?id=30438" rel="nofollow noreferrer">SQL Server 2008 R2 Express</a> and I believe we should have solution for all 6 steps you outlined. Let's take on them one-by-one:</p> <h2>1 - Enable TCP/IP</h2> <p>We can enable TCP/IP protoco...
725, 2631, 2783, 15713, 28528
cmd, configuration, database-connection, remote-connection, sql-server-express
<h1>Enable tcp\ip remote connections to sql server express already installed database with code or script(query)</h1> <p>I am deploying sql express with my application. I will like that database engine to accept remote connections. I know how to configure that manual by launching the sql server configuration manager, e...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,467
cmd
# Enable tcp\ip remote connections to sql server express already installed database with code or script(query) I am deploying sql express with my application. I will like that database engine to accept remote connections. I know how to configure that manual by launching the sql server configuration manager, enabling t...
I tested below code with [SQL Server 2008 R2 Express](http://www.microsoft.com/en-gb/download/details.aspx?id=30438) and I believe we should have solution for all 6 steps you outlined. Let's take on them one-by-one: ## 1 - Enable TCP/IP We can enable TCP/IP protocol with [WMI](http://msdn.microsoft.com/en-us/library/...
27901042
Create a batch file to run an .exe with an additional parameter
41
2015-01-12 11:34:31
<p>I need a batch file which will do the following:</p> <pre><code>1. Open CMD and navigate to a location C:/Users/...../program.exe 2. Run the program.exe with an additional command to point it to a config file: e.g. "program.exe C:/Users/..../configFile.bgi" </code></pre> <p>How can I do this? </p> <p>I tried this...
252,263
3,249,472
2018-06-25 15:14:26
27,901,081
36
2015-01-12 11:37:21
2,077,651
2015-01-12 11:42:21
https://stackoverflow.com/q/27901042
https://stackoverflow.com/a/27901081
<p>in batch file abc.bat</p> <pre><code>cd c:\user\ben_dchost\documents\ executible.exe -flag1 -flag2 -flag3 </code></pre> <p>I am assuming that your <code>executible.exe</code> is present in <code>c:\user\ben_dchost\documents\</code> I am also assuming that the parameters it takes are <code>-flag1</code> <code>-fl...
<p>in batch file abc.bat</p> <pre><code>cd c:\user\ben_dchost\documents\ executible.exe -flag1 -flag2 -flag3 </code></pre> <p>I am assuming that your <code>executible.exe</code> is present in <code>c:\user\ben_dchost\documents\</code> I am also assuming that the parameters it takes are <code>-flag1</code> <code>-fl...
2631, 7002
batch-file, cmd
<h1>Create a batch file to run an .exe with an additional parameter</h1> <p>I need a batch file which will do the following:</p> <pre><code>1. Open CMD and navigate to a location C:/Users/...../program.exe 2. Run the program.exe with an additional command to point it to a config file: e.g. "program.exe C:/Users/..../c...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,468
cmd
# Create a batch file to run an .exe with an additional parameter I need a batch file which will do the following: ``` 1. Open CMD and navigate to a location C:/Users/...../program.exe 2. Run the program.exe with an additional command to point it to a config file: e.g. "program.exe C:/Users/..../configFile.bgi" ``` ...
in batch file abc.bat ``` cd c:\user\ben_dchost\documents\ executible.exe -flag1 -flag2 -flag3 ``` I am assuming that your `executible.exe` is present in `c:\user\ben_dchost\documents\` I am also assuming that the parameters it takes are `-flag1` `-flag2` `-flag3` Edited: For the command you say you want to execute...
18881221
How to start a batch file minimized with task scheduler in Windows 8? - %comspec% method not working anymore after Windows 7
39
2013-09-18 19:57:07
<p>After Windows XP, I always use the trick below to start batch files minimized with Windows Task Manager.</p> <p>From <a href="http://www.pcreview.co.uk/forums/running-bat-files-minimized-scheduler-t2125918.html" rel="noreferrer">http://www.pcreview.co.uk/forums/running-bat-files-minimized-scheduler-t2125918.html</a...
75,229
2,792,969
2021-09-09 23:05:17
18,885,450
36
2013-09-19 02:42:54
2,299,431
2021-08-30 09:19:23
https://stackoverflow.com/q/18881221
https://stackoverflow.com/a/18885450
<p>The start command needs the leading <code>&quot;&quot;</code> quotes to disable the title feature. Try scheduling this:</p> <pre><code>%comspec% /c start &quot;&quot; /min &quot;C:\Scripts\Destination_inbound_ftp5.bat&quot; ^&amp; exit </code></pre>
<p>The start command needs the leading <code>&quot;&quot;</code> quotes to disable the title feature. Try scheduling this:</p> <pre><code>%comspec% /c start &quot;&quot; /min &quot;C:\Scripts\Destination_inbound_ftp5.bat&quot; ^&amp; exit </code></pre>
64, 2631, 7002
batch-file, cmd, windows
<h1>How to start a batch file minimized with task scheduler in Windows 8? - %comspec% method not working anymore after Windows 7</h1> <p>After Windows XP, I always use the trick below to start batch files minimized with Windows Task Manager.</p> <p>From <a href="http://www.pcreview.co.uk/forums/running-bat-files-minim...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,469
cmd
# How to start a batch file minimized with task scheduler in Windows 8? - %comspec% method not working anymore after Windows 7 After Windows XP, I always use the trick below to start batch files minimized with Windows Task Manager. From <http://www.pcreview.co.uk/forums/running-bat-files-minimized-scheduler-t2125918....
The start command needs the leading `""` quotes to disable the title feature. Try scheduling this: ``` %comspec% /c start "" /min "C:\Scripts\Destination_inbound_ftp5.bat" ^& exit ```
8219040
Windows copy command return codes?
35
2011-11-21 21:55:31
<p>I would like to test for the success/failure of a copy in a batch file, but I can't find any documentation on what if any errorlevel codes are returned. For example</p> <pre><code>copy x y if %errorlevel%. equ 1. ( echo Copy x y failed due to ... exit /B ) else ( if %errorlevel% equ 2. ( echo Copy ...
111,709
597,305
2023-10-25 07:45:55
8,219,166
36
2011-11-21 22:05:48
14,860
2019-10-19 12:12:42
https://stackoverflow.com/q/8219040
https://stackoverflow.com/a/8219166
<p>I'd opt for <code>xcopy</code> in this case since the error levels are documented (see <a href="http://technet.microsoft.com/en-us/library/bb491035.aspx" rel="nofollow noreferrer">xcopy documentation</a>, paraphrased below):</p> <pre><code>Exit code Description ========= =========== 0 Files were copied w...
<p>I'd opt for <code>xcopy</code> in this case since the error levels are documented (see <a href="http://technet.microsoft.com/en-us/library/bb491035.aspx" rel="nofollow noreferrer">xcopy documentation</a>, paraphrased below):</p> <pre><code>Exit code Description ========= =========== 0 Files were copied w...
64, 4330, 7002
batch-file, copy, windows
<h1>Windows copy command return codes?</h1> <p>I would like to test for the success/failure of a copy in a batch file, but I can't find any documentation on what if any errorlevel codes are returned. For example</p> <pre><code>copy x y if %errorlevel%. equ 1. ( echo Copy x y failed due to ... exit /B ) else (...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,470
cmd
# Windows copy command return codes? I would like to test for the success/failure of a copy in a batch file, but I can't find any documentation on what if any errorlevel codes are returned. For example ``` copy x y if %errorlevel%. equ 1. ( echo Copy x y failed due to ... exit /B ) else ( if %errorlevel% eq...
I'd opt for `xcopy` in this case since the error levels are documented (see [xcopy documentation](http://technet.microsoft.com/en-us/library/bb491035.aspx), paraphrased below): ``` Exit code Description ========= =========== 0 Files were copied without error. 1 No files were found to copy. 2 ...
14560866
Windows command to tell whether a .dll file is 32 bit or 64 bit?
32
2013-01-28 11:18:30
<p>I'm looking for a command in windows cmd to tell me if a certain dll file is 32 bit or 64 bit </p> <p>Is there something like this in windows ?</p>
40,291
1,466,060
2025-11-30 18:46:15
14,561,022
36
2013-01-28 11:27:46
50,079
2013-01-28 11:27:46
https://stackoverflow.com/q/14560866
https://stackoverflow.com/a/14561022
<p><a href="http://support.microsoft.com/kb/177429"><code>DUMPBIN</code></a> is included with Visual C++ and can provide this information with the <code>/HEADERS</code> switch.</p> <p>Example output from a 32-bit image:</p> <pre><code>FILE HEADER VALUES 14C machine (i386) 6 number of sections 306F7A22 tim...
<p><a href="http://support.microsoft.com/kb/177429"><code>DUMPBIN</code></a> is included with Visual C++ and can provide this information with the <code>/HEADERS</code> switch.</p> <p>Example output from a 32-bit image:</p> <pre><code>FILE HEADER VALUES 14C machine (i386) 6 number of sections 306F7A22 tim...
64, 457, 2631, 32643
32bit-64bit, cmd, dll, windows
<h1>Windows command to tell whether a .dll file is 32 bit or 64 bit?</h1> <p>I'm looking for a command in windows cmd to tell me if a certain dll file is 32 bit or 64 bit </p> <p>Is there something like this in windows ?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,471
cmd
# Windows command to tell whether a .dll file is 32 bit or 64 bit? I'm looking for a command in windows cmd to tell me if a certain dll file is 32 bit or 64 bit Is there something like this in windows ?
[`DUMPBIN`](http://support.microsoft.com/kb/177429) is included with Visual C++ and can provide this information with the `/HEADERS` switch. Example output from a 32-bit image: ``` FILE HEADER VALUES 14C machine (i386) 6 number of sections 306F7A22 time date stamp Sun Oct 01 22:35:30 1995 0 file po...
1200235
How to pass a quoted pipe character to cmd.exe?
28
2009-07-29 13:23:43
<p>I want to invoke:</p> <pre><code>"c:\(...)\devenv.com" foo.sln /build "Debug|Win32" </code></pre> <p>using cmd.exe. In my experience, cmd.exe either strips out the first pair of quotes (causing the executable to not be found) or the second pair of quotes (causing the pipe character to be misinterpreted). <strong>H...
27,233
14,731
2011-06-27 11:32:19
1,200,278
36
2009-07-29 13:29:28
73,070
2009-07-29 13:29:28
https://stackoverflow.com/q/1200235
https://stackoverflow.com/a/1200278
<p>You can either do it the way you are doing there, enclosing the string with the <code>|</code> in quotation marks.</p> <p>Or you can escape it with the <em>circumflex accent</em> <code>^</code>:</p> <pre><code>"c:\(...)\devenv.com" foo.sln /build Debug^|Win32 </code></pre> <p>As a side note: Why are you building ...
<p>You can either do it the way you are doing there, enclosing the string with the <code>|</code> in quotation marks.</p> <p>Or you can escape it with the <em>circumflex accent</em> <code>^</code>:</p> <pre><code>"c:\(...)\devenv.com" foo.sln /build Debug^|Win32 </code></pre> <p>As a side note: Why are you building ...
2631
cmd
<h1>How to pass a quoted pipe character to cmd.exe?</h1> <p>I want to invoke:</p> <pre><code>"c:\(...)\devenv.com" foo.sln /build "Debug|Win32" </code></pre> <p>using cmd.exe. In my experience, cmd.exe either strips out the first pair of quotes (causing the executable to not be found) or the second pair of quotes (ca...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,472
cmd
# How to pass a quoted pipe character to cmd.exe? I want to invoke: ``` "c:\(...)\devenv.com" foo.sln /build "Debug|Win32" ``` using cmd.exe. In my experience, cmd.exe either strips out the first pair of quotes (causing the executable to not be found) or the second pair of quotes (causing the pipe character to be mi...
You can either do it the way you are doing there, enclosing the string with the `|` in quotation marks. Or you can escape it with the *circumflex accent* `^`: ``` "c:\(...)\devenv.com" foo.sln /build Debug^|Win32 ``` As a side note: Why are you building this with DevEnv instead of MSBuild?
13399017
Redirect stdout and stderr from inside a batch file
24
2012-11-15 14:00:00
<p>Is there a way to redirect stdout and stderr for a batch file from inside it.</p> <p>I'm imagining something like</p> <pre><code>set STDOUT=stdout.log echo Some text a.exe b.exe c.exe </code></pre> <p>Where both <code>Some text</code>, and the output of <code>a.exe</code>, <code>b.exe</code> and <code>c.exe</code...
30,065
492,336
2012-11-15 16:10:34
13,400,446
36
2012-11-15 15:15:18
1,012,053
2012-11-15 16:10:34
https://stackoverflow.com/q/13399017
https://stackoverflow.com/a/13400446
<p>It is more efficient to redirect once for the entire collection of commands than it is to redirect (with append) each individual command. It takes time to intialize the redirection. It may not be noticable for a few redirected commands, but if done in a loop with many iterations, it can become quite significant.</p>...
<p>It is more efficient to redirect once for the entire collection of commands than it is to redirect (with append) each individual command. It takes time to intialize the redirection. It may not be noticable for a few redirected commands, but if done in a loop with many iterations, it can become quite significant.</p>...
4867, 7002, 19156
batch-file, stderr, stdout
<h1>Redirect stdout and stderr from inside a batch file</h1> <p>Is there a way to redirect stdout and stderr for a batch file from inside it.</p> <p>I'm imagining something like</p> <pre><code>set STDOUT=stdout.log echo Some text a.exe b.exe c.exe </code></pre> <p>Where both <code>Some text</code>, and the output of...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,473
cmd
# Redirect stdout and stderr from inside a batch file Is there a way to redirect stdout and stderr for a batch file from inside it. I'm imagining something like ``` set STDOUT=stdout.log echo Some text a.exe b.exe c.exe ``` Where both `Some text`, and the output of `a.exe`, `b.exe` and `c.exe` would go to `stdout.l...
It is more efficient to redirect once for the entire collection of commands than it is to redirect (with append) each individual command. It takes time to intialize the redirection. It may not be noticable for a few redirected commands, but if done in a loop with many iterations, it can become quite significant. One m...
1721258
Is it possible to put a new line character in an echo line in a batch file?
22
2009-11-12 10:18:02
<p>Is it possible to put a new line character in an echo line in a batch file?</p> <p>Basically I want to be able to do the equivalent of:</p> <pre><code>echo Hello\nWorld </code></pre> <p>You can do this easily enough in Linux, but I can't work out how to do it in Windows.</p>
105,738
193,128
2017-03-16 14:28:42
1,721,340
36
2009-11-12 10:34:53
200,942
2012-09-22 10:52:29
https://stackoverflow.com/q/1721258
https://stackoverflow.com/a/1721340
<p><code>echo.</code> prints an empty line.</p> <p>Example:</p> <pre><code>echo Hello echo. echo world </code></pre> <p>prints</p> <pre><code>Hello world </code></pre>
<p><code>echo.</code> prints an empty line.</p> <p>Example:</p> <pre><code>echo Hello echo. echo world </code></pre> <p>prints</p> <pre><code>Hello world </code></pre>
64, 7002
batch-file, windows
<h1>Is it possible to put a new line character in an echo line in a batch file?</h1> <p>Is it possible to put a new line character in an echo line in a batch file?</p> <p>Basically I want to be able to do the equivalent of:</p> <pre><code>echo Hello\nWorld </code></pre> <p>You can do this easily enough in Linux, but...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,474
cmd
# Is it possible to put a new line character in an echo line in a batch file? Is it possible to put a new line character in an echo line in a batch file? Basically I want to be able to do the equivalent of: ``` echo Hello\nWorld ``` You can do this easily enough in Linux, but I can't work out how to do it in Window...
`echo.` prints an empty line. Example: ``` echo Hello echo. echo world ``` prints ``` Hello world ```
20289814
BeanDefinitionParsingException: Configuration: The element [step2] is unreachable
20
2013-11-29 16:18:37
<p>I had spring batch job similar to this one:</p> <pre class="lang-xml prettyprint-override"><code>&lt;batch:job id="job"&gt; &lt;batch:step id="step1"&gt; ... &lt;/batch:step&gt; &lt;batch:step id="step2"&gt; ... &lt;/batch:step&gt; &lt;/batch:job&gt; </code></pre> <p>and when tried ...
8,608
384,674
2015-01-22 12:25:33
20,289,815
36
2013-11-29 16:18:37
384,674
2013-11-29 16:18:37
https://stackoverflow.com/q/20289814
https://stackoverflow.com/a/20289815
<p>The problem is that there is missing <code>next</code> attribute in step1:</p> <pre class="lang-xml prettyprint-override"><code>&lt;batch:step id="step1" next="step2"&gt; </code></pre>
<p>The problem is that there is missing <code>next</code> attribute in step1:</p> <pre class="lang-xml prettyprint-override"><code>&lt;batch:step id="step1" next="step2"&gt; </code></pre>
1211, 41895
spring, spring-batch
<h1>BeanDefinitionParsingException: Configuration: The element [step2] is unreachable</h1> <p>I had spring batch job similar to this one:</p> <pre class="lang-xml prettyprint-override"><code>&lt;batch:job id="job"&gt; &lt;batch:step id="step1"&gt; ... &lt;/batch:step&gt; &lt;batch:step id="step2"&g...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,475
cmd
# BeanDefinitionParsingException: Configuration: The element [step2] is unreachable I had spring batch job similar to this one: ``` <batch:job id="job"> <batch:step id="step1"> ... </batch:step> <batch:step id="step2"> ... </batch:step> </batch:job> ``` and when tried to execute the j...
The problem is that there is missing `next` attribute in step1: ``` <batch:step id="step1" next="step2"> ```
17113343
Redirect output of command in for loop of batch script
20
2013-06-14 16:38:18
<pre><code>... for /F %%F in ('dir /B %* 2&gt; nul') do ( ... </code></pre> <p>What I'm attempting to do here is discard the err output of the command (and loop over the stdout output). However, it complains:</p> <pre><code>2&gt; was unexpected at this time. </code></pre> <p>Is this some way to achieve this?</p>
13,782
179,895
2019-07-10 20:06:49
17,113,667
36
2013-06-14 16:59:53
2,093,352
2013-06-14 16:59:53
https://stackoverflow.com/q/17113343
https://stackoverflow.com/a/17113667
<p>in this case you need to escape the > like this</p> <pre><code>for /F %%F in ('dir /B %* 2^&gt; nul') do ( </code></pre>
<p>in this case you need to escape the > like this</p> <pre><code>for /F %%F in ('dir /B %* 2^&gt; nul') do ( </code></pre>
2531, 2631, 7002, 26698
batch-file, cmd, for-loop, io-redirection
<h1>Redirect output of command in for loop of batch script</h1> <pre><code>... for /F %%F in ('dir /B %* 2&gt; nul') do ( ... </code></pre> <p>What I'm attempting to do here is discard the err output of the command (and loop over the stdout output). However, it complains:</p> <pre><code>2&gt; was unexpected at this t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,476
cmd
# Redirect output of command in for loop of batch script ``` ... for /F %%F in ('dir /B %* 2> nul') do ( ... ``` What I'm attempting to do here is discard the err output of the command (and loop over the stdout output). However, it complains: ``` 2> was unexpected at this time. ``` Is this some way to achieve this?
in this case you need to escape the > like this ``` for /F %%F in ('dir /B %* 2^> nul') do ( ```
8481558
(Windows batch) Goto within if block behaves very strangely
20
2011-12-12 22:06:50
<p>If I take the following Windows batch code snippet and run it:</p> <pre><code>echo foo if 1 == 1 ( echo bar goto asdf :asdf echo baz ) else ( echo quux )</code></pre> <p>The output I would expect is:</p> <pre><code>foo bar baz</code></pre> <p>But instead I get:</p> <pre><code>foo bar baz quu...
15,328
14,463
2017-11-14 08:09:31
8,481,978
36
2011-12-12 22:43:43
1,012,053
2011-12-12 23:02:05
https://stackoverflow.com/q/8481558
https://stackoverflow.com/a/8481978
<p>The target of a CALL or GOTO should never be inside a block statement within parentheses. It can be done, but as you see, the results are probably not going to be what you want.</p> <p>The entire IF (...) ELSE (...) construct is parsed and loaded into memory before any of it is processed. In other-words, it is logi...
<p>The target of a CALL or GOTO should never be inside a block statement within parentheses. It can be done, but as you see, the results are probably not going to be what you want.</p> <p>The entire IF (...) ELSE (...) construct is parsed and loaded into memory before any of it is processed. In other-words, it is logi...
3996, 7002
batch-file, goto
<h1>(Windows batch) Goto within if block behaves very strangely</h1> <p>If I take the following Windows batch code snippet and run it:</p> <pre><code>echo foo if 1 == 1 ( echo bar goto asdf :asdf echo baz ) else ( echo quux )</code></pre> <p>The output I would expect is:</p> <pre><code>foo bar ba...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,477
cmd
# (Windows batch) Goto within if block behaves very strangely If I take the following Windows batch code snippet and run it: ``` echo foo if 1 == 1 ( echo bar goto asdf :asdf echo baz ) else ( echo quux ) ``` The output I would expect is: ``` foo bar baz ``` But instead I get: ``` foo bar baz ...
The target of a CALL or GOTO should never be inside a block statement within parentheses. It can be done, but as you see, the results are probably not going to be what you want. The entire IF (...) ELSE (...) construct is parsed and loaded into memory before any of it is processed. In other-words, it is logically trea...
26427522
How to connect to PostgreSQL through CLI?
19
2014-10-17 14:43:14
<p>I am trying to access postgresql through the command line. However, whenever it is time for me to enter my password, I get the following error: Fatal: password authentication failed for user RMehta. I am pretty sure the reason that password authentication fails is that the user for my database is postgres, and not R...
61,261
4,083,716
2021-02-10 06:18:40
26,427,864
36
2014-10-17 15:00:24
2,682,391
2014-10-17 15:00:24
https://stackoverflow.com/q/26427522
https://stackoverflow.com/a/26427864
<p>For Unix environnement the command line is</p> <pre><code>psql -U USERNAME -h localhost dbname </code></pre> <p>For a Windows environment, you may consider replacing "-" with "/"</p> <p>-U option able you to choose a user to connect with</p> <p>-h option able you to connect with the TCPIP protocol, you may consi...
<p>For Unix environnement the command line is</p> <pre><code>psql -U USERNAME -h localhost dbname </code></pre> <p>For a Windows environment, you may consider replacing "-" with "/"</p> <p>-U option able you to choose a user to connect with</p> <p>-h option able you to connect with the TCPIP protocol, you may consi...
256, 2631, 11225, 18449
cmd, command-line-interface, postgresql, runas
<h1>How to connect to PostgreSQL through CLI?</h1> <p>I am trying to access postgresql through the command line. However, whenever it is time for me to enter my password, I get the following error: Fatal: password authentication failed for user RMehta. I am pretty sure the reason that password authentication fails is t...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,478
cmd
# How to connect to PostgreSQL through CLI? I am trying to access postgresql through the command line. However, whenever it is time for me to enter my password, I get the following error: Fatal: password authentication failed for user RMehta. I am pretty sure the reason that password authentication fails is that the u...
For Unix environnement the command line is ``` psql -U USERNAME -h localhost dbname ``` For a Windows environment, you may consider replacing "-" with "/" -U option able you to choose a user to connect with -h option able you to connect with the TCPIP protocol, you may consider it useless for Windows
22455739
Spring Batch - A job instance already exists: JobInstanceAlreadyCompleteException
18
2014-03-17 13:32:25
<p>I wrote an easy scheduler included in my Spring Application. I run my local server and after few seconds, in class Importer, checker.start() is being invoked each 5 seconds as how I configured in config file.</p> <p>After that, this method invokes Job with JobLauncher and here I have got an error.</p> <blockquote> <...
51,266
1,021,970
2021-08-16 07:39:52
22,455,952
36
2014-03-17 13:42:14
2,696,260
2014-03-17 13:42:14
https://stackoverflow.com/q/22455739
https://stackoverflow.com/a/22455952
<p>With your current setup you will only be able to launch the job only once.</p> <pre><code> launcher.run(job, new JobParameters()); </code></pre> <p>The job is unique identified by its <code>id</code> together with the parameters. Currently there is no way to make a distinction based on the parameters. Instead o...
<p>With your current setup you will only be able to launch the job only once.</p> <pre><code> launcher.run(job, new JobParameters()); </code></pre> <p>The job is unique identified by its <code>id</code> together with the parameters. Currently there is no way to make a distinction based on the parameters. Instead o...
17, 1211, 30645
batch-processing, java, spring
<h1>Spring Batch - A job instance already exists: JobInstanceAlreadyCompleteException</h1> <p>I wrote an easy scheduler included in my Spring Application. I run my local server and after few seconds, in class Importer, checker.start() is being invoked each 5 seconds as how I configured in config file.</p> <p>After that...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,479
cmd
# Spring Batch - A job instance already exists: JobInstanceAlreadyCompleteException I wrote an easy scheduler included in my Spring Application. I run my local server and after few seconds, in class Importer, checker.start() is being invoked each 5 seconds as how I configured in config file. After that, this method i...
With your current setup you will only be able to launch the job only once. ``` launcher.run(job, new JobParameters()); ``` The job is unique identified by its `id` together with the parameters. Currently there is no way to make a distinction based on the parameters. Instead of adding `new JobParameters()` use the...
31685966
Search AWS CLI output and save to variable
17
2015-07-28 19:59:51
<p>I'm very new to batch files, but I'm trying to use one to automate some AWS CLI instance-creation.</p> <p>What I have is pretty simple so far -- I have a command in my <code>.bat</code> file that will run the <code>run-instances</code> command:</p> <pre><code>aws ec2 run-instances --dry-run --image-id %ami_id% --k...
31,064
1,424,638
2015-07-29 11:50:49
31,699,657
36
2015-07-29 11:50:49
174,777
2015-07-29 11:50:49
https://stackoverflow.com/q/31685966
https://stackoverflow.com/a/31699657
<p>The <a href="http://aws.amazon.com/cli/" rel="noreferrer">AWS Command-Line Interface (CLI)</a> has a <code>--query</code> parameter that can be used to specify the output fields. Combined with <code>--output text</code>, it can provide a list of Instance IDs.</p> <p>Here's a script, assuming that only one instance ...
<p>The <a href="http://aws.amazon.com/cli/" rel="noreferrer">AWS Command-Line Interface (CLI)</a> has a <code>--query</code> parameter that can be used to specify the output fields. Combined with <code>--output text</code>, it can provide a list of Instance IDs.</p> <p>Here's a script, assuming that only one instance ...
7002, 33388, 34595, 99166
amazon-web-services, aws-cli, batch-file, windows-7
<h1>Search AWS CLI output and save to variable</h1> <p>I'm very new to batch files, but I'm trying to use one to automate some AWS CLI instance-creation.</p> <p>What I have is pretty simple so far -- I have a command in my <code>.bat</code> file that will run the <code>run-instances</code> command:</p> <pre><code>aws...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,480
cmd
# Search AWS CLI output and save to variable I'm very new to batch files, but I'm trying to use one to automate some AWS CLI instance-creation. What I have is pretty simple so far -- I have a command in my `.bat` file that will run the `run-instances` command: ``` aws ec2 run-instances --dry-run --image-id %ami_id% ...
The [AWS Command-Line Interface (CLI)](http://aws.amazon.com/cli/) has a `--query` parameter that can be used to specify the output fields. Combined with `--output text`, it can provide a list of Instance IDs. Here's a script, assuming that only one instance is started per `run-instances` call (otherwise a loop would ...
11882993
Batch script to Get First Filename from a directory
17
2012-08-09 12:01:02
<p>My function needs the first filename from a particular directory to process some tests using the first file, on completing tests delete first file from directory<BR></p> <p>I tried as below <BR></p> <pre><code>FOR /R \\&lt;My Folder&gt; %F in (*.zip*) do echo ~nF &gt;%test_list% set /p firstline=%test_list% echo ...
35,934
1,587,348
2012-08-12 16:38:53
11,923,818
36
2012-08-12 16:29:27
1,593,004
2012-08-12 16:29:27
https://stackoverflow.com/q/11882993
https://stackoverflow.com/a/11923818
<p>An alternative is to use <code>goto</code> (breaks FOR loops) after you have your first file:</p> <pre><code>FOR %%F IN (%test_firmware_dir%\*.zip) DO ( set filename=%%F goto tests ) :tests echo "%filename%" </code></pre> <p>And it could run (a little bit) faster in some cases as it doesn't have to go through th...
<p>An alternative is to use <code>goto</code> (breaks FOR loops) after you have your first file:</p> <pre><code>FOR %%F IN (%test_firmware_dir%\*.zip) DO ( set filename=%%F goto tests ) :tests echo "%filename%" </code></pre> <p>And it could run (a little bit) faster in some cases as it doesn't have to go through th...
7002
batch-file
<h1>Batch script to Get First Filename from a directory</h1> <p>My function needs the first filename from a particular directory to process some tests using the first file, on completing tests delete first file from directory<BR></p> <p>I tried as below <BR></p> <pre><code>FOR /R \\&lt;My Folder&gt; %F in (*.zip*) do...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,481
cmd
# Batch script to Get First Filename from a directory My function needs the first filename from a particular directory to process some tests using the first file, on completing tests delete first file from directory I tried as below ``` FOR /R \\<My Folder> %F in (*.zip*) do echo ~nF >%test_list% set /p firstline=%...
An alternative is to use `goto` (breaks FOR loops) after you have your first file: ``` FOR %%F IN (%test_firmware_dir%\*.zip) DO ( set filename=%%F goto tests ) :tests echo "%filename%" ``` And it could run (a little bit) faster in some cases as it doesn't have to go through the whole directory.
17077964
Windows batch script to unzip files in a directory
11
2013-06-13 01:38:09
<p>I want to unzip all files in a certain directory and preserve the folder names when unzipped.</p> <p>The following batch script doesn't quite do the trick. It just throws a bunch of the files without putting them into a folder and doesn't even finish.</p> <p>What's wrong here?</p> <pre><code>for /F %%I IN ('dir /...
106,156
1,022,944
2023-11-16 11:54:27
17,082,572
36
2013-06-13 08:30:03
1,630,171
2013-06-13 08:30:03
https://stackoverflow.com/q/17077964
https://stackoverflow.com/a/17082572
<p>Try this:</p> <pre><code>for /R "C:\root\folder" %%I in ("*.zip") do ( "%ProgramFiles(x86)%\7-Zip\7z.exe" x -y -o"%%~dpI" "%%~fI" ) </code></pre> <p>or (if you want to extract the files into a folder named after the Zip-file):</p> <pre><code>for /R "C:\root\folder" %%I in ("*.zip") do ( "%ProgramFiles(x86)%\...
<p>Try this:</p> <pre><code>for /R "C:\root\folder" %%I in ("*.zip") do ( "%ProgramFiles(x86)%\7-Zip\7z.exe" x -y -o"%%~dpI" "%%~fI" ) </code></pre> <p>or (if you want to extract the files into a folder named after the Zip-file):</p> <pre><code>for /R "C:\root\folder" %%I in ("*.zip") do ( "%ProgramFiles(x86)%\...
64, 2631, 7002, 7597
batch-file, cmd, unzip, windows
<h1>Windows batch script to unzip files in a directory</h1> <p>I want to unzip all files in a certain directory and preserve the folder names when unzipped.</p> <p>The following batch script doesn't quite do the trick. It just throws a bunch of the files without putting them into a folder and doesn't even finish.</p> ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,482
cmd
# Windows batch script to unzip files in a directory I want to unzip all files in a certain directory and preserve the folder names when unzipped. The following batch script doesn't quite do the trick. It just throws a bunch of the files without putting them into a folder and doesn't even finish. What's wrong here? ...
Try this: ``` for /R "C:\root\folder" %%I in ("*.zip") do ( "%ProgramFiles(x86)%\7-Zip\7z.exe" x -y -o"%%~dpI" "%%~fI" ) ``` or (if you want to extract the files into a folder named after the Zip-file): ``` for /R "C:\root\folder" %%I in ("*.zip") do ( "%ProgramFiles(x86)%\7-Zip\7z.exe" x -y -o"%%~dpnI" "%%~fI"...
1707058
How to split a string by spaces in a Windows batch file?
81
2009-11-10 10:47:04
<p>Suppose I have a string "AAA BBB CCC DDD EEE FFF".</p> <p>How can I split the string and retrieve the nth substring, in a batch file?</p> <p>The equivalent in C# would be</p> <pre><code>"AAA BBB CCC DDD EEE FFF".Split()[n] </code></pre>
389,585
48,082
2022-03-21 02:29:16
1,707,108
35
2009-11-10 10:53:43
30,447
2022-03-21 02:29:16
https://stackoverflow.com/q/1707058
https://stackoverflow.com/a/1707108
<p>see <code>HELP FOR</code> and see the examples</p> <p>or quick try this</p> <pre><code> for /F %%a in (&quot;AAA BBB CCC DDD EEE FFF&quot;) do echo %%a </code></pre>
<p>see <code>HELP FOR</code> and see the examples</p> <p>or quick try this</p> <pre><code> for /F %%a in (&quot;AAA BBB CCC DDD EEE FFF&quot;) do echo %%a </code></pre>
64, 2193, 7002
batch-file, split, windows
<h1>How to split a string by spaces in a Windows batch file?</h1> <p>Suppose I have a string "AAA BBB CCC DDD EEE FFF".</p> <p>How can I split the string and retrieve the nth substring, in a batch file?</p> <p>The equivalent in C# would be</p> <pre><code>"AAA BBB CCC DDD EEE FFF".Split()[n] </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,483
cmd
# How to split a string by spaces in a Windows batch file? Suppose I have a string "AAA BBB CCC DDD EEE FFF". How can I split the string and retrieve the nth substring, in a batch file? The equivalent in C# would be ``` "AAA BBB CCC DDD EEE FFF".Split()[n] ```
see `HELP FOR` and see the examples or quick try this ``` for /F %%a in ("AAA BBB CCC DDD EEE FFF") do echo %%a ```
307198
Remove quotes from named environment variables in Windows scripts
59
2008-11-20 22:53:06
<p>I want to store a URL prefix in an Windows environment variable. The ampersands in the query string makes this troublesome though.</p> <p>For example: I have a URL prefix of <code>http://example.com?foo=1&amp;bar=</code> and want to create a full URL by providing a value for the <code>bar</code> parameter. I then w...
61,619
3,488
2015-09-07 17:15:59
307,231
35
2008-11-20 23:03:00
4,304
2008-11-20 23:03:00
https://stackoverflow.com/q/307198
https://stackoverflow.com/a/307231
<p>This is not a limitation of the environment variable, but rather the command shell.</p> <p>Enclose the entire assignment in quotes:</p> <pre><code>set "myvar=http://example.com?foo=1&amp;bar=" </code></pre> <p>Though if you try to echo this, it will complain as the shell will see a break in there.</p> <p>You can...
<p>This is not a limitation of the environment variable, but rather the command shell.</p> <p>Enclose the entire assignment in quotes:</p> <pre><code>set "myvar=http://example.com?foo=1&amp;bar=" </code></pre> <p>Though if you try to echo this, it will complain as the shell will see a break in there.</p> <p>You can...
64, 430, 531, 7002, 9013
batch-file, environment-variables, quotes, scripting, windows
<h1>Remove quotes from named environment variables in Windows scripts</h1> <p>I want to store a URL prefix in an Windows environment variable. The ampersands in the query string makes this troublesome though.</p> <p>For example: I have a URL prefix of <code>http://example.com?foo=1&amp;bar=</code> and want to create a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,484
cmd
# Remove quotes from named environment variables in Windows scripts I want to store a URL prefix in an Windows environment variable. The ampersands in the query string makes this troublesome though. For example: I have a URL prefix of `http://example.com?foo=1&bar=` and want to create a full URL by providing a value ...
This is not a limitation of the environment variable, but rather the command shell. Enclose the entire assignment in quotes: ``` set "myvar=http://example.com?foo=1&bar=" ``` Though if you try to echo this, it will complain as the shell will see a break in there. You can echo it by enclosing the var name in quotes:...
301442
How do I concatenate JavaScript files into one file?
40
2008-11-19 10:13:31
<p>I want to create a compiled JavaScript file for my website. For development I would prefer to keep the JavaScript in separate files and just as part of my automated scripts concatenate the files into one and run the compressor over it.</p> <p>My problem is that if I use the old DOS copy command it also puts in th...
47,572
24,459
2023-02-03 13:46:32
301,784
35
2008-11-19 12:44:45
38,912
2013-01-11 02:28:12
https://stackoverflow.com/q/301442
https://stackoverflow.com/a/301784
<p>I recommend using Apache Ant and YUI Compressor.</p> <p><a href="http://ant.apache.org/" rel="noreferrer">http://ant.apache.org/</a></p> <p><a href="http://yui.github.com/yuicompressor/" rel="noreferrer">http://yui.github.com/yuicompressor/</a></p> <p>Put something like this in the Ant build xml. It will create t...
<p>I recommend using Apache Ant and YUI Compressor.</p> <p><a href="http://ant.apache.org/" rel="noreferrer">http://ant.apache.org/</a></p> <p><a href="http://yui.github.com/yuicompressor/" rel="noreferrer">http://yui.github.com/yuicompressor/</a></p> <p>Put something like this in the Ant build xml. It will create t...
3, 76, 7002
batch-file, compression, javascript
<h1>How do I concatenate JavaScript files into one file?</h1> <p>I want to create a compiled JavaScript file for my website. For development I would prefer to keep the JavaScript in separate files and just as part of my automated scripts concatenate the files into one and run the compressor over it.</p> <p>My proble...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,486
cmd
# How do I concatenate JavaScript files into one file? I want to create a compiled JavaScript file for my website. For development I would prefer to keep the JavaScript in separate files and just as part of my automated scripts concatenate the files into one and run the compressor over it. My problem is that if I use...
I recommend using Apache Ant and YUI Compressor. <http://ant.apache.org/> <http://yui.github.com/yuicompressor/> Put something like this in the Ant build xml. It will create two files, application.js and application-min.js. ``` <target name="concatenate" description="Concatenate all js files"> <concat destfile=...
22278456
Enable and Disable Delayed Expansion, what does it do?
28
2014-03-09 04:38:38
<p>I've seen <code>SETLOCAL ENABLEDELAYEDEXPANSION</code> &amp; <code>SETLOCAL DISABLEDELAYEDEXPANSION</code> in many batch files but what do the commands actually do?</p>
65,360
2,582,990
2020-11-11 08:47:11
22,278,518
35
2014-03-09 04:48:08
2,128,947
2014-03-09 04:48:08
https://stackoverflow.com/q/22278456
https://stackoverflow.com/a/22278518
<p><code>enabledelayeexpansion</code> instructs <code>cmd</code> to recognise the syntax <code>!var!</code> which accesses the <code>current</code> value of <code>var</code>. <code>disabledelayedexpansion</code> turns this facility off, so <code>!var!</code> becomes simply that as a literal string.</p> <p>Within a blo...
<p><code>enabledelayeexpansion</code> instructs <code>cmd</code> to recognise the syntax <code>!var!</code> which accesses the <code>current</code> value of <code>var</code>. <code>disabledelayedexpansion</code> turns this facility off, so <code>!var!</code> becomes simply that as a literal string.</p> <p>Within a blo...
7002
batch-file
<h1>Enable and Disable Delayed Expansion, what does it do?</h1> <p>I've seen <code>SETLOCAL ENABLEDELAYEDEXPANSION</code> &amp; <code>SETLOCAL DISABLEDELAYEDEXPANSION</code> in many batch files but what do the commands actually do?</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,488
cmd
# Enable and Disable Delayed Expansion, what does it do? I've seen `SETLOCAL ENABLEDELAYEDEXPANSION` & `SETLOCAL DISABLEDELAYEDEXPANSION` in many batch files but what do the commands actually do?
`enabledelayeexpansion` instructs `cmd` to recognise the syntax `!var!` which accesses the `current` value of `var`. `disabledelayedexpansion` turns this facility off, so `!var!` becomes simply that as a literal string. Within a block statement `(a parenthesised series of statements)`, the **entire** block is parsed a...
34968009
Which cmd.exe internal commands clear the ERRORLEVEL to 0 upon success?
27
2016-01-23 19:46:13
<p>A frequent method to handling errors within Windows batch scripts is to use things like<br> <code>if errorlevel 1 ...</code> or <code>if %errorlevel% neq 0 ...</code>. Often times one wants the error handling code to preserve the ERRORLEVEL.</p> <p>I believe all external commands will always result in ERRORLEVEL be...
9,868
1,012,053
2021-01-29 08:03:19
34,968,021
35
2016-01-23 19:47:29
1,012,053
2016-01-24 14:52:14
https://stackoverflow.com/q/34968009
https://stackoverflow.com/a/34968021
<p><em>This answer is based on experiments I ran under Windows 10. I doubt there are differences with earlier Windows versions that use cmd.exe, but it is possible.</em></p> <p><em>Also note - This answer does not attempt to document the ERRORLEVEL result when an internal command encounters an error (except for a wee ...
<p><em>This answer is based on experiments I ran under Windows 10. I doubt there are differences with earlier Windows versions that use cmd.exe, but it is possible.</em></p> <p><em>Also note - This answer does not attempt to document the ERRORLEVEL result when an internal command encounters an error (except for a wee ...
2631, 7002, 17564
batch-file, cmd, errorlevel
<h1>Which cmd.exe internal commands clear the ERRORLEVEL to 0 upon success?</h1> <p>A frequent method to handling errors within Windows batch scripts is to use things like<br> <code>if errorlevel 1 ...</code> or <code>if %errorlevel% neq 0 ...</code>. Often times one wants the error handling code to preserve the ERRORL...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,489
cmd
# Which cmd.exe internal commands clear the ERRORLEVEL to 0 upon success? A frequent method to handling errors within Windows batch scripts is to use things like `if errorlevel 1 ...` or `if %errorlevel% neq 0 ...`. Often times one wants the error handling code to preserve the ERRORLEVEL. I believe all external com...
*This answer is based on experiments I ran under Windows 10. I doubt there are differences with earlier Windows versions that use cmd.exe, but it is possible.* *Also note - This answer does not attempt to document the ERRORLEVEL result when an internal command encounters an error (except for a wee bit concerning DEL a...
25343351
Single line with multiple commands using Windows batch file
23
2014-08-16 19:48:19
<p>I try to understand how multiple commands in a single command line in a batch file work.</p> <pre><code>dir &amp; md folder1 &amp; rename folder1 mainfolder </code></pre> <p>And other case with similar commands, but <code>&amp;</code> substituted with <code>&amp;&amp;</code>.</p> <pre><code>dir &amp;&amp; md fold...
36,862
3,894,818
2021-01-06 08:40:31
25,344,009
35
2014-08-16 21:09:32
3,074,564
2020-10-29 18:18:41
https://stackoverflow.com/q/25343351
https://stackoverflow.com/a/25344009
<p><code>&amp;</code> between two commands simply results in executing both commands independent on result of first command. The command right of <code>&amp;</code> is executed after command left of <code>&amp;</code> finished independent on success or error of the previous command, i.e. independent on exit / return va...
<p><code>&amp;</code> between two commands simply results in executing both commands independent on result of first command. The command right of <code>&amp;</code> is executed after command left of <code>&amp;</code> finished independent on success or error of the previous command, i.e. independent on exit / return va...
64, 1231, 2631, 7002, 10677
batch-file, cmd, command-line, simultaneous, windows
<h1>Single line with multiple commands using Windows batch file</h1> <p>I try to understand how multiple commands in a single command line in a batch file work.</p> <pre><code>dir &amp; md folder1 &amp; rename folder1 mainfolder </code></pre> <p>And other case with similar commands, but <code>&amp;</code> substituted...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,491
cmd
# Single line with multiple commands using Windows batch file I try to understand how multiple commands in a single command line in a batch file work. ``` dir & md folder1 & rename folder1 mainfolder ``` And other case with similar commands, but `&` substituted with `&&`. ``` dir && md folder1 && rename folder1 mai...
`&` between two commands simply results in executing both commands independent on result of first command. The command right of `&` is executed after command left of `&` finished independent on success or error of the previous command, i.e. independent on exit / return value of previous command. `&&` results in a cond...
27261547
Hide status output from jq in dos/windows
20
2014-12-03 00:26:06
<p>I'm using curl for windows (<a href="http://www.confusedbycode.com/curl/" rel="noreferrer">http://www.confusedbycode.com/curl/</a>) in conjunction with jq (<a href="http://stedolan.github.io/jq/" rel="noreferrer">http://stedolan.github.io/jq/</a>) to interact with a web api via a batch file. The seemingly simple pr...
16,275
136,785
2020-05-14 12:04:25
27,265,780
35
2014-12-03 07:15:04
1,002,260
2014-12-03 07:15:04
https://stackoverflow.com/q/27261547
https://stackoverflow.com/a/27265780
<pre><code>curl --silent </code></pre> <pre> -s, --silent Silent or quiet mode. Do not show progress meter or error messages. Makes Curl mute. </pre> <ul> <li><a href="http://github.com/svnpenn/a/blob/4e0992f8c1d6ed7571c0f27be1a/ff-song.sh#L100" rel="noreferrer">Example</a></li> <li><a href="http://explainshell.c...
<pre><code>curl --silent </code></pre> <pre> -s, --silent Silent or quiet mode. Do not show progress meter or error messages. Makes Curl mute. </pre> <ul> <li><a href="http://github.com/svnpenn/a/blob/4e0992f8c1d6ed7571c0f27be1a/ff-song.sh#L100" rel="noreferrer">Example</a></li> <li><a href="http://explainshell.c...
1508, 1554, 7002, 105170
batch-file, curl, jq, json
<h1>Hide status output from jq in dos/windows</h1> <p>I'm using curl for windows (<a href="http://www.confusedbycode.com/curl/" rel="noreferrer">http://www.confusedbycode.com/curl/</a>) in conjunction with jq (<a href="http://stedolan.github.io/jq/" rel="noreferrer">http://stedolan.github.io/jq/</a>) to interact with a...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,492
cmd
# Hide status output from jq in dos/windows I'm using curl for windows (<http://www.confusedbycode.com/curl/>) in conjunction with jq (<http://stedolan.github.io/jq/>) to interact with a web api via a batch file. The seemingly simple problem I'm having is that no matter what I do, I cannot seem to suppress JQ's "statu...
``` curl --silent ``` ``` -s, --silent Silent or quiet mode. Do not show progress meter or error messages. Makes Curl mute. ``` - [Example](http://github.com/svnpenn/a/blob/4e0992f8c1d6ed7571c0f27be1a/ff-song.sh#L100) - [explainshell.com - curl --silent](http://explainshell.com/explain?cmd=curl+--silent)
14742064
Python os.environ["HOME"] works on idle but not in a script
19
2013-02-07 01:29:57
<p>I am working on a simple Python (2.7.3) script, but I have to get the user's Home Folder. I tried:</p> <pre><code>import os home_folder = os.environ["HOME"] </code></pre> <p>And it works fine when I'm running this code on IDLE, but if I launch it from the cmd, it gives me: <code>«KeyError: 'HOME'»</code></p> <p>C...
19,704
2,049,075
2015-11-26 09:42:19
14,742,225
35
2013-02-07 01:48:58
1,512,690
2013-02-07 01:48:58
https://stackoverflow.com/q/14742064
https://stackoverflow.com/a/14742225
<p>Windows uses <code>USERPROFILE</code>, instead of <code>HOME</code>. Windows doesn't have <code>HOME</code> and other OSs don't have <code>USERPROFILE</code>, so using either of these drops platform independence.</p> <p>To keep platform independence, you can use <code>expanduser</code> from <code>os.path</code>, li...
<p>Windows uses <code>USERPROFILE</code>, instead of <code>HOME</code>. Windows doesn't have <code>HOME</code> and other OSs don't have <code>USERPROFILE</code>, so using either of these drops platform independence.</p> <p>To keep platform independence, you can use <code>expanduser</code> from <code>os.path</code>, li...
16, 2631, 59047
cmd, python, python-2.7
<h1>Python os.environ["HOME"] works on idle but not in a script</h1> <p>I am working on a simple Python (2.7.3) script, but I have to get the user's Home Folder. I tried:</p> <pre><code>import os home_folder = os.environ["HOME"] </code></pre> <p>And it works fine when I'm running this code on IDLE, but if I launch it...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,493
cmd
# Python os.environ["HOME"] works on idle but not in a script I am working on a simple Python (2.7.3) script, but I have to get the user's Home Folder. I tried: ``` import os home_folder = os.environ["HOME"] ``` And it works fine when I'm running this code on IDLE, but if I launch it from the cmd, it gives me: `«Key...
Windows uses `USERPROFILE`, instead of `HOME`. Windows doesn't have `HOME` and other OSs don't have `USERPROFILE`, so using either of these drops platform independence. To keep platform independence, you can use `expanduser` from `os.path`, like so: ``` import os.path home_folder = os.path.expanduser('~') ``` On a s...
9222106
How to extract information between two unique words in a large text file
18
2012-02-10 02:55:06
<p>I have about 150 text files filled with character information. Each file contains two unique words ()alpha and bravo and i want to extract the text between these unique words and write it to a different file. </p> <p>Manually i can CTRL+F for the two words and copy the text between, i just want to know how to do th...
42,743
963,031
2012-11-16 08:23:50
9,222,120
35
2012-02-10 02:58:00
776,084
2012-02-10 04:57:43
https://stackoverflow.com/q/9222106
https://stackoverflow.com/a/9222120
<p>You can use <a href="http://docs.python.org/library/re.html">regular expressions</a> for that.</p> <pre><code>&gt;&gt;&gt; st = "alpha here is my text bravo" &gt;&gt;&gt; import re &gt;&gt;&gt; re.findall(r'alpha(.*?)bravo',st) [' here is my text '] </code></pre> <p>My test.txt file</p> <pre><code>alpha here is m...
<p>You can use <a href="http://docs.python.org/library/re.html">regular expressions</a> for that.</p> <pre><code>&gt;&gt;&gt; st = "alpha here is my text bravo" &gt;&gt;&gt; import re &gt;&gt;&gt; re.findall(r'alpha(.*?)bravo',st) [' here is my text '] </code></pre> <p>My test.txt file</p> <pre><code>alpha here is m...
16, 816, 1357, 1469, 7002
batch-file, parsing, python, search, text
<h1>How to extract information between two unique words in a large text file</h1> <p>I have about 150 text files filled with character information. Each file contains two unique words ()alpha and bravo and i want to extract the text between these unique words and write it to a different file. </p> <p>Manually i can CT...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,494
cmd
# How to extract information between two unique words in a large text file I have about 150 text files filled with character information. Each file contains two unique words ()alpha and bravo and i want to extract the text between these unique words and write it to a different file. Manually i can CTRL+F for the two ...
You can use [regular expressions](http://docs.python.org/library/re.html) for that. ``` >>> st = "alpha here is my text bravo" >>> import re >>> re.findall(r'alpha(.*?)bravo',st) [' here is my text '] ``` My test.txt file ``` alpha here is my line yipee bravo ``` Now using [open](http://docs.python.org/tutorial/inp...
4031390
Executing cmd.exe commands from Java
18
2010-10-27 08:50:43
<p>I'm trying to read a file from the user, in which each line is a <code>cmd.exe</code> command, and run it (it's okay to assume the commands are legal), but when I give a command like <code>echo hi</code>, I get runtime exception error:</p> <blockquote> <p>Exception in thread "main" java.io.IOException: Cannot run...
15,922
166,067
2015-12-09 00:51:47
4,031,412
35
2010-10-27 08:53:21
14,860
2010-10-27 08:53:21
https://stackoverflow.com/q/4031390
https://stackoverflow.com/a/4031412
<p>That's because <code>echo</code> is not an external executable command (i.e., there is no <code>echo.exe</code> file on your hard disk, unless you put it there yourself). It's an internal command of the shell.</p> <p>You'll probably find that you need to execute something like:</p> <pre><code>cmd.exe /c echo hello...
<p>That's because <code>echo</code> is not an external executable command (i.e., there is no <code>echo.exe</code> file on your hard disk, unless you put it there yourself). It's an internal command of the shell.</p> <p>You'll probably find that you need to execute something like:</p> <pre><code>cmd.exe /c echo hello...
17, 64, 2631
cmd, java, windows
<h1>Executing cmd.exe commands from Java</h1> <p>I'm trying to read a file from the user, in which each line is a <code>cmd.exe</code> command, and run it (it's okay to assume the commands are legal), but when I give a command like <code>echo hi</code>, I get runtime exception error:</p> <blockquote> <p>Exception in...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,495
cmd
# Executing cmd.exe commands from Java I'm trying to read a file from the user, in which each line is a `cmd.exe` command, and run it (it's okay to assume the commands are legal), but when I give a command like `echo hi`, I get runtime exception error: > Exception in thread "main" java.io.IOException: Cannot run prog...
That's because `echo` is not an external executable command (i.e., there is no `echo.exe` file on your hard disk, unless you put it there yourself). It's an internal command of the shell. You'll probably find that you need to execute something like: ``` cmd.exe /c echo hello ```
36548690
Start Jenkins build using batch script
15
2016-04-11 12:26:48
<p>I am working with a Jenkins build server to run synthesis/simulation for FPGAs. Right now I have nightly builds and can start the build manually in Jenkins browser interface.</p> <p>My question is:</p> <p><strong>Is there any possibility to start a job build with a batch script without using browser interface?</st...
63,739
6,065,720
2023-02-15 07:51:59
36,548,802
35
2016-04-11 12:32:36
3,798,435
2016-04-11 13:26:58
https://stackoverflow.com/q/36548690
https://stackoverflow.com/a/36548802
<p>Here is an example with a curl command (for a job with parameters):</p> <pre><code>curl -X POST -u YOUR_USER:YOUR_USER_PASSWORD http://YOUR_JENKINS_URL/job/YOUR_JOB/buildWithParameters?PARAM1=value1&amp;PARAM2=value </code></pre> <p>And a job without parameters:</p> <pre><code>curl -X POST -u YOUR_USER:YOUR_USER_...
<p>Here is an example with a curl command (for a job with parameters):</p> <pre><code>curl -X POST -u YOUR_USER:YOUR_USER_PASSWORD http://YOUR_JENKINS_URL/job/YOUR_JOB/buildWithParameters?PARAM1=value1&amp;PARAM2=value </code></pre> <p>And a job without parameters:</p> <pre><code>curl -X POST -u YOUR_USER:YOUR_USER_...
1066, 7002, 64999
batch-file, continuous-integration, jenkins
<h1>Start Jenkins build using batch script</h1> <p>I am working with a Jenkins build server to run synthesis/simulation for FPGAs. Right now I have nightly builds and can start the build manually in Jenkins browser interface.</p> <p>My question is:</p> <p><strong>Is there any possibility to start a job build with a b...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,496
cmd
# Start Jenkins build using batch script I am working with a Jenkins build server to run synthesis/simulation for FPGAs. Right now I have nightly builds and can start the build manually in Jenkins browser interface. My question is: **Is there any possibility to start a job build with a batch script without using bro...
Here is an example with a curl command (for a job with parameters): ``` curl -X POST -u YOUR_USER:YOUR_USER_PASSWORD http://YOUR_JENKINS_URL/job/YOUR_JOB/buildWithParameters?PARAM1=value1&PARAM2=value ``` And a job without parameters: ``` curl -X POST -u YOUR_USER:YOUR_USER_PASSWORD http://YOUR_JENKINS_URL/job/YOUR_...
9116365
Windows batch file IF failure - How can 30000000000000 equal 40000000000?
13
2012-02-02 16:52:40
<p>IF gives the wrong answer when I try to compare 2 large numbers.</p> <p>For example, this simple batch file</p> <pre><code>@echo off setlocal set n1=30000000000000 set n2=40000000000 if %n1% gtr %n2% echo %n1% is greater than %n2% if %n1% lss %n2% echo %n1% is less than %n2% if %n1% equ %n2% echo %n1% is equal to ...
19,177
1,012,053
2017-05-24 13:17:21
9,116,378
35
2012-02-02 16:53:31
1,012,053
2017-05-24 13:17:21
https://stackoverflow.com/q/9116365
https://stackoverflow.com/a/9116378
<p>If both sides of an IF comparison are composed strictly of decimal digits, then IF will interpret both sides as numbers. This is what enables IF to correctly determine that 10 is greater than 9. If you have any non digit characters, then IF does a string comparison. For example, "10" is less than "9" because the quo...
<p>If both sides of an IF comparison are composed strictly of decimal digits, then IF will interpret both sides as numbers. This is what enables IF to correctly determine that 10 is greater than 9. If you have any non digit characters, then IF does a string comparison. For example, "10" is less than "9" because the quo...
2773, 7002
batch-file, if-statement
<h1>Windows batch file IF failure - How can 30000000000000 equal 40000000000?</h1> <p>IF gives the wrong answer when I try to compare 2 large numbers.</p> <p>For example, this simple batch file</p> <pre><code>@echo off setlocal set n1=30000000000000 set n2=40000000000 if %n1% gtr %n2% echo %n1% is greater than %n2% i...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,497
cmd
# Windows batch file IF failure - How can 30000000000000 equal 40000000000? IF gives the wrong answer when I try to compare 2 large numbers. For example, this simple batch file ``` @echo off setlocal set n1=30000000000000 set n2=40000000000 if %n1% gtr %n2% echo %n1% is greater than %n2% if %n1% lss %n2% echo %n1% i...
If both sides of an IF comparison are composed strictly of decimal digits, then IF will interpret both sides as numbers. This is what enables IF to correctly determine that 10 is greater than 9. If you have any non digit characters, then IF does a string comparison. For example, "10" is less than "9" because the quotes...
19103570
Run batch file from Java code
10
2013-09-30 20:50:01
<p>I am trying to run a batch file that is in another directory from my Java executable. I have the following code :</p> <pre><code> try { Process p = Runtime.getRuntime().exec("cmd /c start \"C:\\Program Files\\salesforce.com\\Data Loader\\cliq_process\\upsert\\upsert.bat\"") ; } catch (IOE...
119,562
2,275,432
2019-09-13 07:44:13
19,103,715
35
2013-09-30 20:58:41
44,737
2017-07-23 22:20:25
https://stackoverflow.com/q/19103570
https://stackoverflow.com/a/19103715
<p>Rather than <code>Runtime.exec(String command)</code>, you need to use the <code>exec(String command, String[] envp, File dir)</code> method signature:</p> <pre><code>Process p = Runtime.getRuntime().exec("cmd /c upsert.bat", null, new File("C:\\Program Files\\salesforce.com\\Data Loader\\cliq_process\\upsert")); ...
<p>Rather than <code>Runtime.exec(String command)</code>, you need to use the <code>exec(String command, String[] envp, File dir)</code> method signature:</p> <pre><code>Process p = Runtime.getRuntime().exec("cmd /c upsert.bat", null, new File("C:\\Program Files\\salesforce.com\\Data Loader\\cliq_process\\upsert")); ...
17, 7002
batch-file, java
<h1>Run batch file from Java code</h1> <p>I am trying to run a batch file that is in another directory from my Java executable. I have the following code :</p> <pre><code> try { Process p = Runtime.getRuntime().exec("cmd /c start \"C:\\Program Files\\salesforce.com\\Data Loader\\cliq_process\\upsert\\upser...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,498
cmd
# Run batch file from Java code I am trying to run a batch file that is in another directory from my Java executable. I have the following code : ``` try { Process p = Runtime.getRuntime().exec("cmd /c start \"C:\\Program Files\\salesforce.com\\Data Loader\\cliq_process\\upsert\\upsert.bat\"") ; ...
Rather than `Runtime.exec(String command)`, you need to use the `exec(String command, String[] envp, File dir)` method signature: ``` Process p = Runtime.getRuntime().exec("cmd /c upsert.bat", null, new File("C:\\Program Files\\salesforce.com\\Data Loader\\cliq_process\\upsert")); ``` But personally, I'd use `Proces...
7760545
Escape double quotes in parameter
179
2011-10-13 21:17:22
<p>In Unix I could run <code>myscript '"test"'</code> and I would get <code>"test"</code>.</p> <p>In Windows <code>cmd</code> I get <code>'test'</code>.</p> <p>How can I pass double-quotes as a parameter? I would like to know how to do this manually from a <code>cmd</code> window so I don't have to write a program to...
272,686
463,304
2025-06-02 14:15:06
7,760,618
34
2011-10-13 21:26:07
653,295
2011-10-13 21:26:07
https://stackoverflow.com/q/7760545
https://stackoverflow.com/a/7760618
<p>I cannot quickly reproduce the symptoms: if I try <code>myscript '"test"'</code> with a batch file <code>myscript.bat</code> containing just <code>@echo.%1</code> or even <code>@echo.%~1</code>, I get all quotes: <code>'"test"'</code></p> <p>Perhaps you can try the escape character <code>^</code> like this: <code>m...
<p>I cannot quickly reproduce the symptoms: if I try <code>myscript '"test"'</code> with a batch file <code>myscript.bat</code> containing just <code>@echo.%1</code> or even <code>@echo.%~1</code>, I get all quotes: <code>'"test"'</code></p> <p>Perhaps you can try the escape character <code>^</code> like this: <code>m...
64, 2631
cmd, windows
<h1>Escape double quotes in parameter</h1> <p>In Unix I could run <code>myscript '"test"'</code> and I would get <code>"test"</code>.</p> <p>In Windows <code>cmd</code> I get <code>'test'</code>.</p> <p>How can I pass double-quotes as a parameter? I would like to know how to do this manually from a <code>cmd</code> w...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,499
cmd
# Escape double quotes in parameter In Unix I could run `myscript '"test"'` and I would get `"test"`. In Windows `cmd` I get `'test'`. How can I pass double-quotes as a parameter? I would like to know how to do this manually from a `cmd` window so I don't have to write a program to test my program.
I cannot quickly reproduce the symptoms: if I try `myscript '"test"'` with a batch file `myscript.bat` containing just `@echo.%1` or even `@echo.%~1`, I get all quotes: `'"test"'` Perhaps you can try the escape character `^` like this: `myscript '^"test^"'`?
6679907
How do SETLOCAL and ENABLEDELAYEDEXPANSION work?
82
2011-07-13 13:44:18
<p>I notice in most scripts, the two are usually in the same line as so:</p> <pre><code>SETLOCAL ENABLEDELAYEDEXPANSION </code></pre> <p>Are the two in fact separate commands and can be written on separate lines?</p> <p>Will setting <code>ENABLEDELAYEDEXPANSION</code> have an adverse effect on a script if it is set ...
171,494
781,339
2024-12-13 16:31:10
6,680,005
34
2011-07-13 13:50:01
246,342
2017-06-03 13:01:40
https://stackoverflow.com/q/6679907
https://stackoverflow.com/a/6680005
<p><code>ENABLEDELAYEDEXPANSION</code> is a parameter passed to the <code>SETLOCAL</code> command (look at <code>setlocal /?</code>)</p> <p>Its effect lives for the duration of the script, or an <code>ENDLOCAL</code>:</p> <blockquote> <p>When the end of a batch script is reached, an implied <code>ENDLOCAL</code> is...
<p><code>ENABLEDELAYEDEXPANSION</code> is a parameter passed to the <code>SETLOCAL</code> command (look at <code>setlocal /?</code>)</p> <p>Its effect lives for the duration of the script, or an <code>ENDLOCAL</code>:</p> <blockquote> <p>When the end of a batch script is reached, an implied <code>ENDLOCAL</code> is...
2631, 7002, 19675, 19749
batch-file, cmd, delayedvariableexpansion, variable-expansion
<h1>How do SETLOCAL and ENABLEDELAYEDEXPANSION work?</h1> <p>I notice in most scripts, the two are usually in the same line as so:</p> <pre><code>SETLOCAL ENABLEDELAYEDEXPANSION </code></pre> <p>Are the two in fact separate commands and can be written on separate lines?</p> <p>Will setting <code>ENABLEDELAYEDEXPANSI...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,500
cmd
# How do SETLOCAL and ENABLEDELAYEDEXPANSION work? I notice in most scripts, the two are usually in the same line as so: ``` SETLOCAL ENABLEDELAYEDEXPANSION ``` Are the two in fact separate commands and can be written on separate lines? Will setting `ENABLEDELAYEDEXPANSION` have an adverse effect on a script if it ...
`ENABLEDELAYEDEXPANSION` is a parameter passed to the `SETLOCAL` command (look at `setlocal /?`) Its effect lives for the duration of the script, or an `ENDLOCAL`: > When the end of a batch script is reached, an implied `ENDLOCAL` is > executed for any outstanding `SETLOCAL` commands issued by that batch > script. I...
42521005
How the number of parameters associated with BatchNormalization layer is 2048?
33
2017-03-01 00:09:45
<p>I have the following code.</p> <pre><code>x = keras.layers.Input(batch_shape = (None, 4096)) hidden = keras.layers.Dense(512, activation = 'relu')(x) hidden = keras.layers.BatchNormalization()(hidden) hidden = keras.layers.Dropout(0.5)(hidden) predictions = keras.layers.Dense(80, activation = 'sigmoid')(hidden) mlp...
23,842
5,352,399
2022-12-01 21:09:09
42,524,528
34
2017-03-01 06:15:52
7,137,636
2022-12-01 21:09:09
https://stackoverflow.com/q/42521005
https://stackoverflow.com/a/42524528
<p>The batch normalization in Keras implements <a href="https://proceedings.mlr.press/v37/ioffe15.html" rel="nofollow noreferrer">this paper</a>.</p> <p>As you can read there, in order to make the batch normalization work during training, they need to keep track of the distributions of each normalized dimensions. To do...
<p>The batch normalization in Keras implements <a href="https://proceedings.mlr.press/v37/ioffe15.html" rel="nofollow noreferrer">this paper</a>.</p> <p>As you can read there, in order to make the batch normalization work during training, they need to keep track of the distributions of each normalized dimensions. To do...
112144, 124994
batch-normalization, keras
<h1>How the number of parameters associated with BatchNormalization layer is 2048?</h1> <p>I have the following code.</p> <pre><code>x = keras.layers.Input(batch_shape = (None, 4096)) hidden = keras.layers.Dense(512, activation = 'relu')(x) hidden = keras.layers.BatchNormalization()(hidden) hidden = keras.layers.Dropo...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,501
cmd
# How the number of parameters associated with BatchNormalization layer is 2048? I have the following code. ``` x = keras.layers.Input(batch_shape = (None, 4096)) hidden = keras.layers.Dense(512, activation = 'relu')(x) hidden = keras.layers.BatchNormalization()(hidden) hidden = keras.layers.Dropout(0.5)(hidden) pred...
The batch normalization in Keras implements [this paper](https://proceedings.mlr.press/v37/ioffe15.html). As you can read there, in order to make the batch normalization work during training, they need to keep track of the distributions of each normalized dimensions. To do so, since you are in `mode=0`by default, they...
17240725
SETX doesn't append path to system path variable
32
2013-06-21 17:07:01
<p>I have tried below command to append some path to system path variable by batch-file :</p> <pre><code>setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin" </code></pre> <p>I have checked system variable path after running above batch-file, above path isn't in there.</p> <p><img src="https://i.sstatic.ne...
71,080
1,345,050
2022-06-01 14:59:59
17,247,259
34
2013-06-22 04:18:00
2,092,609
2013-06-22 04:18:00
https://stackoverflow.com/q/17240725
https://stackoverflow.com/a/17247259
<p>To piggy-back on @Endoro's answer (I lack the rep to comment):</p> <p>If you want to change the system-wide environment variables, you have to use <strong>/M</strong>, a la:</p> <pre><code>setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin" /M </code></pre> <p>setx.exe is picky about placement of the /...
<p>To piggy-back on @Endoro's answer (I lack the rep to comment):</p> <p>If you want to change the system-wide environment variables, you have to use <strong>/M</strong>, a la:</p> <pre><code>setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin" /M </code></pre> <p>setx.exe is picky about placement of the /...
64, 2631, 7002, 29230, 81145
batch-file, cmd, setx, system-variable, windows
<h1>SETX doesn't append path to system path variable</h1> <p>I have tried below command to append some path to system path variable by batch-file :</p> <pre><code>setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin" </code></pre> <p>I have checked system variable path after running above batch-file, above p...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,502
cmd
# SETX doesn't append path to system path variable I have tried below command to append some path to system path variable by batch-file : ``` setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin" ``` I have checked system variable path after running above batch-file, above path isn't in there. ![enter imag...
To piggy-back on @Endoro's answer (I lack the rep to comment): If you want to change the system-wide environment variables, you have to use **/M**, a la: ``` setx PATH "%PATH%;C:\Program Files\MySQL\MySQL Server 5.5\bin" /M ``` setx.exe is picky about placement of the /M, BTW. It needs to be at the end.
19913019
Batch : For what is percentage followed by asterisk used?
26
2013-11-11 18:13:11
<p>I have in a batch file this line :</p> <pre><code>Test.exe %* </code></pre> <p>I searched in google and I found this explaination :</p> <blockquote> <p>Some DOS versions use this sign coupled with a percent sign (%*) to represent all parameters on the command line in a batch file.</p> </blockquote> <p>But I st...
8,497
2,766,382
2019-09-26 20:53:00
19,913,062
34
2013-11-11 18:16:06
810,400
2013-11-11 18:16:06
https://stackoverflow.com/q/19913019
https://stackoverflow.com/a/19913062
<p>This is used to forward the parameters you passed in to the batch file to another application.</p> <p>For example if you call <code>batch.bat param1 param2 param3 param4</code> and inside your batch.bat file you have <code>Text.exe %*</code>, it will be equivalent as calling <code>Test.exe param1 param2 param3 para...
<p>This is used to forward the parameters you passed in to the batch file to another application.</p> <p>For example if you call <code>batch.bat param1 param2 param3 param4</code> and inside your batch.bat file you have <code>Text.exe %*</code>, it will be equivalent as calling <code>Test.exe param1 param2 param3 para...
5370, 7002
batch-file, dos
<h1>Batch : For what is percentage followed by asterisk used?</h1> <p>I have in a batch file this line :</p> <pre><code>Test.exe %* </code></pre> <p>I searched in google and I found this explaination :</p> <blockquote> <p>Some DOS versions use this sign coupled with a percent sign (%*) to represent all parameters ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,503
cmd
# Batch : For what is percentage followed by asterisk used? I have in a batch file this line : ``` Test.exe %* ``` I searched in google and I found this explaination : > Some DOS versions use this sign coupled with a percent sign (%*) to represent all parameters on the command line in a batch file. But I still don...
This is used to forward the parameters you passed in to the batch file to another application. For example if you call `batch.bat param1 param2 param3 param4` and inside your batch.bat file you have `Text.exe %*`, it will be equivalent as calling `Test.exe param1 param2 param3 param4`
11364147
Setting a windows batch file variable to the day of the week
25
2012-07-06 14:26:57
<p>I have a windows batch file that runs daily. Wish to log data into a file and want to rotate it (i.e. having at most the last 7 days worth of data).</p> <p>Looked into the commands <code>DATE</code> and <code>DELIMS</code> - Cannot figure out a solution.</p> <p>Is there a simple solution to create a file name that...
124,685
892,256
2022-04-30 16:38:01
11,367,625
34
2012-07-06 18:19:02
30,447
2016-03-30 13:44:42
https://stackoverflow.com/q/11364147
https://stackoverflow.com/a/11367625
<p><code>%DATE%</code> is not your friend. Because the <code>%DATE%</code> environment variable (and the <code>DATE</code> command) returns the current date using the Windows <em>short date format</em> that is fully and endlessly customizable. One user may configure the system to return 07/06/2012 while another might c...
<p><code>%DATE%</code> is not your friend. Because the <code>%DATE%</code> environment variable (and the <code>DATE</code> command) returns the current date using the Windows <em>short date format</em> that is fully and endlessly customizable. One user may configure the system to return 07/06/2012 while another might c...
64, 531, 7002
batch-file, scripting, windows
<h1>Setting a windows batch file variable to the day of the week</h1> <p>I have a windows batch file that runs daily. Wish to log data into a file and want to rotate it (i.e. having at most the last 7 days worth of data).</p> <p>Looked into the commands <code>DATE</code> and <code>DELIMS</code> - Cannot figure out a s...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,504
cmd
# Setting a windows batch file variable to the day of the week I have a windows batch file that runs daily. Wish to log data into a file and want to rotate it (i.e. having at most the last 7 days worth of data). Looked into the commands `DATE` and `DELIMS` - Cannot figure out a solution. Is there a simple solution t...
`%DATE%` is not your friend. Because the `%DATE%` environment variable (and the `DATE` command) returns the current date using the Windows *short date format* that is fully and endlessly customizable. One user may configure the system to return 07/06/2012 while another might choose Fri060712. Using `%DATE%` is a comple...
8938944
How to run Java application by .bat file
24
2012-01-20 09:06:24
<p>I need to run my Java Application through a .bat file.</p>
260,248
1,017,804
2023-03-17 07:46:12
8,938,982
34
2012-01-20 09:09:28
500,514
2012-01-20 09:09:28
https://stackoverflow.com/q/8938944
https://stackoverflow.com/a/8938982
<p>Simply create a .bat file with the following lines in it:</p> <pre><code>@ECHO OFF set CLASSPATH=. set CLASSPATH=%CLASSPATH%;path/to/needed/jars/my.jar %JAVA_HOME%\bin\java -Xms128m -Xmx384m -Xnoclassgc ro.my.class.MyClass </code></pre>
<p>Simply create a .bat file with the following lines in it:</p> <pre><code>@ECHO OFF set CLASSPATH=. set CLASSPATH=%CLASSPATH%;path/to/needed/jars/my.jar %JAVA_HOME%\bin\java -Xms128m -Xmx384m -Xnoclassgc ro.my.class.MyClass </code></pre>
17, 7002
batch-file, java
<h1>How to run Java application by .bat file</h1> <p>I need to run my Java Application through a .bat file.</p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,506
cmd
# How to run Java application by .bat file I need to run my Java Application through a .bat file.
Simply create a .bat file with the following lines in it: ``` @ECHO OFF set CLASSPATH=. set CLASSPATH=%CLASSPATH%;path/to/needed/jars/my.jar %JAVA_HOME%\bin\java -Xms128m -Xmx384m -Xnoclassgc ro.my.class.MyClass ```
22553588
Run batch scripts on a remote server (windows) from jenkins
23
2014-03-21 08:21:25
<p>I've got a continuous integration server (Jenkins ) which builds my code (checks for compilation errors) and runs tests and then deploys the files to a remote server (not a war file, but the actual file structure) I do this with a Jenkins plugin which allows me to transfer files via samba, it does this nightly.</p> ...
73,721
3,445,472
2022-03-10 02:11:38
22,572,706
34
2014-03-22 02:29:12
1,720,943
2015-01-07 18:53:36
https://stackoverflow.com/q/22553588
https://stackoverflow.com/a/22572706
<p>If Jenkins on Windows, remote on *nix, use <code>plink.exe</code> (which is essentially command line <code>PuTTy</code>)</p> <p>If Jenkins on Windows, remote on Window, use <a href="http://technet.microsoft.com/en-ca/sysinternals/bb897553.aspx"><strong><code>psexec.exe</code></strong></a></p> <p>If Jenkins on *nix...
<p>If Jenkins on Windows, remote on *nix, use <code>plink.exe</code> (which is essentially command line <code>PuTTy</code>)</p> <p>If Jenkins on Windows, remote on Window, use <a href="http://technet.microsoft.com/en-ca/sysinternals/bb897553.aspx"><strong><code>psexec.exe</code></strong></a></p> <p>If Jenkins on *nix...
64, 142, 190, 7002, 64999
ant, batch-file, deployment, jenkins, windows
<h1>Run batch scripts on a remote server (windows) from jenkins</h1> <p>I've got a continuous integration server (Jenkins ) which builds my code (checks for compilation errors) and runs tests and then deploys the files to a remote server (not a war file, but the actual file structure) I do this with a Jenkins plugin wh...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,507
cmd
# Run batch scripts on a remote server (windows) from jenkins I've got a continuous integration server (Jenkins ) which builds my code (checks for compilation errors) and runs tests and then deploys the files to a remote server (not a war file, but the actual file structure) I do this with a Jenkins plugin which allow...
If Jenkins on Windows, remote on *nix, use `plink.exe` (which is essentially command line `PuTTy`) If Jenkins on Windows, remote on Window, use [**`psexec.exe`**](http://technet.microsoft.com/en-ca/sysinternals/bb897553.aspx) If Jenkins on *nix, remote on *nix, use `ssh` If Jenkins on *nix, remote on Windows, (updat...
1706892
How do I retrieve the version of a file from a batch file on Windows Vista?
21
2009-11-10 10:13:54
<p>Binary files have a version embedded in them - easy to display in Windows Explorer. </p> <p><img src="https://i.sstatic.net/jayeE.png" alt="alt text"></p> <p>How can I retrieve that file version, from a batch file? </p>
56,794
48,082
2020-10-25 14:08:33
19,830,679
34
2013-11-07 08:02:35
388,389
2017-01-28 15:35:49
https://stackoverflow.com/q/1706892
https://stackoverflow.com/a/19830679
<p>and three ways without external tools</p> <p>1.<strong>WMIC</strong></p> <pre><code>WMIC DATAFILE WHERE name="C:\\install.exe" get Version /format:Textvaluelist </code></pre> <p>Pay attention to the double slashes of file name.</p> <p>Ready to use script:</p> <pre><code>@echo off :wmicVersion pathToBinary [vari...
<p>and three ways without external tools</p> <p>1.<strong>WMIC</strong></p> <pre><code>WMIC DATAFILE WHERE name="C:\\install.exe" get Version /format:Textvaluelist </code></pre> <p>Pay attention to the double slashes of file name.</p> <p>Ready to use script:</p> <pre><code>@echo off :wmicVersion pathToBinary [vari...
5792, 7002, 28223
batch-file, version, windows-vista
<h1>How do I retrieve the version of a file from a batch file on Windows Vista?</h1> <p>Binary files have a version embedded in them - easy to display in Windows Explorer. </p> <p><img src="https://i.sstatic.net/jayeE.png" alt="alt text"></p> <p>How can I retrieve that file version, from a batch file? </p>
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,508
cmd
# How do I retrieve the version of a file from a batch file on Windows Vista? Binary files have a version embedded in them - easy to display in Windows Explorer. ![alt text](https://i.sstatic.net/jayeE.png) How can I retrieve that file version, from a batch file?
and three ways without external tools 1.**WMIC** ``` WMIC DATAFILE WHERE name="C:\\install.exe" get Version /format:Textvaluelist ``` Pay attention to the double slashes of file name. Ready to use script: ``` @echo off :wmicVersion pathToBinary [variableToSaveTo] setlocal set "item=%~1" set "item=%item:\=\\%" fo...
11783144
why does a set of commands in batch tend to stop after running only some of the commands?
20
2012-08-02 17:57:12
<p>The objective of my batch file is to do "mvn clean install", copy some environment files somewhere, then start the localhost server.</p> <p>This is my batch file:</p> <pre><code>REM # change the following dirs accordingly set webapp_dir=C:\cygwin\home\git\new_trunk echo "moving to webapps project dir" cd %webapp_d...
5,774
802,281
2016-09-28 13:50:04
11,783,258
34
2012-08-02 18:04:47
334,849
2012-08-02 18:04:47
https://stackoverflow.com/q/11783144
https://stackoverflow.com/a/11783258
<p>Try changing <code>mvn clean install</code> to <code>call mvn clean install</code>. </p> <p>If <code>mvn</code> is another batch file, control won't get returned to your original batch file unless you explicitly call it with <code>call</code>.</p>
<p>Try changing <code>mvn clean install</code> to <code>call mvn clean install</code>. </p> <p>If <code>mvn</code> is another batch file, control won't get returned to your original batch file unless you explicitly call it with <code>call</code>.</p>
1231, 7002, 41127
batch-file, command-line, maven
<h1>why does a set of commands in batch tend to stop after running only some of the commands?</h1> <p>The objective of my batch file is to do "mvn clean install", copy some environment files somewhere, then start the localhost server.</p> <p>This is my batch file:</p> <pre><code>REM # change the following dirs accord...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,509
cmd
# why does a set of commands in batch tend to stop after running only some of the commands? The objective of my batch file is to do "mvn clean install", copy some environment files somewhere, then start the localhost server. This is my batch file: ``` REM # change the following dirs accordingly set webapp_dir=C:\cyg...
Try changing `mvn clean install` to `call mvn clean install`. If `mvn` is another batch file, control won't get returned to your original batch file unless you explicitly call it with `call`.
5491383
Find out whether an environment variable contains a substring
20
2011-03-30 19:38:21
<p>I need to find out if a certain environment variable (let's say Foo) contains a substring (let's say BAR) in a windows batch file. Is there any way to do this using only batch file commands and/or programs/commands installed by default with windows?</p> <p>For example:</p> <pre><code>set Foo=Some string;something...
43,981
175,796
2023-01-27 21:59:29
5,491,390
34
2011-03-30 19:39:40
73,070
2011-03-30 20:52:38
https://stackoverflow.com/q/5491383
https://stackoverflow.com/a/5491390
<p>Of course, just use good old findstr:</p> <pre><code>echo.%Foo%|findstr /C:"BAR" &gt;nul 2&gt;&amp;1 &amp;&amp; echo Found || echo Not found. </code></pre> <p>Instead of <code>echo</code>ing you can also branch elsewhere there, but I think if you need multiple statements based on that the following is easier:</p> ...
<p>Of course, just use good old findstr:</p> <pre><code>echo.%Foo%|findstr /C:"BAR" &gt;nul 2&gt;&amp;1 &amp;&amp; echo Found || echo Not found. </code></pre> <p>Instead of <code>echo</code>ing you can also branch elsewhere there, but I think if you need multiple statements based on that the following is easier:</p> ...
64, 7002
batch-file, windows
<h1>Find out whether an environment variable contains a substring</h1> <p>I need to find out if a certain environment variable (let's say Foo) contains a substring (let's say BAR) in a windows batch file. Is there any way to do this using only batch file commands and/or programs/commands installed by default with wind...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,510
cmd
# Find out whether an environment variable contains a substring I need to find out if a certain environment variable (let's say Foo) contains a substring (let's say BAR) in a windows batch file. Is there any way to do this using only batch file commands and/or programs/commands installed by default with windows? For ...
Of course, just use good old findstr: ``` echo.%Foo%|findstr /C:"BAR" >nul 2>&1 && echo Found || echo Not found. ``` Instead of `echo`ing you can also branch elsewhere there, but I think if you need multiple statements based on that the following is easier: ``` echo.%Foo%|findstr /C:"BAR" >nul 2>&1 if not errorlevel...
13367746
Batch file that keeps the 7 latest files in a folder
19
2012-11-13 19:54:23
<p>Can anyone help me create a batch file? Basically, my goal is to create a batch file that will keep the LATEST 7 .txt files (in other words, the newest) in the folder and subsequently delete the rest. That's IF there are more than 7 files in the folder. </p> <p>The problem I'm having right now is the fact that the ...
21,281
1,821,881
2022-09-23 20:28:08
13,368,077
34
2012-11-13 20:17:34
1,012,053
2016-12-23 18:08:08
https://stackoverflow.com/q/13367746
https://stackoverflow.com/a/13368077
<p>You can use DIR with <code>/O-D</code> to list the text files in descending timestamp order. FOR /F allows you to iterate over each file. SET /A is used to keep track of how many files have been listed so far. Now comes the tricky part.</p> <p>Within a code block you normally need to use delayed expansion to work w...
<p>You can use DIR with <code>/O-D</code> to list the text files in descending timestamp order. FOR /F allows you to iterate over each file. SET /A is used to keep track of how many files have been listed so far. Now comes the tricky part.</p> <p>Within a code block you normally need to use delayed expansion to work w...
5310, 7002, 37510
batch-file, delete-file, file
<h1>Batch file that keeps the 7 latest files in a folder</h1> <p>Can anyone help me create a batch file? Basically, my goal is to create a batch file that will keep the LATEST 7 .txt files (in other words, the newest) in the folder and subsequently delete the rest. That's IF there are more than 7 files in the folder. <...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,511
cmd
# Batch file that keeps the 7 latest files in a folder Can anyone help me create a batch file? Basically, my goal is to create a batch file that will keep the LATEST 7 .txt files (in other words, the newest) in the folder and subsequently delete the rest. That's IF there are more than 7 files in the folder. The probl...
You can use DIR with `/O-D` to list the text files in descending timestamp order. FOR /F allows you to iterate over each file. SET /A is used to keep track of how many files have been listed so far. Now comes the tricky part. Within a code block you normally need to use delayed expansion to work with the value of a va...
55430330
SLURM: Changing the maximum number of simultaneously running tasks for a running array job
18
2019-03-30 10:06:17
<p>I have set of an array job as follows:</p> <pre><code>sbatch --array=1:100%5 ... </code></pre> <p>which will limit the number of simultaneously running tasks to 5. The job is now running, and I would like to change this number to 10 (i.e. I wish I'd run <code>sbatch --array=1:100%10 ...</code>).</p> <p>The <a hre...
10,447
2,550,114
2019-03-30 12:12:54
55,431,306
34
2019-03-30 12:12:54
2,471,963
2019-03-30 12:12:54
https://stackoverflow.com/q/55430330
https://stackoverflow.com/a/55431306
<p>You can change the array throttling limit with the following command:</p> <pre><code>scontrol update ArrayTaskThrottle=&lt;count&gt; JobId=&lt;jobID&gt; </code></pre>
<p>You can change the array throttling limit with the following command:</p> <pre><code>scontrol update ArrayTaskThrottle=&lt;count&gt; JobId=&lt;jobID&gt; </code></pre>
97759, 105553
sbatch, slurm
<h1>SLURM: Changing the maximum number of simultaneously running tasks for a running array job</h1> <p>I have set of an array job as follows:</p> <pre><code>sbatch --array=1:100%5 ... </code></pre> <p>which will limit the number of simultaneously running tasks to 5. The job is now running, and I would like to change ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,512
cmd
# SLURM: Changing the maximum number of simultaneously running tasks for a running array job I have set of an array job as follows: ``` sbatch --array=1:100%5 ... ``` which will limit the number of simultaneously running tasks to 5. The job is now running, and I would like to change this number to 10 (i.e. I wish I'...
You can change the array throttling limit with the following command: ``` scontrol update ArrayTaskThrottle=<count> JobId=<jobID> ```
39914398
7zip Fastest LZMA2 compression
18
2016-10-07 09:53:15
<p>How can I convert these settings into a command?</p> <p><img src="https://i.sstatic.net/FQska.jpg" alt="Screenshot of the options on archive creation"></p> <pre><code>Archiv format:7z compression level: Fastest Compression method: LZMA2 Dictionary size: 64kb Word size: 32 Solid Block size: 8MB Number of CPU thread...
23,550
5,675,553
2025-07-28 01:12:51
39,931,605
34
2016-10-08 11:04:09
3,074,564
2025-07-28 01:12:51
https://stackoverflow.com/q/39914398
https://stackoverflow.com/a/39931605
<p>7-Zip comes with the help file <code>7-zip.chm</code> which can be opened with a double click. On help tab <strong>Contents</strong> there is the list item <strong>Command Line Version</strong>. The first help page to read for usage of 7-Zip from command line is <strong>Command Line Syntax</strong> displaying at top...
<p>7-Zip comes with the help file <code>7-zip.chm</code> which can be opened with a double click. On help tab <strong>Contents</strong> there is the list item <strong>Command Line Version</strong>. The first help page to read for usage of 7-Zip from command line is <strong>Command Line Syntax</strong> displaying at top...
76, 1231, 5680, 7002
7zip, batch-file, command-line, compression
<h1>7zip Fastest LZMA2 compression</h1> <p>How can I convert these settings into a command?</p> <p><img src="https://i.sstatic.net/FQska.jpg" alt="Screenshot of the options on archive creation"></p> <pre><code>Archiv format:7z compression level: Fastest Compression method: LZMA2 Dictionary size: 64kb Word size: 32 So...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,513
cmd
# 7zip Fastest LZMA2 compression How can I convert these settings into a command? ![Screenshot of the options on archive creation](https://i.sstatic.net/FQska.jpg) ``` Archiv format:7z compression level: Fastest Compression method: LZMA2 Dictionary size: 64kb Word size: 32 Solid Block size: 8MB Number of CPU threads...
7-Zip comes with the help file `7-zip.chm` which can be opened with a double click. On help tab **Contents** there is the list item **Command Line Version**. The first help page to read for usage of 7-Zip from command line is **Command Line Syntax** displaying at top > 7z <command> [<switch>...] <base_archive_name> [<...
16439039
Batch file for PuTTY/PSFTP file transfer automation
18
2013-05-08 11:06:15
<p>I have a batch file for moving file from my local PC to server through SFTP. I have PuTTY installed in my system and the batch file code follows.</p> <pre><code>cd C:\Program Files (x86)\PuTTY psftp open &lt;IP&gt; &lt;user&gt; &lt;PW&gt; cd /home/irisuser/iris/integration/dls_dlsblr_dlschnn_in_msg/in lcd d:\ put l...
130,213
1,651,046
2021-12-02 06:56:48
16,440,468
34
2013-05-08 12:16:47
850,848
2021-12-02 06:56:48
https://stackoverflow.com/q/16439039
https://stackoverflow.com/a/16440468
<p>You need to store the psftp script (lines from <code>open</code> to <code>bye</code>) into a separate file and pass that to <code>psftp</code> using <code>-b</code> switch:</p> <pre><code>cd &quot;C:\Program Files (x86)\PuTTY&quot; psftp -b &quot;C:\path\to\script\script.txt&quot; </code></pre> <p>Reference:<br /> <...
<p>You need to store the psftp script (lines from <code>open</code> to <code>bye</code>) into a separate file and pass that to <code>psftp</code> using <code>-b</code> switch:</p> <pre><code>cd &quot;C:\Program Files (x86)\PuTTY&quot; psftp -b &quot;C:\path\to\script\script.txt&quot; </code></pre> <p>Reference:<br /> <...
1290, 1768, 2631, 7002, 116868
batch-file, cmd, psftp, putty, sftp
<h1>Batch file for PuTTY/PSFTP file transfer automation</h1> <p>I have a batch file for moving file from my local PC to server through SFTP. I have PuTTY installed in my system and the batch file code follows.</p> <pre><code>cd C:\Program Files (x86)\PuTTY psftp open &lt;IP&gt; &lt;user&gt; &lt;PW&gt; cd /home/irisuse...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,514
cmd
# Batch file for PuTTY/PSFTP file transfer automation I have a batch file for moving file from my local PC to server through SFTP. I have PuTTY installed in my system and the batch file code follows. ``` cd C:\Program Files (x86)\PuTTY psftp open <IP> <user> <PW> cd /home/irisuser/iris/integration/dls_dlsblr_dlschnn_...
You need to store the psftp script (lines from `open` to `bye`) into a separate file and pass that to `psftp` using `-b` switch: ``` cd "C:\Program Files (x86)\PuTTY" psftp -b "C:\path\to\script\script.txt" ``` Reference: [https://the.earth.li/~sgtatham/putty/latest/htmldoc/Chapter6.html#psftp-option-b](https://the...
18606682
How can I open command line prompt from Sublime in windows7
16
2013-09-04 06:16:47
<p>I'v created a function in VIM named OpenCMD(), it used for open command line or terminal in VIM (And cd in the current file path)</p> <pre><code>func! OpenCMD() if has('win32') let com = '!cmd /c start cd '. expand('%:p:h') else let com = '!/usr/bin/gnome-terminal --working-directory=' . expa...
63,918
2,940,319
2021-07-31 13:47:38
18,656,619
34
2013-09-06 11:22:20
2,940,319
2013-09-06 11:22:20
https://stackoverflow.com/q/18606682
https://stackoverflow.com/a/18656619
<p>The answer about <a href="https://stackoverflow.com/questions/12103028/sublime-text-2-open-cmd-prompt-at-current-or-project-directory-windows">Sublime Text 2 - Open CMD prompt at current or project directory (Windows)</a> is nearly correct.</p> <p>Only one step (for me) has to be changed is the file name should be ...
<p>The answer about <a href="https://stackoverflow.com/questions/12103028/sublime-text-2-open-cmd-prompt-at-current-or-project-directory-windows">Sublime Text 2 - Open CMD prompt at current or project directory (Windows)</a> is nearly correct.</p> <p>Only one step (for me) has to be changed is the file name should be ...
64, 2631, 88190
cmd, sublimetext3, windows
<h1>How can I open command line prompt from Sublime in windows7</h1> <p>I'v created a function in VIM named OpenCMD(), it used for open command line or terminal in VIM (And cd in the current file path)</p> <pre><code>func! OpenCMD() if has('win32') let com = '!cmd /c start cd '. expand('%:p:h') else ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,516
cmd
# How can I open command line prompt from Sublime in windows7 I'v created a function in VIM named OpenCMD(), it used for open command line or terminal in VIM (And cd in the current file path) ``` func! OpenCMD() if has('win32') let com = '!cmd /c start cd '. expand('%:p:h') else let com = '!/u...
The answer about [Sublime Text 2 - Open CMD prompt at current or project directory (Windows)](https://stackoverflow.com/questions/12103028/sublime-text-2-open-cmd-prompt-at-current-or-project-directory-windows) is nearly correct. Only one step (for me) has to be changed is the file name should be **uppercase**. Use `C...
12518242
Batch script for loop won't set variable
14
2012-09-20 18:02:37
<p>I have a batch script trying to execute out of anthill to get the folder names containing plsql to be compiled.</p> <pre><code>for /F %%a in ('dir /b D:\AHP_WorkDir\var\jobs\projects\rprt_test\rprt_test\plsql') do ( set FOLDER=%%a echo *** PROCESSING FOLDER %FOLDER% *** ) </code></pre> <p>This echos <strong>* ...
39,874
1,686,614
2012-09-20 18:09:03
12,518,366
34
2012-09-20 18:09:03
1,128,047
2012-09-20 18:09:03
https://stackoverflow.com/q/12518242
https://stackoverflow.com/a/12518366
<p><em>This is essentially a duplicate of a <a href="https://stackoverflow.com/questions/12513691/cmd-get-string-from-file-and-set-it-as-a-variable-to-use-in-cd">question asked earlier today</a>. Here's my answer from said question...</em></p> <p>You'll want to look at the <a href="http://ss64.com/nt/delayedexpansion....
<p><em>This is essentially a duplicate of a <a href="https://stackoverflow.com/questions/12513691/cmd-get-string-from-file-and-set-it-as-a-variable-to-use-in-cd">question asked earlier today</a>. Here's my answer from said question...</em></p> <p>You'll want to look at the <a href="http://ss64.com/nt/delayedexpansion....
2531, 7002, 59070
anthill, batch-file, for-loop
<h1>Batch script for loop won't set variable</h1> <p>I have a batch script trying to execute out of anthill to get the folder names containing plsql to be compiled.</p> <pre><code>for /F %%a in ('dir /b D:\AHP_WorkDir\var\jobs\projects\rprt_test\rprt_test\plsql') do ( set FOLDER=%%a echo *** PROCESSING FOLDER %FOL...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,517
cmd
# Batch script for loop won't set variable I have a batch script trying to execute out of anthill to get the folder names containing plsql to be compiled. ``` for /F %%a in ('dir /b D:\AHP_WorkDir\var\jobs\projects\rprt_test\rprt_test\plsql') do ( set FOLDER=%%a echo *** PROCESSING FOLDER %FOLDER% *** ) ``` This...
*This is essentially a duplicate of a [question asked earlier today](https://stackoverflow.com/questions/12513691/cmd-get-string-from-file-and-set-it-as-a-variable-to-use-in-cd). Here's my answer from said question...* You'll want to look at the [EnableDelayedExpansion](http://ss64.com/nt/delayedexpansion.html) option...
10868026
How can I use multiple conditions in "If" in batch file?
13
2012-06-03 05:02:00
<p>Can I specify multiple conditions with "or"/"and" in batch file <code>if</code> block?</p> <p>If not that complex, can I at least use something like:</p> <pre><code>if value1 &lt; value &lt; value2 </code></pre> <p>Basically my purpose is to check whether current system time falls in a certain interval(2.05 AM an...
95,709
1,269,049
2022-09-06 13:11:56
10,872,691
34
2012-06-03 18:14:16
1,336,150
2012-06-03 18:14:16
https://stackoverflow.com/q/10868026
https://stackoverflow.com/a/10872691
<p>Adding to dbenham's answer, you can emulate both logical operators (AND, OR) using a combination of <code>if</code> and <code>goto</code> statements.</p> <p>To test <em>condition1 AND codition2</em>:</p> <pre><code> if &lt;condition1&gt; if &lt;condition2&gt; goto ResultTrue :ResultFalse REM do something for a...
<p>Adding to dbenham's answer, you can emulate both logical operators (AND, OR) using a combination of <code>if</code> and <code>goto</code> statements.</p> <p>To test <em>condition1 AND codition2</em>:</p> <pre><code> if &lt;condition1&gt; if &lt;condition2&gt; goto ResultTrue :ResultFalse REM do something for a...
2773, 7002
batch-file, if-statement
<h1>How can I use multiple conditions in "If" in batch file?</h1> <p>Can I specify multiple conditions with "or"/"and" in batch file <code>if</code> block?</p> <p>If not that complex, can I at least use something like:</p> <pre><code>if value1 &lt; value &lt; value2 </code></pre> <p>Basically my purpose is to check ...
q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10
12,518
cmd
# How can I use multiple conditions in "If" in batch file? Can I specify multiple conditions with "or"/"and" in batch file `if` block? If not that complex, can I at least use something like: ``` if value1 < value < value2 ``` Basically my purpose is to check whether current system time falls in a certain interval(2...
Adding to dbenham's answer, you can emulate both logical operators (AND, OR) using a combination of `if` and `goto` statements. To test *condition1 AND codition2*: ``` if <condition1> if <condition2> goto ResultTrue :ResultFalse REM do something for a false result goto Done :ResultTrue REM do something for ...