I am working on windows 7 and I found that "notepad" was set as the default program for opening my .bat files. So when I try to execute the batch file by double clicking, it is opened by notepad.
I have tried setting cmd.exe as the default program, which didn't work.
What is the default program I should set for executing .bat files?
The ECHO-ON and ECHO-OFF commands are used to enable and disable the echoing, or displaying on the screen, of characters entered at the keyboard. If echoing is disabled, input will not appear on the terminal screen as it is typed. By default, echoing is enabled.
When used in a command line, script, or batch file, %1 is used to represent a variable or matched string. For example, in a Microsoft batch file, %1 can print what is entered after the batch file name.
When a batch file is run, the shell program (usually COMMAND.COM or cmd.exe) reads the file and executes its commands, normally line-by-line. Unix-like operating systems, such as Linux, have a similar, but more flexible, type of file called a shell script. The filename extension . bat is used in DOS and Windows.
Using the %* value in a batch script refers to all the arguments (for example, %1, %2, %3...). You can use the following optional syntaxes as substitutions for batch parameters (%n): Batch Parameter.
Click on "Start"->"Run" and type in "REGEDT32" and press Enter to start the Registry Editor.
Find the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.BAT\UserChoice
and delete the key named "UserChoice".
Check the output of the following commands:
C:\>
C:\>assoc .bat
.bat=batfile
C:\>ftype batfile
batfile="%1" %*
C:\>
If your output is different, you have to correct the settings
(see assoc /?
and ftype /?
for help)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With