Converting a .bat into .exe

December 2016




Issue


I'm seeking for a rapid solution to convert .bat in .exe?

Solution


It is not necessary to compile .bat into .exe C to run batch file under Windows XP and beyond. Just understand how the system has evolved from the days of DOS prompt.

What you should know is that the batch files have been operating from the command.com (version anterior to Windows Millennium), the visible part of the DOS located at the root of the drive. But since Windows 2000, this file containing all internal DOS commands (16-bit) necessary for execution of batch files, no longer exists, DOS has disappeared. However, it was replaced by another batch file in a 32-bit which is more interesting and powerful than before, boosting the same time the use of powerful batch files and more rapidly.

This new file called Cmd.exe isused to operate the subsystem command that replaced the DOS. It is located in the directory "system32" of Windows. Also, to run batch files from Windows 2000, you must:
  • Create a shortcut that points to Cmd.exe, for example by copying the shortcut located in the Accessories menu "start".
  • Rename the shortcut, for example with the name of the batch file that you want to run.
  • Right-click on the shortcut/properties. In the tab "Shortcut", edit the command line of the target by inserting the name of the batch file and then save using the "OK" button.
  • For example, if the batch file called Rename.bat. You must insert targets:

%SystemRoot%\system32\cmd.exe /c \path\rename.bat 



In the command line, "\path " means the path to the directory where the rename.bat file is located.

To run the batch file, simply double-click the shortcu. Do not forget that the batch file can still be launched from the command line when you start Cmd.exe

Thanks to Progman for all these information.

Related :

This document entitled « Converting a .bat into .exe » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.