Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/cli.ts>powershell

A JavaScript extension package for building strong and modern applications.
Latest
function powershell
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

import { powershell } from "@ayonli/jsext/cli";

const cmd = "ls";
const {
    code,
    stdout,
    stderr,
} = await powershell(`Get-Command -Name ${cmd} | Select-Object -ExpandProperty Source`);

Parameters

script: string

Returns

Promise<CommandResult>