OiMunk

Shell Execute Workaround/Confusion?

16 posts in this topic

#1 ·  Posted (edited)

This line works:    ShellExecute("notepad.exe","","C:\Windows\System32\")

This one doesn't:     ShellExecute("TotalMixFX.exe","","C:\Windows\System32\")

I get the error: "Windows Cannot Find...".     I've quadruple checked the spelling of "TotalMixFX.exe".

 

Similarly, this line works: Run("C:\Windows\System32\notepad.exe")

But this one doesn't:  Run("C:\Windows\System32\TotalMixFX.exe")

Nothing happens.

I can click on the icon normally, create shortcuts for it, check its properties, but AutoIt can't open it.   Ideas please?  Alternate methods of opening a file?

 

Edited by OiMunk
clarification

Share this post


Link to post
Share on other sites



MsgBox(0, "", "File exists: "&(FileExists("C:\Windows\System32\TotalMixFX.exe")?"Yes":"No"))

Check if the executable is located at the specified path. If yes, try running it with the cmd. If it launches successfully with cmd, and not with Autoit, maybe do something like:

RunWait(@ComSpec & " /c start C:\Windows\System32\TotalMixFX.exe")

 

Share this post


Link to post
Share on other sites

What OS are you running on and is it 32/64 bit?  Do you have #requireadmin ?

Share this post


Link to post
Share on other sites

I was asking OiMunk.

TotalMixFX must have been put in the system32 from an installed software. I suspect the issue comes from security in windows. Notepad has a system variable and windows knows exactly where it is even if you dont specify the full path.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

did you tried 

C:\Windows\SysWOW64   ?

 

System32 64 Windows System folder (system directory) for 64-bit files
SysWOW64 32 Windows System folder (system directory) for 32-bit files

 

Edited by radienergos

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks All.

Update:  I can open the .exe from the Cmd line, but not AutoIt, or any other program that opens .exe files.  

I tried,  

RunWait(@ComSpec & " /c start C:\Windows\System32\TotalMixFX.exe")

 as suggested with no effect.

I do not have  #requireadmin.

I'm using Win7, 64bit.     The TotalMixFX.exe originates from an installer (It's the control software for a hardware audio interface).  I suspect, as suggested, that there's some security feature surrounding this file, but I'm not sure how to verify that, or circumvent it.  I did RightClick->Properties->Security on the file, and it appears that all "Permissions" are "Allowed".

I'm not sure how to "try"  C:\Windows\SysWOW64 as suggested above: the file is definitely in System32, not SysWOW64.

 

Interestingly, this line works perfectly in AutoHotKey   Run, C:\WINDOWS\System32\TotalMixFX.exe

 

Edited by OiMunk

Share this post


Link to post
Share on other sites

Are you compiling it as a 64bit app?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I've tried it both ways (64+32), same result, but for now I'm just trying to run it from within SciTe.

Share this post


Link to post
Share on other sites

Prodigy: The error returned from AutoIt says "Cannot find file".    TotalMixFX.exe runs perfectly when I manually run it.   The problem is that AutoIt can't find the file.    I actually have an AutoIt script running at all times.

Share this post


Link to post
Share on other sites

show me the SciTE oputput pane information when you run the script. Simply cut&paste the text into a codeblock in your reply.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Check out this topic. I think you have the same issue. There are several solutions that you can try there:

 

1 person likes this

Share this post


Link to post
Share on other sites

Amazing!    That thread has the solution, even though it's absurd.

ShellExecute("TotalMixFX.exe")     ;   this works! because the .exe is in the system32 folder

and this will never work:  

ShellExecute("TotalMixFX.exe","","C:\Windows\System32\")   ;because the .exe is in the system32 folder...

Go figure.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

One other thing to remember is that the 3rd parameter is the workdir, not the path where to find the exe!

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

It's no longer working.

ShellExecute("TotalMixFX.exe")      ; worked perfectly yesterday, and today it says it can't find the file, without any code change.

I'll investigate the "working directory" aspect. 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now