Top "Batch-file" questions

A batch file is a text file containing a series of commands that are executed by the command interpreter on MS-DOS, IBM OS/2, or Microsoft Windows systems.

How can I echo a newline in a batch file?

How can you you insert a newline from your batch file output? I want to do something like: echo hello\…

windows batch-file newline
How to delete files/subfolders in a specific directory at the command prompt in Windows

Say, there is a variable called %pathtofolder%, as it makes it clear it is a full path of a folder. …

windows batch-file file-io cmd directory
How do I run two commands in one line in Windows CMD?

I want to run two commands in a Windows CMD console. In Linux I would do it like this touch …

windows batch-file command-line cmd
What does %~dp0 mean, and how does it work?

I find %~dp0 very useful, and I use it a lot to make my batch files more portable. But the …

batch-file
How can you find and replace text in a file using the Windows command-line environment?

I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text …

windows command-line scripting batch-file text-files
Batch script loop

I need to execute a command 100-200 times, and so far my research indicates that I would either have to …

windows loops batch-file
How to run multiple .BAT files within a .BAT file

I'm trying to get my commit-build.bat to execute other .BAT files as part of our build process. Content of …

batch-file cmd
Format date and time in a Windows batch script

In a Windows (Windows XP) batch script I need to format the current date and time for later use in …

windows datetime formatting batch-file
Stop and Start a service via batch or cmd file?

How can I script a bat or cmd to stop and start a service reliably with error checking (or let …

windows command-line batch-file cmd
How to use if - else structure in a batch file?

I have a question about if - else structure in a batch file. Each command runs individually, but I couldn't …

batch-file if-statement