powershell command Line arguments get lost if directly running from CMD -


need help

example

working : c:\sdk>powershell testps1.ps1 a1 a2 a3

not working : c:\sdk>.\testps1.ps1 a1 a2 a3

in above examples both command runs script 2nd command running script without powershell prefix not capture argument in args .

powershell default app launcher ps1 extension .

script : testps1.ps1

--------------------------------------------

write-host "running script "

write-host $args

write-host "script completed!!"

--------------------------------------------

.\file open in default application. default supposed notepad.exe .ps1 files. class mapping .ps1 files has not been setup pass arguments. enabling potential security risk , not enabled default reason.

for how manually need in setting custom registry class .ps1 %1


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -