如何通过腻子通过cmd执行命令时忽略错误

问题描述 投票:0回答:1

我想在获胜时使用.bat文件锁定我的Arch笔记本电脑。机。我批量写的:

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

并且remote.cmd包含:

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

效果很好!但是当我没有互联网连接时,就会出现错误:

“

当脚本无法执行命令时,我可以以某种方式忽略任何错误吗?

cmd putty
1个回答
0
投票

请勿使用PuTTY来自动执行命令。

使用Plink(PuTTY软件包的一部分)。它采用与PuTTY相同的参数。另外,您需要将-batch switch添加到-batch

skip any prompts that you may get

使用Plink,您甚至可以直接在其命令行上指定命令:

C:\some_path\plink.exe -batch -load "naptop@nick" -m C:\some_path\remote.cmd
© www.soinside.com 2019 - 2024. All rights reserved.