Invoking a PowerShell script from Python

后端 未结 2 697
遥遥无期
遥遥无期 2020-12-09 10:28

I\'m trying to start a PowerShell script from python like this:

psxmlgen = subprocess.Popen([r\'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.ex         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 10:42

    For those of us who wanted to know how to display the values of arg1, arg2 and arg3 after it was passed to powershell, all you need to do is:

    Write-Host $args[0]
    Write-Host $args[1]
    Write-Host $args[2]
    

提交回复
热议问题