标题: [系统相关] [已解决]xp系统,bat批处理:自动判断某个时间段,自动关机。为啥有时关不了机呢? [打印本页]
作者: ygqiang 时间: 2014-11-25 22:01 标题: [已解决]xp系统,bat批处理:自动判断某个时间段,自动关机。为啥有时关不了机呢?
本帖最后由 ygqiang 于 2014-11-26 23:58 编辑
[已解决]xp系统,bat批处理:自动判断某个时间段,自动关机。为啥有时关不了机呢?
屏幕上只有鼠标指针能动,桌面啥的都没有了。- @echo off
- if "%1" == "h" goto begin
- mshta vbscript:createobject("wscript.shell").run("%~fs0 h",0)(window.close)&&exit
- :begin
- rem 下边开始写批处代码了
-
- ping 127.0.0.1 -n 30 >nul 2>nul
-
- sc config schedule start= demand
- net start schedule
-
-
- ——————————————————————————————————————————————————————
- 先用tasklist 输入进程列表给find ,让find找出exe进程,如果找到,就goto跳转。找不到就执行下面的操作
- tasklist|find /i "软件1.EXE" &&goto :first2
-
- 先用tasklist 输入进程列表给find ,让find找出EXE进程,如果找到,那执行下面的操作。找不到就goto
- tasklist|find /i "软件2.EXE" ||goto :first3
-
-
-
- ——————————————————————————————————————————————————————
- :first1
-
- set "t=%time: =0%"
- if "%t:~,5%" geq "12:20" if "%t:~,5%" leq "12:25" goto :first11
- if "%t:~,5%" geq "21:50" if "%t:~,5%" leq "21:55" goto :first11
- ping 127.0.0.1 -n 40 >nul 2>nul
- goto :first1
-
-
- :first11
- taskkill /f /im 软件2.EXE
- taskkill /f /im AutoRedrCard.EXE
- ping 127.0.0.1 -n 5 >nul 2>nul
- shutdown -s -f -t 5
-
-
- ——————————————————————————————————————————————————————
- :first2
-
- set "t=%time: =0%"
- if "%t:~,5%" geq "21:50" if "%t:~,5%" leq "21:55" goto :first21
- ping 127.0.0.1 -n 40 >nul 2>nul
- goto :first2
-
-
- :first21
- taskkill /f /im 软件1.EXE
- taskkill /f /im AutoRedrCard.EXE
- ping 127.0.0.1 -n 5 >nul 2>nul
- shutdown -s -f -t 5
-
-
- ——————————————————————————————————————————————————————
- :first3
-
- set "t=%time: =0%"
- if "%t:~,5%" geq "21:10" if "%t:~,5%" leq "21:15" goto :first31
- ping 127.0.0.1 -n 40 >nul 2>nul
- goto :first3
-
-
- :first31
- ping 127.0.0.1 -n 5 >nul 2>nul
- shutdown -s -f -t 5
复制代码
作者: ygqiang 时间: 2014-11-26 23:58
已解决!!!!- @echo off
- if "%1" == "h" goto begin
- mshta vbscript:createobject("wscript.shell").run("%~fs0 h",0)(window.close)&&exit
- :begin
- rem 下边开始写批处代码了
-
- ping 127.0.0.1 -n 30 >nul 2>nul
-
- sc config schedule start= demand
- net start schedule
-
-
- ——————————————————————————————————————————————————————
- :first
- ping 127.0.0.1 -n 40 >nul 2>nul
- 先用tasklist 输入进程列表给find ,让find找出exe进程,如果找到,就goto跳转。找不到就执行下面的操作
- tasklist|find /i "软件1.EXE" &&goto :first2
-
- 先用tasklist 输入进程列表给find ,让find找出EXE进程,如果找到,那执行下面的操作。找不到就goto
- tasklist|find /i "软件2.EXE" ||goto :first3
-
-
-
- ——————————————————————————————————————————————————————
- :first1
-
- set "t=%time: =0%"
- if "%t:~,5%" geq "12:20" if "%t:~,5%" leq "12:25" goto :first11
- if "%t:~,5%" geq "21:50" if "%t:~,5%" leq "21:55" goto :first11
- goto :first
-
-
- :first11
- taskkill /f /im 软件2.EXE
- taskkill /f /im AutoRedrCard.EXE
- ping 127.0.0.1 -n 2 >nul 2>nul
- shutdown.exe -s -t 3
-
-
- ——————————————————————————————————————————————————————
- :first2
-
- set "t=%time: =0%"
- if "%t:~,5%" geq "21:50" if "%t:~,5%" leq "21:55" goto :first21
- goto :first
-
-
- :first21
- taskkill /f /im 软件1.EXE
- taskkill /f /im AutoRedrCard.EXE
- ping 127.0.0.1 -n 2 >nul 2>nul
- shutdown.exe -s -t 3
-
-
- ——————————————————————————————————————————————————————
- :first3
-
- set "t=%time: =0%"
- if "%t:~,5%" geq "21:50" if "%t:~,5%" leq "21:55" goto :first31
- goto :first
-
-
- :first31
- ping 127.0.0.1 -n 2 >nul 2>nul
- shutdown.exe -s -t 3
复制代码
作者: ygqiang 时间: 2014-11-27 00:00
本帖最后由 ygqiang 于 2014-11-27 00:23 编辑
已解决。
sddsds
作者: CrLf 时间: 2014-11-27 00:14
卧槽,我还不知道,本站竟然有 bathome.net 的域名,原来只知道 www、bbs 和 wuyou 的
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |