when trying to output the string of a variable to a text file, the string try's to run and therefore pops up like this,

%localDrive% 2>>fileCompare.log

'C:\' is not recognized as an internal or external command,
operable program or batch file.

Any ideas?

Recommended Answers

Why not try:

C:/> echo %localDrive% 2>fileCompare.log

echo in batch is good for writing to files.

Jump to Post

All 2 Replies

Member Avatar

Why not try:

C:/> echo %localDrive% 2>fileCompare.log

echo in batch is good for writing to files.

Member Avatar

Sorry, I realized that does not work at times....

Try executing: echo %localDrive%>fileCompare.log and it should work perfectly

Be a part of the DaniWeb community

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