中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-04 20:46
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 又有个难题关于AT的 查看 2,410 回复 3
楼 主 又有个难题关于AT的 发表于 2007-06-09 23:42 ·  中国 浙江 金华 电信
初级用户
积分 48
发帖 17
注册 2007-06-08 21:54
19年会员
UID 90724
性别 男
状态 离线
我想做一个远程IIS重启的脚本,需要是把一个批处理文件拷到远程计算机中再去用AT运行他,拷贝是没有问题主要是执行批处理文件,我想做到的是拷过去之后就去运行批处理,或是延时一分钟去运行,主要问题在于时间的获取上,我用了
at %time:~0,2%:%time:~3,2% call 1.bat
任务是加进去了,但是显示是任务运行时间是明天的,而不是当天的。有没有什么办法可以把%time:~0,2%:%time:~3,2%延后做为AT的时间。
2 1分钟运行的 发表于 2007-06-10 09:21 ·  中国 四川 绵阳 江油市 电信
高级用户
★★★
积分 502
发帖 327
注册 2006-12-30 06:01
19年会员
UID 74981
性别 男
状态 离线
for /f "tokens=1,2* delims=:" %%a in ("%time%") do (
set /A tm=%%b+1
set /A tm=!tm!%%60
set tm1=%%a:!tm!
at !tm1! c:\delcopyrar.bat
)
3 发表于 2007-06-10 13:19 ·  中国 广东 广州 黄埔区 电信
中级用户
★★
积分 326
发帖 152
注册 2007-05-04 06:16
19年会员
UID 87412
性别 男
状态 离线
@echo off
title 可以远程重启计算机 by 彬 QQ 43142691
set /p s=关机请输入s.重启请输入r :
set /p time=输入命令倒计时时间(秒):
set /p serverIP=请输入远程计算机IP:
set /p username=请输入管理员帐号 :
echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x>in.com
set /p password=Password:<nul
for /f "tokens=*" %%i in ('in.com') do set password=%%i
del in.com
if %s% EQU s goto shutdown else
goto restart
exit
:shutdown
net use \\%serverIP%\ipc$ %password% /u:"%username%"
shutdown -s -m \\%serverIP% -t %time% -c "即将关闭远程计算机"
exit
:restart
net use \\%serverIP%\ipc$ %password% /u:"%username%"
shutdown -r -m \\%serverIP% -t %time% -c "即将重启远程计算机"
exit
4 发表于 2007-06-10 17:22 ·  中国 四川 绵阳 江油市 电信
高级用户
★★★
积分 502
发帖 327
注册 2006-12-30 06:01
19年会员
UID 74981
性别 男
状态 离线
Originally posted by qingfushuan at 2007-6-10 09:21 AM:
for /f "tokens=1,2* delims=:" %%a in ("%time%") do (
set /A tm=%%b+1
set /A tm=!tm!%%60
set tm1=%%a:!tm!
at !tm1! c:\delcopyrar.bat
)



这个会在每小时59分出现问题,下面的要全点


@echo off &Setlocal EnableDelayedExpansion
for /f "tokens=1,2* delims=:" %%a in ("%time%") do (
set /A tm=%%b+1
set /A tm1=%%a+1
if not "!tm!" lss "60" goto :tm2
set /A tm=!tm!%%60
set tm2=%%a:!tm!
at !tm1! c:\delcopyrar.bat
)
goto :eof
:tm2
set /A tm=!tm!%%60
set /A tm1=!tm1!%%24
set tm2=!tm1!:!tm!
at !tm2! c:\delcopyrar.bat
论坛跳转: