當我們要讓bat處理程序在后臺運行而不顯示doc窗口時,可以避免程序被誤關閉等情況的發生。下面以一個簡單的例子說明如何實現
新建一個bat處理文件,命名為timer.bat ,代碼如下:
代碼如下:
@echo off
:a
rem 取得當前時分值
set currenttime=%time:~0,2%%time:~3,2%
rem echo time:%currenttime%
rem 調用程序的腳本:j:\lanp\資治通鑒經典故事 高清晰pdf.pdf | start /b
if %currenttime%==1856 (shutdown /s /t 60)
goto :a
pause
新建一個vds文件,命名為autorun.vbs,代碼如下:
代碼如下:
set ws=wscript.createobject(wscript.shell)
ws.run j:\lanp\autorun\timer.bat /start,0
雙擊運行autorun.vbs,即可實現將timer.bat 在后臺執行了。