New
#1
Windows can't find the file when trying to run a .bat file
When I double click a .bat file windows says it can't find it, but if I do a direct access to the file then it runs it without any problem. Any idea?
Tanks!
When I double click a .bat file windows says it can't find it, but if I do a direct access to the file then it runs it without any problem. Any idea?
Tanks!
Hi and Welcome to SevenForums.
Can you please post a screen shot of the error you are getting as i'm not quite sure what you mean?
Screenshots and Files - Upload and Post in Seven Forums
Can it not find the actual bat file you are double clicking or a file that the script in the bat file is trying to reference?
Regards,
Jamie
Can you please clarify what you mean by it works when you do a direct access to the file?
Regards,
Jamie
Sounds like your environment variables have been changed, and the double-click is not opening the CMD properly.
Please open an Elevated Command Prompt, and run the following commands
REG QUERY HKEY_CLASSES_ROOT\.bat /S
REG QUERY HKEY_CLASSES_ROOT\.cmd /S
REG QUERY "HKCU\Volatile Environment" /S
Post the results.
Here are some instructions to make life easier :)
1) To open an Elevated Command Prompt Window (the ECP window), click on Start, All Programs, Accessories – then right-click on Command Prompt, and select Run as Administrator. Accept the UAC prompt.
2) To run the commands easier, highlight the block of commands, and right-click on the highlight – select Copy. In the CP Window, click on the black/white icon at top left – select Paste. The commands will run but may not complete the last command, so hit the Enter Key once.
3) To copy the results... click on the Black/White icon in the top left, and select Edit... 'Select All', and hit the Enter key - then use Ctrl+V or r-click+Paste to paste it into your response.
This are the results, but had no luck with double clicking .bat files: I get the same error.Code:C:\Users\Roger>REG QUERY HKEY_CLASSES_ROOT\.bat /S HKEY_CLASSES_ROOT\.bat (Predeterminado) REG_SZ batfile HKEY_CLASSES_ROOT\.bat\PersistentHandler (Predeterminado) REG_SZ {5e941d80-bf96-11cd-b579-08002b30bfeb} C:\Users\Roger>REG QUERY HKEY_CLASSES_ROOT\.cmd /S HKEY_CLASSES_ROOT\.cmd (Predeterminado) REG_SZ cmdfile HKEY_CLASSES_ROOT\.cmd\PersistentHandler (Predeterminado) REG_SZ {5e941d80-bf96-11cd-b579-08002b30bfeb} C:\Users\Roger>REG QUERY "HKCU\Volatile Environment" /S HKEY_CURRENT_USER\Volatile Environment LOGONSERVER REG_SZ \\2500K USERDOMAIN REG_SZ 2500k USERNAME REG_SZ Roger USERPROFILE REG_SZ C:\Users\Roger HOMEPATH REG_SZ \Users\Roger HOMEDRIVE REG_SZ C: APPDATA REG_SZ C:\Users\Roger\AppData\Roaming LOCALAPPDATA REG_SZ C:\Users\Roger\AppData\Local HKEY_CURRENT_USER\Volatile Environment\1 SESSIONNAME REG_SZ Console CLIENTNAME REG_SZ C:\Users\Roger>
It's an error window that says something like:
filename.bat is the name of the file I'm double clicking.Code:Windows can't find the file "filename.bat" Make sure filename it's written correctly and try again.
(I'm translating from spanish so maybe in english it's not exactly the same message.)
Hmmm - that's normal.
Let's look a little deeper...
Open an Elevated Command Prompt, and run the following commands.
post the resultsCode:REG QUERY HKCR\CLSID\{5e941d80-bf96-11cd-b579-08002b30bfeb}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF} REG QUERY HKCR\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb} /S REG QUERY HKCR\CLSID\{DD75716E-B42E-4978-BB60-1497B92E30C4}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF} REG QUERY HKCR\Wow6432Node\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb} .
Last edited by NoelDP; 02 Aug 2014 at 01:48. Reason: correct ttpyo in command
Results:
Still no luck. But now if I right click the .bat file and select run as administrator it runs...Code:Microsoft Windows [Versión 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos. C:\Users\Roger>REG QUERY HKCR\CLSID\{5e941d80-bf96-11cd-b579-08002b30bfeb}\Persi stentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF} HKEY_CLASSES_ROOT\CLSID\{5e941d80-bf96-11cd-b579-08002b30bfeb}\PersistentAddinsR egistered\{89BCB740-6119-101A-BCB7-00DD010655AF} (Predeterminado) REG_SZ {c1243ca0-bf96-11cd-b579-08002b30bfeb} C:\Users\Roger>REG QUERY HKCR\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb} /S HKEY_CLASSES_ROOT\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb} (Predeterminado) REG_SZ Plain Text filter LocalizedString REG_SZ @query.dll,-511 HKEY_CLASSES_ROOT\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb}\InprocServer32 (Predeterminado) REG_EXPAND_SZ %systemroot%\system32\query.dll ThreadingModel REG_SZ Both C:\Users\Roger>REG QUERY HKCR\CLSID\{DD75716E-B42E-4978-BB60-1497B92E30C4}\Persi stentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF} HKEY_CLASSES_ROOT\CLSID\{DD75716E-B42E-4978-BB60-1497B92E30C4}\PersistentAddinsR egistered\{89BCB740-6119-101A-BCB7-00DD010655AF} (Predeterminado) REG_SZ {c1243ca0-bf96-11cd-b579-08002b30bfeb} C:\Users\Roger>REG QUERY HKCR\Wow6432Node\CLSID\{c1243ca0-bf96-11cd-b579-08002b3 0bfeb} HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb} (Predeterminado) REG_SZ Plain Text filter LocalizedString REG_SZ @query.dll,-511 HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{c1243ca0-bf96-11cd-b579-08002b30bfeb}\Inpro cServer32
I noticed that if a programs tries to run a .bat it says that it can't find the file, but I'm sure it's there.