Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

readme.md

JPSE - Java PowerShell Executor

Build Status Maven Central Coverage Status license

API to easily execute PowerShell commands and scripts from Java.

Supported platforms

  • Windows

Example

Call PowerShell commands or scripts like this:

  PowerShellExecutor executor = PowerShellExecutor.instance();

  System.out.println("Execute command: ");
  String output = executor.execute("Write-Host Hello PowerShell!").getStandardOutput();
  System.out.println(" output = " + output);

  Map<String, String> arguments = Collections.singletonMap("name", "PowerShell");

  System.out.println("Execute script as file: ");
  output = executor.execute(Paths.get(".\\src\\test\\resources\\test.ps1"), arguments).getStandardOutput();
  System.out.println(" output = " + output);

  System.out.println("Execute script from classpath: ");
  output = executor.execute(PowerShellTestApplication.class.getResourceAsStream("/test.ps1"), arguments).getStandardOutput();
  System.out.println(" output = " + output);

Add dependency

To use jpse in your project you can add the dependecy from maven central to your software project management tool:

In Maven just add the following dependency to your pom.xml:

      <dependency>
        <groupId>com.github.frimtec</groupId>
        <artifactId>jpse</artifactId>
        <version>1.2.0</version>
      </dependency>

About

API to easily execute PowerShell commands and scripts from Java.

Topics

Resources

License

Packages

No packages published
You can’t perform that action at this time.