使用管道时,“文件名,目录名或卷标签语法不正确。” [英] When using pipe getting "The filename, directory name, or volume label syntax is incorrect."

查看:124
本文介绍了使用管道时,“文件名,目录名或卷标签语法不正确。”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在机器上运行以下命令(或其中包含管道的任何命令)时:

When I run the following command (or any command with a pipe | in it) on my machine:


dir | findstr Directory

dir | findstr "Directory"

我收到以下消息:


文件名,目录名或卷标语法不正确。

The filename, directory name, or volume label syntax is incorrect.

运行dir命令或findstr命令本身有效

Running dir command or findstr command by themselves works just fine.

卷标为:


vol

驱动器C中的卷为OSDisk

卷序列号为685C-A5B5

vol
Volume in drive C is OSDisk
Volume Serial Number is 685C-A5B5

版本为:


ver

Microsoft Windows [版本6.1.7601]

ver
Microsoft Windows [Version 6.1.7601]


推荐答案

如@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

祝你好运

这篇关于使用管道时,“文件名,目录名或卷标签语法不正确。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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