gpt4 book ai didi

command-line - 如何将包含启动命令的 *.cmd 文件的输出重定向到文件?

转载 作者:行者123 更新时间:2023-12-04 18:22:40 25 4
gpt4 key购买 nike

如果我把这个命令放在控制台上:

start /b /belownormal /wait php.exe script.php > output.txt

一切顺利,但是如果我输入相同的命令但没有重定向到 *.cmd 文件,然后对该文件进行重定向:

所以文件 myscript.cmd 如下:
start /b /belownormal /wait php.exe script.php

我有问题的命令是:
myscript.cmd > output.txt

正在创建 output.txt 但为空。
有没有其他方法可以以“低于正常”优先级运行任何命令行应用程序并能够将输出重定向到文件?

(当然这与 php 无关。任何命令都有这个效果,即使是简单的回显。)

最佳答案

也许这个技巧可以解决你的问题。 myscript.cmd:

start /b /belownormal /wait php.exe script.php %~1

并这样称呼它:
myscript.cmd "> output.txt"

关于command-line - 如何将包含启动命令的 *.cmd 文件的输出重定向到文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10335524/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com