soh

Please Help a newbie! (Variables and ShellExecute)

8 posts in this topic

#1 ·  Posted

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



#2 ·  Posted (edited)

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

 

 

Edited by JLogan3o13

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

#3 ·  Posted

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

#4 ·  Posted (edited)

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

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

 

Edited by JLogan3o13

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

#5 ·  Posted

And, not work:

($go1 /param, $go2)

Share this post


Link to post
Share on other sites

#6 ·  Posted

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

#7 ·  Posted

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

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