如何将PHP参数传递到system32文件夹中的bat文件[复制]
问题描述:
This question already has an answer here:
I've created a bat file php "d:\Dropbox\sync.php"
Then I put this file into system32 folder to be able to call it anywhere in my system. sync.php
needs an argument.
When I enter some certain folder in explorer and type in cmd sync arg1
my script says it has no args, but it works if I do in the common way: call it directly without bat
.
</div>
此问题已经存在 这里有一个答案: p>
-
在Windows命令行中使用批处理文件中的参数
5 answers
span>
li>
ul>
div>
我创建了一个bat文件
php“d :\ Dropbox \ sync.php“ code>然后我把这个文件放到 system32 kbd>文件夹中,以便能够在我的系统中的任何地方调用它。
sync.php code>需要一个参数。 p>
当我在资源管理器中输入某个特定文件夹并输入cmd
sync arg1 code>时,我的脚本会说出来 没有args,但是如果我按照常用的方式工作:直接调用它而不需要
bat code>。 p> div>
答
You need to use %1
in the sync.bat file.
Just like this:
php "d:\Dropbox\sync.php" %1