How do I save the output of the bat file to a specific location
I am running this command
C:\php\php.exe -f C:\leads\ftp.php
with a bat file with a windows scheduled task and all works well. The php file goes to the ftp and grabs a file to store locally. The problem is the location that the file is being stored locally is not in the C:\leads\
directory. It is being saved in the C:\Windows\sysWOW64\
If I click on the bat file it stores the file in the C:\leads\
directory as expected
any ideas 开发者_如何学Goon how to remedy this
Add:
cd /d C:\leads\
before your php.exe
command. This is happening because the working directory is set differently whether your batch file is running from a scheduled task or from you double clicking on it. This way you can force the PHP working directory to be what you want.
精彩评论