简体   繁体   中英

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. But whenever I use the type command to display a text file, the output is only:

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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