Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch files don't run - they're being opened with notepad [closed]

I use WinXP sp3, and I have created a .bat file that does something. When I double click on it, a Notepad is opened and I can edit the batch file - but it is not run ??!?!

I expect that when I double click a .bat file - it should run, no? How can I fix this?

like image 954
DuduArbel Avatar asked Feb 05 '11 07:02

DuduArbel


People also ask

How do I stop a batch script from closing?

If you want the command prompt cmd widnow to stay open after executing the last command in batch file –you should write cmd /k command at the end of your batch file. This command will prevent the command prompt window from closing and you'll get the prompt back for giving more commands in the cmd window.

How do I open a notepad file in a batch file?

Open Notepad ("Start" menu > "Run" > type notepad > press Enter). Click on "File" > "Save As...", and name the file with a batch file extension (ie: "startmyprg. bat").

How do I force a batch file to run?

Run batch files on startup Open File Explorer. Open the folder containing the batch file. Right-click the batch file and select the Copy option. Use the Windows key + R keyboard shortcut to open the Run command.


1 Answers

Check if you have this key in your registry :

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bat\UserChoice 

if you have one it means that the .bat extension is currently associated with notepad (or another program defined by the "Progid" key under this node).

Backup you registry and remove this .bat "UserChoice" node.

your .bat files should then run normally.

like image 134
Manuel Rozier Avatar answered Oct 19 '22 14:10

Manuel Rozier