Jump to content
Sign in to follow this  
Michael10

How to parse arguments to Run command

Recommended Posts

Michael10

Hello,

Im trying to make a simple script which logs me into steam. The idea is that i run the file with 2 arguments. (User/password). But im not able to accomplish the task.

Could someone pls point me in the right direction ?

This is the code :

Run ("C:Program FilesSteamsteam.exe -login USER PASSWORD")

If i replace user/password with the actual info, it works. But i need to send the informations as arguments, since i have several accounts.

like this : steamlauncher.exe test 1234

Thanks in advance

Michael

Share this post


Link to post
Share on other sites
Malkey

This method might work for you.

Local $aUser_Password[2] = ["test 1234", "test2 password2"] ; Put the list of User names and passwords into an array.

For $i = 0 To UBound($aUser_Password) - 1
    Run ("C:\Program Files\Steam\steam.exe -login " & $aUser_Password[$i])
    ; Or
    Run("steamlauncher.exe " & $aUser_Password[$i])
Next

Share this post


Link to post
Share on other sites
Michael10

 

This method might work for you.

Local $aUser_Password[2] = ["test 1234", "test2 password2"] ; Put the list of User names and passwords into an array.

For $i = 0 To UBound($aUser_Password) - 1
    Run ("C:\Program Files\Steam\steam.exe -login " & $aUser_Password[$i])
    ; Or
    Run("steamlauncher.exe " & $aUser_Password[$i])
Next

Thanks for your reply malkey.

But this isnt quite what im looking for. With your example, all users/passwords are store into the script.I want to be able to provide that with paramaters.

I have been looking at this:

Run ("C:Program FilesSteamsteam.exe -login") & $CmdLine[1]  $CmdLine[2]

But sometimes i get syntax errors sometimes expression errors. :(

Share this post


Link to post
Share on other sites
michaelslamet

Hi Michael,

Something like this should work:

Run ("C:\Program Files\Steam\steam.exe -login " & $CmdLine[1] & " " & $CmdLine[2])

 

Before that you might want a error checking like this:

If $CmdLine[0] <= 0                ; if there is no parameter given
    ; display help or exit
EndIf

Share this post


Link to post
Share on other sites
Michael10

Hey Michael,

Its working perfectly, thanks mate :thumbsup:

One last question though. How can i add another parameter to the Run line ?

Like this :

Run ("C:Program FilesSteamsteam.exe -login " & $CmdLine[1] & " " & $CmdLine[2] steam//validate/227100)
 
This is how it looks and works in cmd window :
 
C:Program FilesSteamsteam.exe -login user password steam//validate/227100
 
Regards
Michael
Edited by Michael10

Share this post


Link to post
Share on other sites
michaelslamet

Glad to help :)

This is what you want:

Run ("C:\Program Files\Steam\steam.exe -login " & $CmdLine[1] & " " & $CmdLine[2] & " steam//validate/227100")
 

Share this post


Link to post
Share on other sites
michaelslamet

So use & to combine a string, begin and end it with " or '

If it is a variable, do not use " or '

Share this post


Link to post
Share on other sites
Michael10

You Sir..saved my day. Thanks alot!!

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  

×