Sign in to follow this  
Followers 0
Shyke

Running a *.exe with args?

18 posts in this topic

I was wondering how to run a *.exe file with args, could anyone help me out?

Share this post


Link to post
Share on other sites



I was wondering how to run a *.exe file with args, could anyone help me out?

Try

run("prog.exe /arg")


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

if you look at a "link" from... say Mcaffee

right click > properties > you can see how they do it

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Try

run("prog.exe /arg")
Hmmm....

I have:

Func Unzip()
; Usage: "unzip file.zip -d c:\where\to\unzip\"
    Run("unzip.exe /unzip " & $path & "test.zip -d " & $path)
EndFunc

Why won't it unzip the zip file?

Share this post


Link to post
Share on other sites

i noticed you use $path twice...

does it... or does it not include the actal file name

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I want it to unzip the "test.zip" file that is at the $path location to the $path.

Share this post


Link to post
Share on other sites

You might need to include the full path to unzip.exe near the begining.

Func Unzip()
; Usage: "unzip file.zip -d c:\where\to\unzip\"
    Run("C:\path\to\unzip.exe " & $path & "test.zip -d " & $path)
EndFunc

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

I want it to unzip the "test.zip" file that is at the $path location to the $path.

The path to unzip.exe is the currect directory.

Share this post


Link to post
Share on other sites

That could easily be a false assumption... try hard coding it to see if it makes a difference. It shouldn't do any harm.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Didn't change anything.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

For testing, make a variable that holds the entire string exactly the way you want it to be, then do a MsgBox to display it so you can verify that all the variables were passed and formatted the way you want.

Something like this:

Func Unzip()
; Usage: "unzip file.zip -d c:\where\to\unzip\"
    $var = "C:\path\to\unzip.exe " & $path & "test.zip -d " & $path
    MsgBox(0,"variable",$var)
    Run($var)
EndFunc

Also consider just typing exactly what you are expecting into a CMD window to verify that unzip.exe doesn't have a problem with your syntax.

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

What is $path?

Do you have "\" at the end of it before "test.zip"?

Share this post


Link to post
Share on other sites

$path is the directory of the location to extract the file to and where it was downloaded to, it will vary from computer to computer.

Everything checks out properly when I test it.

Maybe it is the unzip.exe? Anyone have one (a *.exe that unzips files) that works as a standalone?

Share this post


Link to post
Share on other sites

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Alright, I am using palc and I am getting this:

Unable to execute the external program.:

Run(@TempDir & '\unzip.exe /-p"' & $Path & '" "' & $Path & 'test.zip"', @SW_HIDE)

The directory name is invalid.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

so the unzip.exe is located in

C:\Documents and settings\current user\local settings\temp

thats where the exe is?????

thats where @TempDir is looking

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

As stated before does $Path include a trailing "\"?

If it doesnt then try the following.

Run(@TempDir & '\unzip.exe /-p"' & $Path & '" "' & $Path & '\test.zip"', @SW_HIDE)

If it does have the trailing backslash. Then try and take it out of the first $path. I think that would be the way to go.

Hope this helps,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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
Sign in to follow this  
Followers 0