Hi everyone! I am making a simple chat program in batch (it doesn't use the net send command). It consist of a main DOS window that you chat with called PM, a .txt file called Log that stores what you say, and a DOS window called PM LOG that prints on the screen what is in the Log.txt file (so you don't have to keep opening it). So, my problem is that whenever I use the TYPE command, I can't specify the location. But if I just say TYPE Log.txt, it will print out Log.txt thats in the folder that PM Log.bat is in. For example PM Log.bat:

some script here..blah blah
TYPE C:\Documents and Settings\Owner\My Documents\Log.txt

then I get this error:

Access is denied.
Error occurred while processing: C:\Documents.
The system cannot find the file specified.
Error occurred while processing: and.
The system cannot find the path specified.


So, does anyone know how to use the type command with a specified location?

Recommended Answers

All 5 Replies

Filenames with spaces need quotes TYPE [B]"[/B]C:\Documents and Settings\Owner\My Documents\Log.txt[B]"[/B]

Thanks!! I really needed this!

I think the problem is that DOS directory and file names cannot be longer than 8 characters. Try this:

TYPE C:\Docume~1\Owner\MyDocu~3\Log.txt

Regards,

mrsjpvan2


Hi everyone! I am making a simple chat program in batch (it doesn't use the net send command). It consist of a main DOS window that you chat with called PM, a .txt file called Log that stores what you say, and a DOS window called PM LOG that prints on the screen what is in the Log.txt file (so you don't have to keep opening it). So, my problem is that whenever I use the TYPE command, I can't specify the location. But if I just say TYPE Log.txt, it will print out Log.txt thats in the folder that PM Log.bat is in. For example PM Log.bat:

some script here..blah blah
TYPE C:\Documents and Settings\Owner\My Documents\Log.txt

then I get this error:

Access is denied.
Error occurred while processing: C:\Documents.
The system cannot find the file specified.
Error occurred while processing: and.
The system cannot find the path specified.


So, does anyone know how to use the type command with a specified location?

Sorry - Noticed a typo - use "~1" to replace all characters in the path - like this:

TYPE C:\Docume~1\Owner\MyDocu~1\Log.txt

This will work much better.

mrsjpvan2

I think the problem is that DOS directory and file names cannot be longer than 8 characters. Try this:

TYPE C:\Docume~1\Owner\MyDocu~3\Log.txt

Regards,

mrsjpvan2


Hi everyone! I am making a simple chat program in batch (it doesn't use the net send command). It consist of a main DOS window that you chat with called PM, a .txt file called Log that stores what you say, and a DOS window called PM LOG that prints on the screen what is in the Log.txt file (so you don't have to keep opening it). So, my problem is that whenever I use the TYPE command, I can't specify the location. But if I just say TYPE Log.txt, it will print out Log.txt thats in the folder that PM Log.bat is in. For example PM Log.bat:

some script here..blah blah
TYPE C:\Documents and Settings\Owner\My Documents\Log.txt

then I get this error:

Access is denied.
Error occurred while processing: C:\Documents.
The system cannot find the file specified.
Error occurred while processing: and.
The system cannot find the path specified.


So, does anyone know how to use the type command with a specified location?

Yeah you need quotes around file/directories that need quotes.

If you want to find out what the DOS 8.3 filename is use dir /x [i]SOMEDIRNAME[/i] or dir /x [i]SOMEFILENAME[/i] etc...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.