troubleshooting Question

filename creation in powershell script

Avatar of sam_2012
sam_2012 asked on
PowershellWindows Batch
3 Comments1 Solution20 ViewsLast Modified:
Hi Team,

I am new to power shell , I need to create a log file with the date and timestamp , below is the script used for that purpose , I am getting the error each time i ru n it .Any help is really appreciated

For /F "tokens=2-4 delims=/ " %%a in ('date /t') 
do (set  vardate=%%c%%a%%b)

For /F "tokens=1-2 delims=/:" %%a in ("%TIME%") 
do (set vartime=%%a%%b)

set vartime=%vartime: =0%

set logfile="ETLUPD_%vardate%_%vartime%"

Open in new window

Join our community to see this answer!
Unlock 1 Answer and 3 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 3 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