Linked Questions
36 questions linked to/from Windows batch files: .bat vs .cmd?
12 votes
2 answers
49k views
What's the difference between *.bat and *.cmd file? [duplicate]
Possible Duplicate: Windows batch files: .bat vs .cmd? Hi, I am learning Windows Batch programming and come across this question: What's the difference between .bat and .cmd file? If they are ...
3 votes
1 answer
3k views
Why continue using extensions .bat instead of .cmd? [duplicate]
Possible Duplicate: Windows batch files: .bat vs .cmd? I know that the .cmd is the successor of the .bat (.cmd files use 32-bit execution while the .bat files use 16-bit execution) but most ...
232 votes
91 answers
229k views
Hidden features of Windows batch files
What are some of the lesser know, but important and useful features of Windows batch files? Guidelines: One feature per answer Give both a short description of the feature and an example, not just a ...
35 votes
16 answers
99k views
Batch files don't run - they're being opened with notepad [closed]
I use WinXP sp3, and I have created a .bat file that does something. When I double click on it, a Notepad is opened and I can edit the batch file - but it is not run ??!?! I expect that when I double ...
42 votes
9 answers
169k views
Exiting out of a FOR loop in a batch file?
Why does this batch file never break out of the loop? For /L %%f In (1,1,1000000) Do @If Not Exist %%f Goto :EOF Shouldn't the Goto :EOF break out of the loop? Edit: I guess I should've asked more ...
34 votes
3 answers
49k views
Using nodejs's spawn causes "unknown option -- " and "[Error: spawn ENOENT]" errors
I'm trying to get spawn to effect an rm -rf node_modules followed by npm install (on windows 7; nx commands courtesy of a transparently installed CygWin. All nx commands resolve on a commandline just ...
27 votes
2 answers
10k views
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 ...
26 votes
1 answer
12k views
Order in which command prompt executes files with the same name (a.bat vs a.cmd vs a.exe)
What is the order in which the Windows command prompt executes files with the same name, but different extensions? For example, I have a bunch of executable files: something.cmd, something.bat and ...
13 votes
3 answers
10k views
Batch goto loses errorlevel
Consider the following bat, test.bat (PC01 is off): mkdir \\PC01\\c$\Test || goto :eof If I run that bat from a command shell: > test.bat || echo 99 > if ERRORLEVEL 1 echo 55 The output is ...
16 votes
5 answers
6k views
Difference between "|| exit /b" and "|| exit /b !errorlevel!"
We have a bunch of .bat build scripts which are invoked by a PowerShell based GitLab runner that were recently refactored from: program args if !errorlevel! neq 0 exit /b !errorlevel! to the more ...
12 votes
4 answers
28k views
What programming languages come with windows 10 by default (no install required)?
Similar to this question What programming languages are installed by default on Windows 7?. Is the environment any differnt for Windows 10? For some programs like MS OFfice you get the VBA, Chrome ...
8 votes
2 answers
28k views
Export/SET environment variables in windows through a shell script
There is a script.sh file set FABRIC_CFG_PATH=<some path> set CORE_PEER_LOCALMSPID=<some id> If I'm running this script in windows, the env variables are not getting set. Whereas if ...
4 votes
1 answer
30k views
Putting multiple commands into one batch file
I feel like this has to be so simple and somehow I'm just missing something. I have 3 commands that I have to continuously execute back to back. How can I put those all into one batch file? Here are ...
4 votes
2 answers
5k views
Line length limit in xp batch file?
When running long command in .bat file (say 300 characters length) for example: Some_exe "C:/Documents and Settings/Some user/Some folder1/Some folder2/Some folder3/Some folder4 ... -Some_exe_arg1="...
2 votes
2 answers
10k views
How to run Windows Commands through C++ Program?
For some back info to help you guys out, I'm making a small program that will take an .SQL file and restore it to the users localhost phpMyAdmin using mysql.exe. Importing the file through the MyAdmin ...