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?

Well the problem with using echo %text% >> [i]C:\Documents and Settings\Owner\Desktop\log.txt[/i] 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.

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.