troubleshooting Question

Batch file variable name for redirection

Avatar of JohnSantaFe
JohnSantaFe asked on
Windows BatchMicrosoft DOS
6 Comments1 Solution869 ViewsLast Modified:
I'd like to use a variable for a log file that I'm redirecting output to.


set log_file = C:\temp\mylog.txt
echo Batch is in work >> %log_file%
exit

I get a syntax error using this approach.

How can I use a variable name for the redirection?

Thanks.
ASKER CERTIFIED SOLUTION
MikeQc

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros