Followers 0

# 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:

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

hehe

Edited by Dev

##### 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...

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

Thanks man... Ill try later

:iamstupid:

##### Share on other sites

#4 ·  Posted (edited)

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

$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 As allways ---> :iamstupid: EDIT: Maybe i should create a topic called "Dev's n00by Questions" 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 ?

Live for the present,
Dream of the future,
Learn from the past.

##### 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 on other sites

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

Yeap but now Backwards !!!

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

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

Ok, thanks. Im sure this will help me

Dont forget ---> :iamstupid:

##### Share on other sites

Yeap but now Backwards !!!

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

Yeah, what he said.

##### Share on other sites

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