I got a code in vbs that i need to convert to powershell scrpit. WScript.Argument.item(n) in VBS script can be written as ?. how this can be written in powershell script.
CodePudding user response:
Powershell uses the automatic variable $args
# in vbs:
cscript script.vbs arg1 arg2
# returns arg1
WScript.Argument.item(0)
# in powershell:
powershell script.ps1 arg1 arg2
# returns arg1
$args[0]