Jump to content

Make cmd window disapear?


Recommended Posts

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.

Link to comment
Share on other sites

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

:whistle:

Link to comment
Share on other sites

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.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...