批次檔 同時間只能執行一次
不小心誤點 該批次檔,也會自動關閉
=================================================================
@echo off
:init
set "started="
2>nul (
9>"%~f0.lock" (
set "started=1"
call :start
)
)
@if defined started (
del "%~f0.lock" >nul 2>nul
) else (
echo Process aborted: "%~f0" is already running
@ping localhost > nul
)
exit /b
:start
rem 要執行的工作 放在這邊
goto start
沒有留言:
張貼留言