What would you like to achieve ?
It is possible to run ‘something’ from the Windows command line in a batch file or from within Powershel but to do the same as described in your example you then would have to access the REST API ( openHAB REST API | openHAB ) e.g. to get the items’s state and to set a new value.
But this answer may not match in case you would like to do something complete different.
More specifically, I’d like to run the script to turn on a smart plug when windows comes out of sleep (with a trigger in Task Scheduler), and turn it off when it goes into sleep. I know how to launch batch files with those triggers from Task Scheduler, but I don’t know how to get a batch file (or other) to run the script.
I’m not sure exactly what you mean by “to do the same”.
He’s saying the conventional way to do is not trying to run an openHAB script remotely.
There’s a very functional API you can use to command OH Items directly, or to trigger OH rules.