快捷导航
搜索
查看: 266|回复: 0

每10分钟检查"mcpos ooh"文件夹的mcpos是否启动

[复制链接]

111

主题

122

帖子

2754

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2754
发表于 2026-11-2 09:54:17 | 显示全部楼层 |阅读模式
在C:\mis 创建 check_mcpos_ooh.bat, 内容如下
  1. @echo off
  2. setlocal enabledelayedexpansion

  3. set "LOGDIR=C:\mis\mcpos ooh"
  4. if not exist "%LOGDIR%" mkdir "%LOGDIR%"

  5. for /f "delims=" %%d in ('powershell -Command "Get-Date -Format yyyyMMdd"') do set "TODAY=%%d"
  6. set "LOGFILE=%LOGDIR%\check_run_mcposooh_%TODAY%.log"

  7. forfiles /p "%LOGDIR%" /m "mcpos_*.log" /d -21 /c "cmd /c del /f @path" 2>nul

  8. powershell -Command "$p = Get-WmiObject Win32_Process | Where-Object {$*.Name -eq 'mcpos.exe' -and $*.ExecutablePath -like '*\mcpos ooh*'}; if($p){$p.ProcessId}else{0}" > "%temp%\pid.tmp"
  9. set /p PID=<"%temp%\pid.tmp"
  10. del "%temp%\pid.tmp"

  11. if %PID% GTR 0 (
  12. echo [%date% %time%] The process is normal, PID=%PID% >> "%LOGFILE%"
  13. ) else (
  14. echo [%date% %time%] No process detected, preparing to start. >> "%LOGFILE%"
  15. Start /MIN "" "C:\mis\mcpos ooh\mcpos - Shortcut.lnk"
  16. echo [%date% %time%] Startup command executed >> "%LOGFILE%"
  17. )
  18. endlocal
复制代码



在C:\mis 创建 silent.vbs, 内容如下
  1. Set sh = CreateObject("WScript.Shell")
  2. sh.Run "C:\mis\check_mcpos_ooh.bat",0
复制代码


在Windows计划任务添加新任务:
  • 如图设置:
  • 创建新任务, 名称: [check mcpos in ooh],  启用[Run with highest privleges],   启用[Hidden]
  • 在Triggers页面, 添加新内容, 设置[At log on],  [Delay task for 1 min],  [Repeat task every 10min], [Indefinitely]
  • 在Actives页面, 添加Start a program, Program/script: 填 [wscript.exe], 在add arguments添加 ["C:\mis\silent.vbs"], 在start in 添加[C:\mis\]
3.jpg
1.jpg
2.jpg


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|ADS

GMT-6, 2026-11-22 06:58 , Processed in 0.072033 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表