Batch File...please help!!

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2008
Posts: 58
Reputation: besktrap is an unknown quantity at this point 
Solved Threads: 1
besktrap's Avatar
besktrap besktrap is offline Offline
Junior Poster in Training

Batch File...please help!!

 
0
  #1
Aug 9th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Batch File...please help!!

 
0
  #2
Aug 10th, 2008
Filenames with spaces need quotes
TYPE "C:\Documents and Settings\Owner\My Documents\Log.txt"
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 58
Reputation: besktrap is an unknown quantity at this point 
Solved Threads: 1
besktrap's Avatar
besktrap besktrap is offline Offline
Junior Poster in Training

Re: Batch File...please help!!

 
0
  #3
Aug 10th, 2008
Thanks!! I really needed this!
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 4
Reputation: mrsjpvan2 is an unknown quantity at this point 
Solved Threads: 0
mrsjpvan2 mrsjpvan2 is offline Offline
Newbie Poster

Re: Batch File...please help!!

 
0
  #4
Aug 17th, 2008
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



Originally Posted by besktrap View 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?
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 4
Reputation: mrsjpvan2 is an unknown quantity at this point 
Solved Threads: 0
mrsjpvan2 mrsjpvan2 is offline Offline
Newbie Poster

Re: Batch File...please help!!

 
0
  #5
Aug 17th, 2008
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



Originally Posted by besktrap View 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?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 36
Reputation: mittelgeek is an unknown quantity at this point 
Solved Threads: 0
mittelgeek's Avatar
mittelgeek mittelgeek is offline Offline
Light Poster

Re: Batch File...please help!!

 
0
  #6
Sep 3rd, 2008
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...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC