Jump to content
Sign in to follow this  
Dev

Run With Parameters?

Recommended Posts

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


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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:


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...