Jump to content
soh

Please Help a newbie! (Variables and ShellExecute)

Recommended Posts

soh

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!

 

Share this post


Link to post
Share on other sites
JLogan3o13

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

 

 

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
soh

But if i enter the parameters within "Local", also does not work.

Ex:

Local $go1 = @AppDataDir & "\teste\file1.exe /parameters1 /parameters2"

 

Share this post


Link to post
Share on other sites
JLogan3o13

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

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

 

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
soh

And, not work:

($go1 /param, $go2)

Share this post


Link to post
Share on other sites
l3ill

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.

Share this post


Link to post
Share on other sites
soh

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)?

Share this post


Link to post
Share on other sites
JLogan3o13

Try this:

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

 


√-1 2^3 ∑ π, and it was delicious!

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

×