开发者

How do I save the output of the bat file to a specific location

开发者 https://www.devze.com 2023-04-04 10:14 出处:网络
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. T

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.

0

精彩评论

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

关注公众号