[英]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.