In batch, passed arguments can be used with %1, and onward counting. Lets say I have the following "batch.bat" script:
@ echo off
echo %1
pause>nul
If i call this from cmd like: call batch.bat hello
it would output "hello" in the console.
Is there any variable in ps which does the same thing?
EDIT
I've found the folliwing, but it seems kind of unnatural.
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
Is there something more elegant perhaps?