Archive for July, 2009

Searching for a string of text in a MS-DOS batch file

Using the findstr command will enable you to search for text within any plaintext file. Using this command within a batch file will allow you to search for text and create events off the results found. Below are some examples.
Basic search
In the below example this basic batch file would search through the hope.txt file for [...]

How can I loop or start a batch file over after it has completed?

Using the goto command within a batch easily allows a user to loop or restart a batch file after it has been completed.  Below are some examples of how this command can be used. This page was created with the easiest, but not necessarily recommended solution first, to the most difficult solution but recommended method [...]

How can I run a batch file in full screen

In some situations you may want to run a batch file in full screen.
1. Create a shortcut to the batch file.
2. Once the shortcut has been created right-click it and select Properties.
3. Within the Properties window click the Options tab.
4. In Options select Full screen under the Display options and click Ok.
5. If the batch [...]

How can I play a sound file from a Windows batch file

Using the Windows mplay32.exe or mplayer.exe file included with Microsoft Windows allows you to play Windows sound files. Depending on your version of Windows will depend on what file you’ll run. Windows 95 and 98 users will be using mplayer instead of mplay32 as shown in the below examples.
As can be [...]

How can I make a batch file rename a file to the date or time?

There are a few different methods of how this can be done. Below is an example of how you could use the date command within the for command to extract the current date and use that data to rename the file. Each of the for commands listed in this document would be [...]

How can I run a batch file or other file minimized

Microsoft Windows users can run batch files or other files in a minimized window by using the command prompt start command. This is useful for when a user needs to run a batch file but doesn’t want the user to interrupt its operation. Below is an example of how the start command can be used [...]

How can I run a batch file at a specific time

With the introduction of Microsoft, Microsoft has included Scheduled Tasks, a software program designed to run any program, including batch files, at any time or any schedule [...]

How to shut down the computer with a batch file

Shut down the computer
C:\Windows\RUNDLL32.EXE user,exitwindows
exit

NOTE: When typing the above two lines, spacing is important. It is also very important that the exit line be placed into the batch file [...]

How to restart the computer with a batch file

Restarting the computer
START C:\Windows\RUNDLL.EXE user.exe,exitwindowsexec
exit
NOTE: When typing the above two lines, spacing is important. It is also very important that the exit line be placed into the batch [...]

How to make a bat executable?

A .BAT file can very easily be made into a .EXE or .COM file. This can help give you additional abilities such as file versions and keeping the program hidden from the user and/or keep the source of the batch file hidden from the user. We recommend users use the bat_to_exe_converter file to convert their [...]