Hi Jake, The code I posted is the runnable go program just missing the powershell script which is a separate file. Maybe I'm miss understanding? Is there something else I can provide to help you understand further?
On Tuesday, October 27, 2020 at 8:48:54 PM UTC+3 jake...@gmail.com wrote: > It might help if you posted an actual runnable program, that you have > personally run, and the full output. > > On Tuesday, October 27, 2020 at 1:26:53 PM UTC-4 mua...@gmail.com wrote: > >> Hi Marvin, >> >> If I add script.ps1 in double quotes and try to run, it tells me cmdName >> declared but no used. >> Yes, the script is named script.ps1. The script is not a variable. >> >> On Tuesday, October 27, 2020 at 8:22:14 PM UTC+3 Marvin Renich wrote: >> >>> * Uzair Ally <mua...@gmail.com> [201027 12:25]: >>> > Hi, >>> > >>> > I am getting the following error when I try to call a powershell >>> script >>> > from go. >>> > >>> > undefined: script >>> > >>> > Here is the code: >>> > >>> > cmdName := >>> "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" >>> > out, err := exec.Command("cmdName", script.ps1).Output() >>> >>> Perhaps you what you intended was: >>> out, err := exec.Command("cmdName", "script.ps1").Output() >>> >>> Is your script named script.ps1 or is script a variable with a field >>> named ps1 containing the name of the script? >>> >>> > if err != nil { >>> > fmt.Fprintln(os.Stderr, "Error creating StdoutPipe for Cmd", err) >>> > >>> > >>> > It looks like go doesn't recognize the powershell script. How do I >>> resolve >>> > this error? Any help or guidance will be appreciated. >>> >>> ...Marvin >>> >>> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/5600e16f-fd9d-41cf-bacc-e84c10cbcabbn%40googlegroups.com.