如果您需要在bat环境中使用此值,请使用bat:
bat
@echo off for /f "delims=" %%a in ('powershell .\test.ps1') do Set "$Value=%%a" Echo Value received from Powershell : %$Value%