How to run a batch file each time the computer boots

  1. Create a shortcut to the batch file.
  2. Once the shortcut has been created right-click the file and select Cut.
  3. Click Start, Programs, right-click the Startup folder and click Open
  4. Once the Startup folder has been opened click Edit and paste the shortcut into the startup. Any shortcuts in the startup folder will automatically start each time Windows starts.

Change the executable path of the Wisdom Service in 3 simple steps

Change the executable path of the Wisdom Service in 3 simple steps:

Start Menu -> Run and enter “Regedit” (sans quotes)

  1. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Wisdom
  2. Change the ImagePath key – double click and set the correct path

How to exit a Windows MS-DOS window through a batch file

When a batch file is complete, Microsoft Windows will leave the Window open, requiring the user of the computer to manually close it. For convenience, the individual writing the batch file may want to automatically close that window.

Add the “exit” command to the end of your batch file.

Alternatively, if you are using Windows 95, 98, ME, or NT you can also exit out of a batch file by creating a shortcut to the batch file and making the shortcut automatically close the program. To do this follow the below steps.

1. Create a shortcut to the MS-DOS program or batch file.
2. Once the shortcut has been created right- click the shortcut and click Properties.
3. Click the Programs tab
4. Check the box to “Close on exit.”
5. Click Apply and then Ok.

Note: This is no longer available in new versions of Windows such as Windows 2000 or Windows XP.

Finally, it is important to realize that if a batch file or program is still running a program the MS-DOS windows will not close until it has completed. Therefore a MS-DOS window may remain open either because the program stopped responding or because it’s still performing tasks.

How to create a blank line in a batch file

It may be necessary to create a blank line to help separate text from other text or move text further down the screen.

To create a line add a dot or period after the echo command, for example:

echo.

An alternate solution could be to insert a blank character by typing ALT+255 in the batch file. Although this solution can work, we recommend using ‘echo.’ as it is a solution that will work in all versions of MS-DOS and Windows.

How to execute commands in a batch file in timed intervals

In the below example, the batch file is placed into a loop  and executes the “dir” command every 20 seconds. This solution would be best for users who need to execute a command frequently.

:START
REM Execute the MS-DOS dir command ever 20 seconds.
dir
SLEEP 20
GOTO END

Note: In order for the above batch file to run properly you must have the sleep MS-DOS utility on the computer. This utility is not included with any version of MS-DOS or Windows. However, once downloaded will allow your computer to sleep / delay for any specified amount of seconds.

Prevent deleting files in MS-DOS without a prompt

To help prevent files from becoming accidentally deleted Microsoft will warn you before deleting files or folders.

By default Microsoft Windows will not prompt a user or give a user a prompt or warning when deleting files on a computer using the del command. However, when attempting to delete a directory using the deltree or rmdir command on a directory  that is not empty you will receive a warning and/or error message about deleting the directory.

To suppress the prompting use the deltree command and add the tag /y.  Here is an example of how the whole command would look, deltree c:\windows\temp\*.* /y However, this does not work in all versions of Windows and or DOS.

If this command does not work we would recommend that you create a batch file with the below command in the batch file.

echo y | del %1\*.*

Once created, you can type the name of the batch file then the name of the directory that you wish to delete.

Microsoft Windows 2000 and Windows XP users

Users who wish to delete a directory containing files in a MS-DOS session running under Microsoft Windows 2000 or Windows XP can also use the rmdir or rd command with the /S option.

Please remember that when you delete files or directories from the computer they are permanently removed, so be careful! Microsoft Windows 95, Windows 98, Windows ME, Windows NT, Windows 2000, Windows XP, and later versions of Windows users deleting files through MS-DOS should realize that all deleted files will not be sent to the recycle bin.

Other users using MS-DOS through Windows

Users running MS-DOS through later versions of Microsoft Windows can also utilize the erase command to delete files without a prompt. Microsoft Windows 95, Windows 98, Windows ME, Windows NT, Windows 2000, Windows XP, and later versions of Windows users deleting files through MS-DOS should realize that all deleted files will not be sent to the recycle bin.

How to make a time log in a batch file

The below example demonstrates how to create a time log of when the batch file is loaded, or for example, this could be used in the autoexec.bat when someone logs into a computer that supports this file.

ECHO. |TIME > TIME
COPY LOG +TIME

An alternate, slightly more complicated method that, to our knowledge, cannot be used in Windows NT, Windows 2000 or Windows ME would be the following:

echo @prompt set date=$d$_set time=$t$h$h$h > {a}.bat
%comspec% /e:2048 /c {a}.bat > {b}.bat
for %%v in ({b}.bat del) do call %%v {?}.bat
echo %date% %time% >> log

Another alternative is:

echo. |time |find “current” >> log

For the above batch file to work properly you must create a file called log, by typing edit log and then save and exit the file, creating a 0 bytes file. If this file is not created or not created properly you will receive the error message Content of destination lost before copy.

Creating a batch file delay

Below is an example of how to delay a batch file any where from 5 to 99 seconds. In the below example we illustrate a 5 second delay.

TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL

How to start Windows files and other programs from a batch file

To run Microsoft Windows programs or files use the START command. The below example would run Windows Notepad.

START /MAX NOTEPAD

You can also specify the direct location of the file by typing the below command.

START /MAX C:\Windows\NOTEPAD.EXE

*Windows users who have a different directory (e.g. Windows 2000 users) would need to substitute WINNT or the name of their directory in place of Windows in the above example.

The /m representing it to start the window Maximized. See our start command page for additional information about this command.

What is batch file?

A batch file is a text file with a .bat or .cmd extension. A batch file adheres to a syntax and a set of valid commands or instructions. To run a batch file, enter the file’s name. You don’t need to enter the .cmd or .bat extension. To write a basic batch file, perform the following steps.

1. Open Notepad.
2. Enter the command
3. @echo hello world Text that follows the echo command will output to the screen. The @ symbol suppresses the command from printing to the screen. To prevent commands from displaying for an entire batch file, enter
4. @echo off at the top of the batch file.
5. Select Save As from the file menu.
6. Enter the batch file’s name as
7. “<name>.cmd” Be sure to enter the name in quotes, or Notepad will add .txt to the end.
8. Run cmd.exe to start a command session.
9. Enter the batch file’s name, without the extension.