Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Run a completly hidden batch file

How do I execute batch files at startup so that I won't see the cmd like black window. I have this batch file which I use to attach vhd file on startup:

  @echo off
SET TEMPFILE="%TEMP%\%RANDOM%.TXT"
echo SELECT VDISK FILE=X:\sap.vhd >%TEMPFILE%
echo ATTACH VDISK>>%TEMPFILE%
DISKPART /s %TEMPFILE%
del %TEMPFILE%

Is there anything I could do to make the execution invisible?

share|improve this question
add comment

marked as duplicate by Sathya, Diago Jan 5 '11 at 18:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

One way you could achieve this easily is through VBS.

Create a VBS with the following content:

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Now you can run wscript "[vbspath]" "[batchfile]" to execute it silently.

share|improve this answer
    
what do I do with it?do I need to place it on the task scheduler, how am I supposed to call wscript.exe on startup together with the arguments that you supplied –  Ieyasu Sawada Jan 5 '11 at 14:47
    
There is an option for "Add arguments" in the "New action" window when adding an action. –  Matthieu Cartier Jan 5 '11 at 14:51
    
I note that those newbies who want to get their feet wet using Visual Basic can try the 'express' version visualbasic.about.com/od/learnvbnet/a/LVBE_L1.htm –  Rolnik Jan 5 '11 at 15:40
    
Windows has native interpretation of VBS, and has had for a long time... –  Matthieu Cartier Jan 5 '11 at 15:59
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.