1

I want to lock my arch laptop using .bat file on my Windows machine.

I wrote this in my batch:

start C:\some_path\putty.exe -load "naptop@nick" -m C:\some_path\remote.cmd

And remote.cmd contains:

xfce4-session-logout --suspend;exit 0;

It works perfect! But when I don't have an internet connection, I have an error:

screen

Can I somehow ignore any errors when script can't execute my command?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

0

Do not use PuTTY for automating command execution.

Use Plink (part of PuTTY package). It takes the same arguments as PuTTY. Additionally you will want to add -batch switch to skip any prompts that you may get.

C:\some_path\plink.exe -batch -load "naptop@nick" -m C:\some_path\remote.cmd

With Plink you can even specify your command directly on its commandline:

C:\some_path\plink.exe -batch -load "naptop@nick" xfce4-session-logout --suspend;exit 0;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992