开发者

Batch File Console

How Can I hide the console of 开发者_开发知识库a running batch file the batch is running from a cmd or start>run


You can try a couple of things:

Schedule it with a user other than you.

or

CMD /C START /MIN your.CMD

or

This WSH/VBScript will run your batch file in a hidden window:

'MyCmd.vbs
Set WshShell = WScript.CreateObject("WScript.Shell")
cmd = "C:\bin\scripts\MyCmd.cmd"
Return = WshShell.Run(cmd, 0, True)
set WshShell = Nothing


At the start of your batch file add these lines.

@echo off
if not defined PIL (
    set PIL=1
    start /min "" %~0
    exit /b
)

Replace the rest of your batch here

If PIL is not defined in your batch file then the batch file will restart itself minimized. If PIL is defined in your environment then change it to something else. This will restart the batch file with PIL defined as 1 and since PIL is defined it will skip the restarting section after the file has been restarted.


make a shortcut to the batch then right click and select properties now under the general tab there will be a run option click the arrow beside it and select minimized now click apply and ok now start the program and it will run in the background.

hope i helped you this is pretty much guaranteed to work on any bat file.


I use this software to code .exe apps and it has a command that can do this. The name of the software is Advanced Bat to Exe Converter but it doesn't only convert, you can code and compile them too. Try this coding once you download the program from here, this should also work with other exe compilers, but I am not sure.

@echo off
:menu
cls
color 9e
rem ChangeColor 14 0
rem ChangeColor 14 9
rem PrintBoxAt 6 11 15 60 1
rem PrintBoxAt 11 21 5 40 1
rem printcenter Enter window title: 13 14 9
rem getinput
set w=%result%
rem hidewindow "%w%"
goto menu
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜