powershell assign command output to variable code example
Example 1: powershell set environment variable
# Windows PowerShell
PS C:\> $env:VAR_NAME="VALUE"
Example 2: how to assign a value to a variable in batch script using powershell
@echo OFF
for /f %%a in ('powershell -file script.ps1') do set "pass=%%~a"
echo %pass%