Skip to content

brad-jones/gopwsh

Repository files navigation

gopwsh

PkgGoDev GoReport GoLang .github/workflows/main.yml semantic-release Conventional Commits KeepAChangelog License

Package gopwsh is a simple host for PowerShell with-in your Go code.

Originally inspired by https://github.com/bhendo/go-powershell

Quick Start

go get -u github.com/brad-jones/gopwsh

package main

import (
	"fmt"

	"github.com/brad-jones/gopwsh"
)

func main() {
	shell := gopwsh.MustNew()
	defer shell.Exit()
	stdout, _, err := shell.Execute("Get-ComputerInfo")
	if err != nil {
		panic(err)
	}
	fmt.Println(stdout)
}

Also see further working examples under: https://github.com/brad-jones/gopwsh/tree/master/examples

Cross Platform Support

PowerShell these days of course is a cross platform shell, able to run on Windows, MacSO & Linux.

This go module should in theory work on all those platforms too.

But (at this stage) has not been tested anywhere apart from Windows. Who uses PowerShell outside of Windows... sorry thats short sighted & naive of me.

Eventually I'll get around to writing a full test suite but until then if you are one of these users & notice a bug, PRs are of course welcome :)

About

Host a powershell process inside your go app.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •