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

All 2 Replies

Member Avatar for HTMLperson5

Why not try:

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

echo in batch is good for writing to files.

Member Avatar for HTMLperson5

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.