问题描述
当我在机器上运行以下命令(或其中包含管道的任何命令)时:
When I run the following command (or any command with a pipe | in it) on my machine:
我收到以下消息:
运行dir命令或findstr命令本身有效
Running dir command or findstr command by themselves works just fine.
卷标为:
版本为:
推荐答案
如@dbenham所述,您需要确保COMSPEC变量定义了正确的值。
As previously mentioned by @dbenham You need to make sure your COMSPEC variable has correct values defined.
应具有以下值:
%SystemRoot%\system32\cmd.exe
您可以通过右键单击我的电脑->属性->高级系统属性来进行检查ies->环境变量
You can check it by Right Clicking My Computer-->Properties--->Advanced System Properties-->Environment Variables
如果在那里找不到COMSPEC,请通过提供上述值创建新变量,即%SystemRoot% \system32\cmd.exe
If You don't find COMSPEC there, create a new variable by giving the above mentioned value i.e. %SystemRoot%\system32\cmd.exe
祝你好运
这篇关于使用管道时,“文件名,目录名或卷标签语法不正确。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!