BATCH - 如何关闭重启?或保护关闭?

BATCH - how to on close restart? or protect closing?

public 中的自助服务终端启用了鼠标和触摸屏。

在 boot/login 上执行脚本,但在转到第 4 步之前,许多用户单击关闭图标并关闭命令提示符。

导致进程失败。

如何确保启动过程没有被中断?如何阻止在步骤 4 之前关闭命令提示符?

::================ Danger Start ===============
@echo on
:start

echo "1. Please dont click that close icon and close me. I beg..."
timeout 5 > nul
echo "2. Please dont click that close icon and close me. I beg..."
tskill chrome 2>NUL
echo "3. Please dont click that close icon and close me. I beg..."
tskill node 2>NUL
:: some other tasks: Bank card, Ticket, Badge, hardware get re-activated

::================ Danger END ===============



echo "4. Uff.. crossed my finger and finally started"
@start /wait "Kiosk" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" www.example.com

cls
echo "5. i will restart now."
timeout 5 >nul


goto start

不幸的是cmd 没有 noclose 功能。有独立工具的选项,但这意味着您必须为每台机器加载它。

最简单的方法是完全隐藏批处理文件。

创建 VBS 文件examplefilename.vbs

把这个放进去。

Set LoginScript    = CreateObject("WScript.Shell")
LoginScript.Run "f:\login.cmd", 0, False

只需更正 cmdbat 文件的路径和文件名即可。

然后运行要调用的vbs文件,完全隐藏cmd。

因此您将调用 vbs 文件而不是批处理文件,VBS 将依次调用批处理。