Batch files don't run - they're being open

2020-02-23 06:20发布

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?

16条回答
2楼-- · 2020-02-23 06:47

Here is my solution:

Here's the entry to delete:

Hkey_Current_User\Software\Microsoft\Microsoft\Windows\CurrentVersion\Explorer\FileExts.bat

After the reboot check your file associations again. It should now show Name =.bat, Description=Windows Batch File, Current Default=Unknown application. With this association your bat files should execute normally.

查看更多
甜甜的少女心
3楼-- · 2020-02-23 06:47

Just drag and drop the file to command prompt

查看更多
放荡不羁爱自由
4楼-- · 2020-02-23 06:48

I had this issue a few days and in my case, my company PC had different registry configuration for each user. When I was tried to launch the regedit, cmd, or Chrome it got opened by Notepad++.

So my solution was to:

start cmd via taskmannager press control and click that will open a cmd for your current logged user. if you run this command "assoc | findstr /i "txtfile" you will see that .exe is associated with txtfile besides exefile

if you are in a company PC, log your current opened cmd with the system admin user by this command "runas /user:USERADMINOFYOURCORP cmd.exe" and insert the password

then launch the regedit and search for in case that you are the admin of your PC

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.EXE

else

-HKEY_USERS{YOUR USER IN THE PC}\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.exe you will see that it's set to the txtfile.

So create this file with the name exefixer.reg

Windows Registry Editor Version 5.00

[-HKEY_USERS{YOUR USER IN THE PC}\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.exe]

[-HKEY_USERS{YOUR USER IN THE PC}\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.exe]

[-HKEY_USERS{YOUR USER IN THE PC}\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.exe\OpenWithList]

[-HKEY_USERS{YOUR USER IN THE PC}\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.exe\OpenWithProgids] "exefile"=hex(0): run it from the cmd

查看更多
仙女界的扛把子
5楼-- · 2020-02-23 06:50

Try right clicking it, hovering over "open with" and selecting "command prompt".

As a developer of batch files, windows opens .bat with notepad by default. Someone who doesn't write them will probably by default launch the file with the command line.

查看更多
登录 后发表回答