import { powershell } from "https://deno.land/x/ayonli_jsext@v0.9.72/cli.ts";
Executes the script inside PowerShell as if they were typed at the PowerShell command prompt.
This function can also be called within Windows Subsystem for Linux to directly interact with PowerShell.
NOTE: This function is only available in Windows and Windows Subsystem for Linux.
Examples
Example 1
Example 1
import { powershell } from "@ayonli/jsext/cli";
const cmd = "ls";
const {
code,
stdout,
stderr,
} = await powershell(`Get-Command -Name ${cmd} | Select-Object -ExpandProperty Source`);
Returns
Promise<CommandResult>