<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yousri&#039;s Blog &#187; 定时关机</title>
	<atom:link href="http://blog.yousri.org/tag/%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.yousri.org</link>
	<description>一个人骑单车在陌生城市路上自由穿梭的生活</description>
	<lastBuildDate>Fri, 20 Jan 2012 15:01:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>实现Windows定时关机脚本</title>
		<link>http://blog.yousri.org/2009/02/17/%e5%ae%9e%e7%8e%b0windows%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e8%84%9a%e6%9c%ac.html</link>
		<comments>http://blog.yousri.org/2009/02/17/%e5%ae%9e%e7%8e%b0windows%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e8%84%9a%e6%9c%ac.html#comments</comments>
		<pubDate>Tue, 17 Feb 2009 09:41:28 +0000</pubDate>
		<dc:creator>Yousri</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[定时关机]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://qingxianyan.cn/?p=277</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160; 刚刚一个朋友发来QQ消息问我用过可以设置自动关机的播放器么///额，自己倒是还没用过，原来她是想开着机子放音乐伴随着歌声入睡然后自动关机，自己只 在linux下使用命令设置定时关机，在windows下倒是貌似比较少用过这类附带有这类功能的软件便是，最多也就用一些批处理.bat脚本来定制实现 的吧。。。。后来就也只能用这个分享给她用啦///呵呵，其实也挺简单方便的，所以这里贴出来共享下（谁写忘记，因为当初也是朋友分享于我） &#160;&#160;&#160;&#160; 实现的主要功能包括：定时关机、倒计时关机、删除定时关机任务、查看任务状态、重启、注销、锁定计算机等 @ECHO off TITLE greaterthanme-实现定时关机、注销、重启、锁定等功能。 :start CLS COLOR 1f rem 使用COLOR命令对控制台输出颜色进行更改 MODE con: COLS=41 LINES=18 rem MODE语句为设定窗体的宽和高 set tm1=%time:~0,2% set tm2=%time:~3,2% set tm3=%time:~6,2% ECHO %date% %tm1%点%tm2%分%tm3%秒 ECHO ========================================= ECHO 请选择要进行的操作，然后按回车 ECHO ─────────────── ECHO. ECHO 1. 定时关机 ECHO 2. 倒计时关机 ECHO 3. 删除定时关机任务 ECHO 4. 查看任务状态 ECHO 5. 刷新当前时间 ECHO 6. <a href='http://blog.yousri.org/2009/02/17/%e5%ae%9e%e7%8e%b0windows%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e8%84%9a%e6%9c%ac.html'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F12%2F22%2Fwindows-server-2003-install-and-setting.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F17%2F%25E5%25AE%259E%25E7%258E%25B0windows%25E5%25AE%259A%25E6%2597%25B6%25E5%2585%25B3%25E6%259C%25BA%25E8%2584%259A%25E6%259C%25AC.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Windows Server 2003服务器简易安全配置</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F12%2F02%2Finstall-windows-server-2003-iis-for-aspaspnet.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F17%2F%25E5%25AE%259E%25E7%258E%25B0windows%25E5%25AE%259A%25E6%2597%25B6%25E5%2585%25B3%25E6%259C%25BA%25E8%2584%259A%25E6%259C%25AC.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Install Windows Server 2003 &amp; IIS For ASP&amp;ASP.NET</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F27%2Fanalysis-and-solution-vim-editor-coding-garbled-on-windows.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F17%2F%25E5%25AE%259E%25E7%258E%25B0windows%25E5%25AE%259A%25E6%2597%25B6%25E5%2585%25B3%25E6%259C%25BA%25E8%2584%259A%25E6%259C%25AC.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Windows系统Vim编辑器乱码解决分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F08%2F20%2Fwindows_ssh_centos.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F17%2F%25E5%25AE%259E%25E7%258E%25B0windows%25E5%25AE%259A%25E6%2597%25B6%25E5%2585%25B3%25E6%259C%25BA%25E8%2584%259A%25E6%259C%25AC.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">实现本地Windows与虚拟机Centos间网络共享及SSH通信</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
刚刚一个朋友发来QQ消息问我用过可以设置自动关机的播放器么///额，自己倒是还没用过，原来她是想开着机子放音乐伴随着歌声入睡然后自动关机，自己只<br />
在linux下使用命令设置定时关机，在windows下倒是貌似比较少用过这类附带有这类功能的软件便是，最多也就用一些批处理.bat脚本来定制实现<br />
的吧。。。。后来就也只能用这个分享给她用啦///呵呵，其实也挺简单方便的，所以这里贴出来共享下（谁写忘记，因为当初也是朋友分享于我）</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; 实现的主要功能包括：定时关机、倒计时关机、删除定时关机任务、查看任务状态、重启、注销、锁定计算机等</p>
<pre lang="dos">
@ECHO off
TITLE greaterthanme-实现定时关机、注销、重启、锁定等功能。

:start
CLS
COLOR 1f
rem 使用COLOR命令对控制台输出颜色进行更改
MODE con: COLS=41 LINES=18
rem MODE语句为设定窗体的宽和高
set tm1=%time:~0,2%
set tm2=%time:~3,2%
set tm3=%time:~6,2%
ECHO %date% %tm1%点%tm2%分%tm3%秒
ECHO =========================================
ECHO 请选择要进行的操作，然后按回车
ECHO ───────────────
ECHO.
ECHO 1. 定时关机
ECHO 2. 倒计时关机
ECHO 3. 删除定时关机任务
ECHO 4. 查看任务状态
ECHO 5. 刷新当前时间
ECHO 6. 重新启动
ECHO 7. 锁定计算机
ECHO 8. 注销
ECHO 9. 退出
ECHO.

:cho
SET Choice=
SET /P Choice=选择:
rem 设定变量"Choice"为用户输入的字符
IF NOT "%Choice%"=="" SET Choice=%Choice:~0,1%
rem 如果输入大于1位,取第1位,比如输入132,则返回值为1
ECHO.
IF /I "%Choice%"=="1" GOTO SetHour
IF /I "%Choice%"=="2" GOTO outtime
IF /I "%Choice%"=="3" GOTO delAt
IF /I "%Choice%"=="4" GOTO view
IF /I "%Choice%"=="5" GOTO start
IF /I "%Choice%"=="6" GOTO restart
IF /I "%Choice%"=="7" GOTO lock
IF /I "%Choice%"=="8" GOTO logoff
IF /I "%Choice%"=="9" GOTO end
rem 为避免出现返回值为空或含空格而导致程序异常,需在变量外另加双引号
rem 注意,IF语句需要双等于号
rem 如果输入的字符不是以上数字,将返回重新输入
ECHO 选择无效，请重新输入
ECHO.
GOTO cho

:SetHour
CLS
ECHO.
SET ask=
SET /p ask=是否设定为每天执行关机命令(y/n):
IF NOT "%ask%"=="" SET ask=%ask:~0,1%
IF /I "%ask%"=="y" GOTO yes
IF /I "%ask%"=="n" GOTO no
GOTO SetHour

:yes
ECHO 请指定24小时制式时间,格式为 小时:分钟
SET shutdowntime=
SET /p shutdowntime=输入:
at %shutdowntime% /every:M,T,W,Th,F,S,Su tsshutdn 0 /delay:0 /powerdown &gt;nul
rem 设定为每周的星期一至星期日,即为每天
IF NOT errorlevel 1 GOTO ok
rem 如果输入正确,就执行ok段的语句
ECHO %shutdowntime% 不是标准的时间格式,请重新输入
ECHO.
GOTO yes

:no
ECHO 请指定24小时制式时间,格式为 小时:分钟
SET shutdowntime=
SET /p shutdowntime=输入:
at %shutdowntime% tsshutdn 0 /delay:0 /powerdown &gt;nul
IF NOT errorlevel 1 GOTO ok
ECHO %shutdowntime% 不是标准的时间格式,请重新输入
ECHO.
GOTO no

 <img src='http://blog.yousri.org/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> k
ECHO.
SET h=%shutdowntime:~1,1%
SET ah=%shutdowntime:~0,1%
SET am=%shutdowntime:~2,2%
SET bh=%shutdowntime:~0,2%
SET bm=%shutdowntime:~3,2%
IF "%h%"==":" (
SET HM=%ah%时%am%分
) ELSE (
SET HM=%bh%时%bm%分)
rem 如果输入h:mm则HM=h时mm分,否则HM=hh时mm分
IF /I "%ask%"=="y" ECHO 系统将于每天的%HM%关闭
IF /I "%ask%"=="n" ECHO 系统将于%HM%关闭
ECHO 设定完毕! 按任意键继续...
PAUSE &gt;nul
GOTO start

 <img src='http://blog.yousri.org/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> uttime
CLS
ECHO.
ECHO 请输入倒计时秒数
ECHO ────────
ECHO (设定后要取消,单击"确定"后按Ctrl+C键两次)
SET timed=
SET /p timed=输入:
tsshutdn %timed% /delay:0 /powerdown &gt;nul
IF not errorlevel 1 GOTO ok
ECHO %timed% 是无效的关机时间,请重新输入
ECHO.
GOTO outtime

:delAt
cls
echo.
at /del /y
echo 定时关机任务已取消,按任意键继续...
pause &gt;nul
GOTO start

:view
MODE con: COLS=85 LINES=18
COLOR 70
ECHO.
at
ECHO 按任意键继续...
PAUSE &gt;nul
GOTO start

:restart
shutdown -r -t 0

:lock
rundll32.exe user32.dll,LockWorkStation
goto start

:logoff
logoff

:end
exit
</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F12%2F22%2Fwindows-server-2003-install-and-setting.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F17%2F%25E5%25AE%259E%25E7%258E%25B0windows%25E5%25AE%259A%25E6%2597%25B6%25E5%2585%25B3%25E6%259C%25BA%25E8%2584%259A%25E6%259C%25AC.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Windows Server 2003服务器简易安全配置</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F12%2F02%2Finstall-windows-server-2003-iis-for-aspaspnet.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F17%2F%25E5%25AE%259E%25E7%258E%25B0windows%25E5%25AE%259A%25E6%2597%25B6%25E5%2585%25B3%25E6%259C%25BA%25E8%2584%259A%25E6%259C%25AC.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Install Windows Server 2003 &amp; IIS For ASP&amp;ASP.NET</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F27%2Fanalysis-and-solution-vim-editor-coding-garbled-on-windows.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F17%2F%25E5%25AE%259E%25E7%258E%25B0windows%25E5%25AE%259A%25E6%2597%25B6%25E5%2585%25B3%25E6%259C%25BA%25E8%2584%259A%25E6%259C%25AC.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Windows系统Vim编辑器乱码解决分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fblog.yousri.org%2F2008%2F08%2F20%2Fwindows_ssh_centos.html&from=http%3A%2F%2Fblog.yousri.org%2F2009%2F02%2F17%2F%25E5%25AE%259E%25E7%258E%25B0windows%25E5%25AE%259A%25E6%2597%25B6%25E5%2585%25B3%25E6%259C%25BA%25E8%2584%259A%25E6%259C%25AC.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">实现本地Windows与虚拟机Centos间网络共享及SSH通信</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.yousri.org/2009/02/17/%e5%ae%9e%e7%8e%b0windows%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e8%84%9a%e6%9c%ac.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

