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

Echo >> problem

 
0
  #1
Aug 9th, 2008
Sorry about the second thread, I forgot to include this on my first one.
Anyways, is it possible for someone to use the "echo %text here% >> %location of file here%" command to save some text to a file in a different folder? I did it, but got a message saying "access denied". I say someone do it with this code:

echo %finalmsg% >> \\BAS-307-15\mikchat\public.txt

But when I do it, for example:

echo %text% >> C:\Documents and Settings\Owner\Desktop\log.txt

It doesn't work! Anyone know whats going on?
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: Echo >> problem

 
0
  #2
Sep 3rd, 2008
Well the problem with using echo %text% >> C:\Documents and Settings\Owner\Desktop\log.txt is that the C:\Documents and Settings\Owner\Desktop\log.txt needs to be in quotes.

I would recommend that you use variables because you can define them at the top of the your code and change their value all throughout the code by simply changing them in one place, e.g.,:

set TEXT="Some Text"
set MYLOG="C:\Documents and Settings\%USERNAME%\Desktop\log.txt"

:: Or your can use this method as well
::
:: set MYLOG="%USERPROFILE%\Desktop\log.txt"
::
:: That is the way that I setup a poorman's alias/macro
:: list for my CMD Sessions. That way each user on the
:: computer will have their own set of aliases/macros.

echo "%text%" >> "%mylog%"

type "%mylog%"

Using that method, all you have to do is make the change in the variable at the top and it is modified all throughout the program.
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC