-
Notifications
You must be signed in to change notification settings - Fork 3
Home
PowerJS is a versatile JavaScript library that seamlessly integrates PowerShell capabilities into your applications. Execute PowerShell commands, interact with DLLs, and create powerful applications effortlessly. Empower your JavaScript projects with the magic of PowerShell, simplifying automation and enhancing functionality.
In this page we will every step to a successful and working installation of powerjs.
Getting started with PowerJS is quick and straightforward. You can install it via npm:
npm install obaydmerz/powerjs
PowerShell can be running behind some names like: pwsh
and powershell
.
So try to figure the one that you will use with this library.
To check if a powershell installation is working, type:
pwsh -Command $PSVersionTable
Feel free to replace pwsh with the one you want.
What if you want to use different names than pwsh
and powershell
?
First you have to check the validity of the installation using the command above, then grab that path/name and remember it. You can put it into env variables and use it's name with/without file extension.
Or you should include it's full ( absolute ) path.
Then, add it in:
import { PowerJS } from 'powerjs';
const myWorkingInstance = new PowerJS({
additionalShellNames: ["c:/path/to/working/shell", "myPowershell.exe", ""] // <- Here
});
Q: Do i need to build any files and use node-gyp? A: PowerJS doesn't include any native files that you can worry about 😅
Q: Can PowerJS be included in packaged apps? ( using nexe
and pkg
)
A: Because the library is written in 100% pure javascript and it doesn't require any additional dependencies, it should be able to be used in any way.