I have a batch file that ask the user for a variable line set /p asset=
. Im calling my powershell script like this
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%file.ps
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'";
Im wondering how i send powershell the variable 'asset' from my batch file.
Here is my .bat file content
@Echo off
cls
Color E
cls
@echo Enter asset below
set /p asset=
@echo.
@echo your asset is %asset%
@echo.
goto startusmt
:startusmt
@echo.
@echo executing psexec ...
@echo.
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%RemoteUSMT.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -file %PowerShellScriptPath% %asset%
psexec \\%asset% -u domain\username -p password cmd
goto EOF
:EOF
PAUSE