如何将bat文件的输出保存到特定位置
我正在
C:\php\php.exe -f C:\leads\ftp.php
使用带有 Windows 计划任务的 bat 文件运行此命令,一切正常。 php 文件转到 ftp 并获取文件存储在本地。问题是文件本地存储的位置不在 C:\leads\ 目录中。它被保存在 C:\Windows\sysWOW64\
中,
如果我单击 bat 文件,它会按照预期将文件存储在 C:\leads\
目录中
。关于如何解决这个问题
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 on how to remedy this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加:
在
php.exe
命令之前 发生这种情况是因为无论批处理文件是从计划任务运行还是双击它运行,工作目录的设置都不同。这样你就可以强制 PHP 工作目录成为你想要的目录。Add:
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.