I have two files one is batch file named validator.bat and another one is powershell script checker.ps1
validator.bat
@echo OFF
set/p "pass=>"
echo %pass%
The variable pass is to be assigned the value using powerhell script.
checker.ps1
$pwd1 = Read-Host "Enter your passowrd: "
$pwd2 = 'password'
if ($pwd1 -ceq $pwd2) {
Write-Host "matched"
} else {
Write-Host "differ"
}
I want to assign the output string "matched"/"differ" to the pass variable in bat file but using only powershell script or its code. I searched a lot on Google and Youtube but I could not Find the solution to my problem. Please help me.
set...it will only be seen by that session and sessions that are children of that session. can you do this all in one session?save to a fileidea may be your only hope.