powershell assign values from command to variable code example
Example 1: 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%
Example 2: set variable in powershell
Set-Variable -Name "desc" -Value "A description"
Get-Variable -Name "desc"
Name Value
---- -----
desc A description