Jump to content
Sign in to follow this  
scythetleppo

Make cmd window disapear?

Recommended Posts

scythetleppo

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.

Share this post


Link to post
Share on other sites
scythetleppo

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 by scythetleppo

Share this post


Link to post
Share on other sites
MHz

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:

Share this post


Link to post
Share on other sites
scythetleppo

hi, would that work with an unknown number of parameters, ranging from 0 to let's say 10?

how would it know? thanks

Share this post


Link to post
Share on other sites
MHz

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.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.