[英]Folder Monitoring/Batch file execution
我試圖創建一個腳本來監視一個文件夾(一個Dropbox文件夾)。
當我需要關閉PC時,只需將文件拖放到Dropbox文件夾中即可。 該腳本將看到新文件,運行關閉批處理文件,然后在Dropbox文件夾中刪除該文件。
請幫助我實現這一點。
總結一下:
shutdown.bat
。 如果我正確理解了您的問題,則要將文件拖放到Dropbox文件夾中,這將觸發該批處理文件刪除該文件,然后調用關機批處理文件。
@echo off
cls
rem set these first before running the script
set pathtoDBfile=
set sdBatfile=
rem check if the file in the dropbox folder exists
if exist %pathtoDBfile% (
del /q %pathtoDBfile%
call:%sdBatfile%
}
您應該閱讀在后台運行批處理文件以監視文件夾的內容。 可能不是您想要的,但這是我能想到的最佳解決方案。
這些鏈接應該可以幫助您更多地解決問題:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.