Blink1Control2 icon indicating copy to clipboard operation
Blink1Control2 copied to clipboard

Windows: cannot use PowerShell scripts as Script event source?

Open todbot opened this issue 7 years ago • 3 comments

It seems like I cannot. Need to investigate. The error is "spawn UNKNOWN" in the event status.

todbot avatar Apr 18 '18 21:04 todbot

See: https://stackoverflow.com/questions/10179114/execute-powershell-script-from-node-js

todbot avatar Apr 18 '18 21:04 todbot

Also, scripts should perhaps be 'cwd'd to the directory the script is in.

todbot avatar Apr 18 '18 21:04 todbot

One workaround is to create a CMD batch file and use:

for /f %%i in ('powershell -File %~dp0\lockstate-get.ps1') do set lockstate=%%i

To get the output of a Powershell script into a CMD batch file variable. For more details see: https://github.com/todbot/blink1/blob/master/windows/scripts/lockstate-get.ps1 https://github.com/todbot/blink1/blob/master/windows/scripts/lockstate-test.bat

todbot avatar Apr 18 '18 22:04 todbot