Executing PowerShell Commands in Java Program

前端 未结 4 1753
醉梦人生
醉梦人生 2020-11-30 07:08

I have a PowerShell Command which I need to execute using Java program. Can somebody guide me how to do this?

My command is Get-ItemP

4条回答
  •  既然无缘
    2020-11-30 07:11

    You can use -ExecutionPolicy RemoteSigned in the command.

    String cmd = "cmd /c powershell -ExecutionPolicy RemoteSigned -noprofile -noninteractive C:\Users\File.ps1

提交回复
热议问题