scythetleppo Posted July 24, 2007 Posted July 24, 2007 I have a bunch of batch files with different content and I was wondering if there's a way to make an autoit program which does this, accepts parameters such as mycommand parameter1 parameter2 parameter3 parameter4 and then does this: paramater1 would be the batch file name, and the rest of the parameters would be for the batch file. so mycommand sharedrive.bat O would execute this batch file which was already there: net use %1: /delete net use %1: \\sr2400-6\main\shares\payroll (for example)... and also, doesn't allow the black command window to come up when it is executing. in this way I would have an autoit command which basically runs a batch file for you, and doesn't make a black box open up on client computers when a batch needs to be written.
James Posted July 24, 2007 Posted July 24, 2007 Use @SW_HIDE Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
scythetleppo Posted July 24, 2007 Author Posted July 24, 2007 (edited) ok I'll look into how to do that... how do you accept parameters in autoit? like mycommand.exe /switch -option blah etc? nvm I think I found it. Edited July 24, 2007 by scythetleppo
MHz Posted July 24, 2007 Posted July 24, 2007 Like this untested creation: If $CMDLINE[0] Then If FileExists($CMDLINE[1]) Then $file = $CMDLINE[1] For $i = 2 To $CMDLINE[0] $parameters &= ' "' & $CMDLINE[$i] & '"' Next RunWait('"' & $file & '"' & $parameters, '', @SW_HIDE) Else MsgBox(0x40030, '', 'File does not exist') EndIf EndIf
scythetleppo Posted July 24, 2007 Author Posted July 24, 2007 hi, would that work with an unknown number of parameters, ranging from 0 to let's say 10? how would it know? thanks
MHz Posted July 24, 2007 Posted July 24, 2007 hi, would that work with an unknown number of parameters, ranging from 0 to let's say 10? how would it know? thanks$CMDLINE[0] store the amount of parameters and the limit is something like 64 or so.
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