Jump to content

Please Help a newbie! (Variables and ShellExecute)


soh
 Share

Recommended Posts

Hello everyone,

I'm new on Autoit and I'm trying to run two variables, one with parameters.

 

Local $go2 = @AppDataDir & "\test\file2.exe"
Local $go1 = @AppDataDir & "\teste\file1.exe"


if fileexists($go2) then

ShellExecute ('"$go1" /parameters1 /parameters2', ($go2))

Exit

else
msgbox(0, "My Test", "File not found" & @LF & "My url")
endif

This should run like this (exemple):

"path1/file1.exe /parameters1 /parameters2" "path2/file2.exe"

But, dont work. Please, help-me.

 

thanks!

 

Link to comment
Share on other sites

  • Moderators

@soh Your variable should not be inside quotes in your ShellExecute statement. It would just be ShellExecute($go1, ......

 

 

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

You would enter the parameters in quotes, but not the variable. Like so:

ShellExecute ($go1,  '/parameters1 /parameters2', $go2)

 

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

This works:

Local $go2 = @AppDataDir & "\test\file2.exe"
Local $go1 = @AppDataDir & "\teste\file1.exe"


If FileExists($go2) Then

    ShellExecute($go1, "/parameters1 /parameters2")
    ShellExecute($go2)

    Exit

Else
    MsgBox(0, "My Test", "File not found" & @LF & "My url")
EndIf

Not sure why you would put a  executable variable as a parameter for 'workingdir' but if you you want both executables to run then this should do it.

Link to comment
Share on other sites

Not work.

the truth, is a command line.
It has to be run like this:

%appdatada%\test\file1.exe /op /sc /nt "%appdata"\test\file2.exe"

how can i make it run the command that way (EXACT)?

Link to comment
Share on other sites

  • Moderators

Try this:

Run(@AppDataDir & "\test\file1.exe /op /sc /nt " & @AppDataDir & "\test\file2.exe")

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...