Reputation: 1601
I have a powershell command running when I execute a bat file, The command is
@powershell -command " [long]((date) . touniversaltime() - [datetime]' 1970-01-01 '). totalmilliseconds"
I have also used
powershell.exe " [long]((date). touniversaltime () -[datetime]'1970-01-01 ') . totalmilliseconds "
This returns the correct data to the screen but my question is how do I save this value and use it to attach it to a filename.
Thanking You
Upvotes: 2
Views: 427
Reputation: 354774
for /f %%x in ('powershell "[long]((date).touniversaltime()-[datetime]'1970-01-01').totalmilliseconds"') do set ms=%%x
rem do whatever you want with %ms%
I vaguely remembered the code from an earlier answer of mine. My advice from earlier still stands: Just write your script in PowerShell instead of creating a weird hybrid that's just twice as hard to maintain.
Upvotes: 3