I refer to this question ASSIGN output XP command line output to a variable
I am trying to use it on a powershell code segment so I printed
powershell date (get-date).AddDays(-1) -format yyyyMMdd
and confirm it as
20100601
but if i tried
for /f "tokens=*" %a in ('powershell date get-date -format yyyyMMdd ') do set var=%a
then he did not work properly. How can I transfer the date to a variable?
source share