mercoledì 6 febbraio 2019

Eseguire un comando Powershell da file batch e catturare l'output

FOR /F "tokens=* USEBACKQ" %%F IN (`powershell.exe -noninteractive -command [datetime]::now.tostring^('yyyy-MM-dd_HH-mm-ss'^)`) DO (
    SET $RetValue=%%F
)

set mydatetime1=%$RetValue%

echo %mydatetime1%


;-)

Nessun commento: