Vista: Batch file cannot find path of exe

B

Bruce

Hi
I just posted this but it has not come up in the groups even after 3
hours. so resposting..

I have a silly question on vista. I have a .bat file calling an .exe
file both in the same directory in vista, but every time i right click
the .bat file and ask it to "run as administrator", it fails to find
the .exe file. it says "blah.exe is not a recognized program"

but the same batch file works fine if UAC is disabled and in XP.
any idea why? should i modify something in the batch file which
currently reads as

"blah.exe <params>"

Thanks
Bruce
 
M

Michael Chare

Bruce said:
Hi
I just posted this but it has not come up in the groups even after 3
hours. so resposting..

I have a silly question on vista. I have a .bat file calling an .exe
file both in the same directory in vista, but every time i right click
the .bat file and ask it to "run as administrator", it fails to find
the .exe file. it says "blah.exe is not a recognized program"

but the same batch file works fine if UAC is disabled and in XP.
any idea why? should i modify something in the batch file which
currently reads as

"blah.exe <params>"

Thanks
Bruce


Maybe code the full path for the .exe file. Also check file permissions
(Attributes).
 
B

Bruce

Hi Michael
If i code the full path of the exe file, it works. But I don't want to
do that since I am not sure where users will copy it to.
I checked the permissions for .bat and .exe file, both are not read-
only, not hidden.

Thanks
Bruce
 
B

Bruce

Hi Michael
If i code the full path of the exe file, it works. But I don't want to
do that since I am not sure where users will copy it to.
I checked the permissions for .bat and .exe file, both are not read-
only, not hidden.

Thanks
Bruce

Hi
I managed to resolve the problem! When Vista runs a batch file as
admin, it runs it from the system32 directory - that is why it could
not find the exe.
The solution was to move to the current directory at the start of the
batch file.

Thanks
Bruce
 
J

Joe Guidera

I suspect that when the token elevates (e.g. when you run as administrator)
the default shell environment (e.g. the command environment) starts in
c:\windows\system32. Just for curiosity, if you create a shortcut to the
BAT file and set the "start in" on the shortcut, does it resolve the issue?

J

Bruce said:
Hi Michael
If i code the full path of the exe file, it works. But I don't want to
do that since I am not sure where users will copy it to.
I checked the permissions for .bat and .exe file, both are not read-
only, not hidden.

Thanks
Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top