executeCommandLine to sleep other computer(s)

I am confused on how to use the executeCommandLine action.
The documentation makes it seem simple enough… https://github.com/openhab/openhab/wiki/Actions#other-actions

My goal is to use it to send a sleep command to other computer(s). I got a basic command to run like executeCommandLine(“nircmd.exe mutesysvolume 2”). That uses nircmd to toggle the mute.

I need to run something like this:
psexec \192.168.10.107 -u 192.168.10.107\openhab -p PASSWORD rundll32.exe powrprof.dll,SetSuspendState 0,1,0

The editor doesn’t like the \ character. Trying to run the rule anyway doesn’t have any result.
Anyone know how I can send the \ character or send a sleep command to another system another way?
Thanks!

The “” is treated as an escape character. Since you are on Windows and paths use “” you need to escape it by using two: “\”

Hey cool, good to know.
Now I don’t think I am doing the timeout part right as I get nothing back in the log at all. The rule is being run, I can tell from the log command right before. In one spot I need two slashes, would I add 4??

(the following line has 4 slashes before the IP, it just won’t paste that way in the forum)

executeCommandLine("psexec.exe \\\\192.168.10.107 -u 192.168.10.107\\openhab -p PASSWORD rundll32.exe powrprof.dll,SetSuspendState 0,1,0",15000)

I tried just the ,15000 to add wait time to catch any error.

Any thoughts on the silence in the logs on what happened? The remote computer does not sleep but I am not sure why. It does sleep when running the command manually from the OH machine.
Thanks for your help!

Yes.

You have to log it out yourself.

val results = executeCommandLine("command", 15000)
logInfo("test", results)

Thanks for your help, got it working. The last version probably would have worked but needed a longer timeout period to complete. Seeing the log start the command and never finished made it clear it just needed more time.
Thanks again!