Sign in to follow this  
Followers 0
Dev

Run With Parameters?

10 posts in this topic

#1 ·  Posted (edited)

How do i run a program (like a game) using the Run() command?

This generates an error:

Run("myprg.exe -para1 -para2", "workingdir")

:iamstupid:

Thanks for your help :whistle:

And one thing: I AM NEW TO AUTOIT!...

hehe

Edited by Dev

Share this post


Link to post
Share on other sites



Try it this way:

run('"c:path\to\pgm\mypgm.exe" "param1" "param2"')

Notice the at the start and end of the whole string it has a single quote...


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

Thanks man... Ill try later

:iamstupid:

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Allright, another question, ive decieded to not make a new topic of it... You will notice why B)

$path = c:/program/MyApp/
$exe = MyApp.exe
$params = -H - E -Y
$fullpath = $path & $exe &  $params
Run($fullpath, $path)

Ive seen this in other's codes, i dont really know how it works, and I would be very happy if someone could explain this :angry:

As allways ---> :iamstupid:

EDIT:

Maybe i should create a topic called "Dev's n00by Questions" :whistle:

Edited by Dev

Share this post


Link to post
Share on other sites

let see if i can explain:

Anything between " " is a string.

So you should put " " around the stuff you typed in the example.

$path = "c:/program/MyApp/"

$exe = "MyApp.exe"

$params = "-H - E -Y"

Then you concatenate these strings together with & ... but you need a space between the program and its parameters .. so:

$fullpath = $path & $exe & " " & $params

Now:

Run($fullpath, $path) is the same as:

Run("c:/program/MyApp/MyApp.exe -H - E -Y", c:/program/MyApp/)

ok ? :whistle:


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

Sort of off-topic-ish, but you're using Windows and you should probably use forward slashes "\" instead of backslashes "/". Although Windows itself (And the command line) will accept either forward or back, most applications and even a few command line related things won't work correctly when using backslashes.

For example, typing this into a console window on Windows XP doesn't change directories: cd C:/Windows

Share this post


Link to post
Share on other sites

forward slashes "\" instead of backslashes "/".

Yeap but now Backwards !!! :whistle:

You mean "\" backSlash and "/" Forward Slash ??


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

Ok, thanks. Im sure this will help me :whistle:

Dont forget ---> :iamstupid:

Share this post


Link to post
Share on other sites

Yeap but now Backwards !!!    :whistle:

You mean "\" backSlash and "/" Forward Slash ??

Yeah, what he said.

Share this post


Link to post
Share on other sites

Okay master, i will never write "/" in paths again :whistle:

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