943,864 Members | Top Members by Rank

Ad:
Aug 9th, 2008
0

Batch File...please help!!

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
besktrap is offline Offline
58 posts
since Jul 2008
Aug 10th, 2008
0

Re: Batch File...please help!!

Filenames with spaces need quotes
TYPE "C:\Documents and Settings\Owner\My Documents\Log.txt"
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 10th, 2008
0

Re: Batch File...please help!!

Thanks!! I really needed this!
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
besktrap is offline Offline
58 posts
since Jul 2008
Aug 17th, 2008
0

Re: Batch File...please help!!

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



Click to Expand / Collapse  Quote originally posted by besktrap ...
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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mrsjpvan2 is offline Offline
4 posts
since Aug 2008
Aug 17th, 2008
0

Re: Batch File...please help!!

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



Click to Expand / Collapse  Quote originally posted by besktrap ...
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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mrsjpvan2 is offline Offline
4 posts
since Aug 2008
Sep 3rd, 2008
0

Re: Batch File...please help!!

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 SOMEDIRNAME or dir /x SOMEFILENAME etc...
Reputation Points: 10
Solved Threads: 0
Light Poster
mittelgeek is offline Offline
37 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: Trying to show SQL query results in Excel sheet
Next Thread in Legacy and Other Languages Forum Timeline: Echo >> problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC