kor Posted April 10, 2010 Share Posted April 10, 2010 I'm not sure how to accomplish this or even what commands I should be looking at. I am wanting to pass switches to my script when executing it, and have my script interrupt those switches and do different things depending on what the switches are. IE: script.exe /e How do I tell the script to accept that /e, and how do I get the script to use that /e to do something? Basically what I want is that switch to be a drive letter, so if the switch is /e, then it would be Drive E:, but if the switch is /F, then it would be drive F: Link to comment Share on other sites More sharing options...
BugFix Posted April 10, 2010 Share Posted April 10, 2010 Type in in SciTe: cmdlineselect and then hit space. Now you get an example for this. Or use help with keyword "Command Line Parameters". Best Regards BugFix Link to comment Share on other sites More sharing options...
kor Posted April 10, 2010 Author Share Posted April 10, 2010 (edited) My code: Global $drive = "" ReadParameters() MsgBox(0, "Drive is", $drive) Func ReadParameters() For $i = 1 to $CmdLine[0] Select Case $CmdLine[$i] = "/d" If $i == $CmdLine[0] Then Error() If StringLeft($cmdline[$i+1], 1) == "/" Then Error() Else $drive = StringStripWS($CmdLine[$i + 1], 3) EndIf EndSelect Next If $drive == "" Then Error() EndIf EndFunc Func Error() MsgBox(0, "Error", "Invalid Parameters") Exit EndFunc Simplified from: http://motersho.com/blog/index.php/2009/10/20/autoit-command-line-parameters-a-new-approach/ Edited April 10, 2010 by kor 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