开发者

Windows Batch File - Clearing another batch file

开发者 https://www.devze.com 2023-03-20 08:39 出处:网络
quick explanation: I have a batch file converting a series of swfs to mp4s which are placed into the batch file via PHP fwrite. This is ran every hour on windows Task Scheduler. For example:

quick explanation:

I have a batch file converting a series of swfs to mp4s which are placed into the batch file via PHP fwrite. This is ran every hour on windows Task Scheduler. For example:

C:

cd "path\Moyea\SWF to Video SDK"
swf2videocmd "conversion_command_here"

cd "path\MySQL\bin"
mysql --host=hostip --user=user_name --password=hostpw--database=database_name --table=table --execute="UPDATE table SET processed=1 WHERE processID=44;"

This works fine, updates the SQL and runs the process. There can be as many conversions in one batch file as necessary, they're added dynamically on demand. Windows Task Scheduler runs the batch fine aswell.

I then have a secondary batch file which Task Scheduler runs at the same time - clear.bat. This clears the first one so the conversion job can start afresh with the new files next time:

D:
cd "path\youtube\"
nul >  swf2mp4.bat

It clears the first batch file fine, but returns a prompt saying Windows cannot access the specified device, path or file.

In windows Task Scheduler, it can't close this prompt so the task gets stuck running, meaning the next instance of the task (hourly) can't be run. I would make it automatically close each hour, but the conversion q开发者_StackOverflow社区ueue may be large. All I need to do is supress the error.


Replace

nul >  swf2mp4.bat

with

type nul > swf2mp4.bat

and it should work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消