bmw74 Posted February 20, 2009 Share Posted February 20, 2009 Is there a way that I can compile a console (CUI) script, and at execution time, pass variables to be used in the script? For example:C:\Testscript.exe <machine> <username> <password>When this is entered, the script will take the values of <machine>, <username> and <password>, and use them inside the script for processing. I have looked around the forum but so far I haven't found what I need.Thanks you! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 20, 2009 Share Posted February 20, 2009 It's all inte the helpfile, check the page "Command Line Parameters", what you want to use is either $CmdLine or $CmdLineRaw .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
bmw74 Posted February 20, 2009 Author Share Posted February 20, 2009 It's all inte the helpfile, check the page "Command Line Parameters", what you want to use is either $CmdLine or $CmdLineRawAwesome... I looked for functions and macros, but didn't come across this special array in the help fileThanks for your help! Link to comment Share on other sites More sharing options...
bmw74 Posted February 20, 2009 Author Share Posted February 20, 2009 For anyone that is interested, here is how I implemented it: If $cmdline[0] <> 0 Then For $i = 1 To $cmdline[0] Switch $cmdline[$i] Case "-u" $username = $cmdline[$i+1] Case "-p" $password = $cmdline[$i+1] EndSwitch Next EndIf When you compile it, it will check for the following format: c:\<compiled_program.exe> -u <username> -p <password> Thanks for all the help! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now