By accessing the website and accepting the Cookie Policy, you agree to use the cookies provided by the Site in accordance with to analyze traffic, remember your preferences, and optimize your experience.
开机启动bat以及隐藏运行窗口
2019-08-29 19:53:22    396    0    0
emengweb

1.开机启动bat
  新建test.bat, 文件内容如下:

  set ws=WScript.CreateObject("WScript.Shell") 
  ws.Run "D:\test.bat /start",0​

  保存,然后放到Windows启动目录下,就可以了。

2.隐藏运行窗口
  bat运行后一般会有一个黑色的命令窗口,那么如何隐藏呢?有两种方式:

   方法一:新建一个vbs文件,如hello.vbs,文件内容如下:

   Set ws = CreateObject("Wscript.Shell") 
   ws.run "cmd /c D:\CI_Slave\slave.bat",vbhide​

  保存,然后放到Windows启动目录下,就可以了。

 方法二:用文本文档打开bat文件,在开头处写入

   @echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
REM​

保存,然后放到Windows启动目录下,就可以了。

这个方法运行bat,还是会闪一下。

 

PS:Windows启动目录:

  WinXP: C:/Documents and Settings/Administrator/「开始」菜单/程序/启动

  Win7:   C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

 Win10: C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

 所有用户通用启动目录: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

上一篇: frp+TeamViewer 完美解决TeamViewer5分钟商业提醒

下一篇: debian9使用verysync微力同步方法

396 人读过
文档导航