@echo off
set /p cm=comupter name  [local machine]:
echo 探测远程主机中. . .
ping %cm%

cls
echo 请输入用户名及密码. . .
set user=ln-tf\liaobin
set /p user=user name  [ln-tf\liaobin]:
set pwd=Aa123456
set /p pwd=password  [Aa123456]:

cls
echo 正在开启任务计划服务. . .
net use \\%cm%\ipc$ %pwd% /user:%user%
sc \\%cm% config Schedule start= demand
sc \\%cm% start Schedule

echo 正在探测远程主机时间. . .
for /f "tokens=1,2 delims=:" %%i in ("%time%") do set /a hh1=%%i & set /a mm1=%%j
net time \\%cm% /set /y
for /f "tokens=1,2 delims=:" %%i in ("%time%") do set /a hh=%%i & set /a mm=%%j
echo 远程主机:%cm%上的时间为%hh%:%mm%
echo.
echo 开始添加任务. . .
set /a mm=%mm%+1
at \\%cm% %hh%:%mm% net share c$=c:
at \\%cm% %hh%:%mm% net share d$=d:
at \\%cm% %hh%:%mm% net share e$=e:
at \\%cm% %hh%:%mm% net share admin$
echo.
echo 在远程主机%cm%上,以下任务被添加:
at \\%cm%
echo 共享将在一分钟后启动....
time %hh1%:%mm1%
pause

posted on 2015-09-04 11:27  lbnnbs  阅读(163)  评论(0编辑  收藏  举报