简体   繁体   English

在Windows命令提示符下键入命令不起作用

[英]Type command not working in Windows command prompt

Correct me if I'm wrong, but the type command is supposed to display the contents of a text file in the Windows command prompt. 如果我错了,请纠正我,但是type命令应该在Windows命令提示符下显示文本文件的内容。 But whenever I use the type command to display a text file, the output is only: 但是每当我使用type命令显示文本文件时,输出仅为:

Unable to initialize device PRN

The command used is: 使用的命令是:

type C:\Users\Matthew\Desktop\Hello.txt

I don't know why it's doing this and I can't seem to figure it out. 我不知道为什么要这么做,而且我似乎也无法弄清楚。 So if anyone could help me, it would be greatly appreciated. 因此,如果有人可以帮助我,将不胜感激。

You echoed a 'print' command response to your file. 您在文件中回显了“打印”命令响应。

Open it with Notepad to verify. 用记事本打开它进行验证。

Type is working (that's what's in the file). 类型有效(文件中就是这样)。

"Unable to initialize device PRN" is an odd error, you must be using an old version of Dos which is attempting to use a printer. “无法初始化设备PRN”是一个奇怪的错误,您必须使用尝试使用打印机的旧版Dos。

Which means you're either using the print command, or something you're trying to type is confusing the type command and returning an error. 这意味着您正在使用print命令,或者正在尝试键入的内容混淆了type命令并返回错误。

set /p text=<type C:\Users\Matthew\Desktop\Hello.txt
echo "%text%" && pause

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM