profesorfalken / jPowerShell

Simple Java API to interact with PowerShell console
Apache License 2.0
218 stars 84 forks source link

executeScript method is not working inside the Program Files #23

Open xmubeen opened 7 years ago

xmubeen commented 7 years ago

I am trying to execute the powershell script which is deployed as web application at C:\Program Files\Apache Software Foundation\Tomcat 7.0, when I look at the source code of it creates the temporary file and when file path have space it is not working.

Hope to get a fix quickly

profesorfalken commented 7 years ago

Hello,

Could you detail your issue and add an example of your call? jPowerShell just performs a "new File()" in order to copy to tmp. If the "new File()" works with your path, it should work in jPowerShell.

bragustin commented 6 years ago

Hello Prof, I tried executing a PS script line below: PowerShellResponse response = powerShell.configuration(config).executeScript("f:/_d/project/training/JAVA_HTP/src/mServ.ps1 ZTime stop");

And it can not seem to locate the Powershell script: Script output:Wrong script path: f:_d\project\training\JAVA_HTP\src\mServ.ps1 ZTime stop

mServ.ps1 is existing in the specified directory.

How can this be fixed?

Your help is much appreciated.

Regards, brag

LouieGreen commented 6 years ago

@bragustin The issue with your command are the arguments after the script path

ZTime stop

These go after like so:

PowerShellResponse response = powerShell.configuration(config).executeScript("F:/_d/project/training/JAVA_HTP/src/mServ.ps1", "ZTime stop");