从批处理文件并运行脚本改变当前的工作目录 [英] Change current working directory from batch file and run script

查看:835
本文介绍了从批处理文件并运行脚本改变当前的工作目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 8中:我有需要从通过​​.bat文件计划任务运行PHP文件。
在PHP是位于:病人:\\ PHP \\的php.exe
运行该文件位于: W:\\文件夹\\ file.php

In Windows 8: I have a php file which needs to be run from the scheduled tasks through .bat file. The PHP is located in: P:\php\php.exe The file to run is located in: W:\folder\file.php

我.bat文件是这样的:

my .bat file looks like this:

cmd /c p:\php\php.exe w:\folder\file.php

它不运行。当我打开cmd并切换到文件夹,并从那里运行它,该文件正确执行。

It does not run. When I open cmd and switch to the file folder and run it from there, the file executes properly.

即: W:\\文件夹>电话号码:\\ PHP \\ php.exe的W:\\文件夹\\ file.php

我要的东西添加到导航到该W .bat文件:\\文件夹,并以同样的方式执行,但我想不出什么。我试过其他职位(回复)即:
<一href=\"http://stackoverflow.com/questions/5138507/how-to-change-current-working-directory-using-a-batch-file\">How使用批处理文件改变当前的工作目录

I have to add something to the .bat file which navigates to this w:\folder and executes it in the same manner but I cannot figure out what. I tried other posts (replies) i.e.: How to change current working directory using a batch file

但它没有采取任何影响。谁能帮我写正确的命令为.bat文件吗?

but it did not take any effect. Can anyone help me to write the correct command for the .bat file please ?

推荐答案

您可以试试这个:

start "" /d "w:\folder" /b "p:\php\php.exe" file.php

这篇关于从批处理文件并运行脚本改变当前的工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆