中国DOS联盟

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

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

中国DOS联盟论坛
现在时间是 2026-08-08 17:11
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 【求助】关于at命令 查看 1,157 回复 10
楼 主 【求助】关于at命令 发表于 2008-05-19 21:28 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
积分 2,278
发帖 1,020
注册 2007-11-19 13:34
18年会员
UID 103127
性别 男
状态 离线
以前不怎么用at,现在使用它还真发现不好使。
先是启动task scheduler服务就是问题
sc start scheduler

提示: StartService: OpenService FAILED 1060:
没办法,我只要打开services.msc,手动将计划服务启动了
接着我在cmd下:
at 20:50 mytest.vbs
这个mytest.vbs代码:
msgbox "该休息了!"

可以到了20:50分什么反应都没的,查看任务管理起,多了个wscript.exe
我忘了at隐藏执行命令了,但我没想到at把我这个mytest.vbs隐藏执行,连对话框都给"弄丢了"
不过:
at 20:56 msg %username% "该休息了!"

到了时间会正常显示。
我现在想问大家,
1:服务为什么用sc start 启动出错?应该怎样启动不会出错?
2:怎么让at命令启动VBS后,对话框能不隐藏?
3:大家认为弹对话框最可靠的命令是那个?
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
2 发表于 2008-05-19 21:50 ·  中国 重庆 电信
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
19年会员
UID 89899
性别 男
状态 离线
1. 是不是你的命令写错了?

sc应该用service_name
net start应该用display_name

SERVICE_NAME: Schedule
DISPLAY_NAME: Task Scheduler

2. at命令创建的计划任务会以system权限运行,VBS的对话框是无法弹出的。可以用schtasks命令创建一个以当前用户运行的计划任务。

3. 没有最可靠的,具体情况具体分析吧。
3 发表于 2008-05-19 22:06 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
积分 2,278
发帖 1,020
注册 2007-11-19 13:34
18年会员
UID 103127
性别 男
状态 离线
sc start schedule

提示:
StartService FAILED 1056:
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
4 发表于 2008-05-19 22:24 ·  中国 重庆 电信
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
19年会员
UID 89899
性别 男
状态 离线
sc config schedule start= auto
sc start schedule

如果这样还不行的话,net start可以吗?
net start "Task Scheduler"
5 发表于 2008-05-19 22:58 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
积分 2,278
发帖 1,020
注册 2007-11-19 13:34
18年会员
UID 103127
性别 男
状态 离线
Originally posted by HAT at 2008-5-19 10:24 PM:
sc config schedule start= auto
sc start schedule

如果这样还不行的话,net start可以吗?
net start "Task Scheduler"


可以:
net start "Task Scheduler"
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
6 发表于 2008-05-20 01:47 ·  中国 重庆 电信
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
19年会员
UID 89899
性别 男
状态 离线
奇怪,不知楼主用的哪个版本的系统。到别人电脑上拷贝一个sc.exe,覆盖到自己电脑上不知可否。
7 发表于 2008-05-20 08:34 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
积分 2,278
发帖 1,020
注册 2007-11-19 13:34
18年会员
UID 103127
性别 男
状态 离线
Originally posted by HAT at 2008-5-20 01:47 AM:
奇怪,不知楼主用的哪个版本的系统。到别人电脑上拷贝一个sc.exe,覆盖到自己电脑上不知可否。

Microsoft Windows XP
(C) 版权所有 1985-2001 Microsoft Corp.
我机子是刚装的,没有染毒,只是我对SC命令用法不很熟悉
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
8 发表于 2008-05-20 09:31 ·  中国 上海 联通
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
19年会员
UID 89899
性别 男
状态 离线
又看了一边帮助,没发现什么特别之处啊。楼主的系统是正版的吗?

C:\test>sc /?
*** Unrecognized Command ***
DESCRIPTION:
SC is a command line program used for communicating with the
NT Service Controller and services.
USAGE:
sc <server> <option1> <option2>...

The option <server> has the form "\\ServerName"
Further help on commands can be obtained by typing: "sc "
Commands:
query-----------Queries the status for a service, or
enumerates the status for types of services.
queryex---------Queries the extended status for a service, or
enumerates the status for types of services.
start-----------Starts a service.
pause-----------Sends a PAUSE control request to a service.
interrogate-----Sends an INTERROGATE control request to a service.
continue--------Sends a CONTINUE control request to a service.
stop------------Sends a STOP request to a service.
config----------Changes the configuration of a service (persistant).
description-----Changes the description of a service.
failure---------Changes the actions taken by a service upon failure.
qc--------------Queries the configuration information for a service.
qdescription----Queries the description for a service.
qfailure--------Queries the actions taken by a service upon failure.
delete----------Deletes a service (from the registry).
create----------Creates a service. (adds it to the registry).
control---------Sends a control to a service.
sdshow----------Displays a service's security descriptor.
sdset-----------Sets a service's security descriptor.
GetDisplayName--Gets the DisplayName for a service.
GetKeyName------Gets the ServiceKeyName for a service.
EnumDepend------Enumerates Service Dependencies.

The following commands don't require a service name:
sc <server> <command> <option>
boot------------(ok | bad) Indicates whether the last boot should
be saved as the last-known-good boot configuration
Lock------------Locks the Service Database
QueryLock-------Queries the LockStatus for the SCManager Database
EXAMPLE:
sc start MyService

Would you like to see help for the QUERY and QUERYEX commands? :
9 发表于 2008-05-20 09:51 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
积分 2,278
发帖 1,020
注册 2007-11-19 13:34
18年会员
UID 103127
性别 男
状态 离线
盗版,
sc /?
*** Unrecognized Command ***
DESCRIPTION:
SC is a command line program used for communicating with the
NT Service Controller and services.
USAGE:
sc <server> <option1> <option2>...

The option <server> has the form "\\ServerName"
Further help on commands can be obtained by typing: "sc "
Commands:
query-----------Queries the status for a service, or
enumerates the status for types of services.
queryex---------Queries the extended status for a service, or
enumerates the status for types of services.
start-----------Starts a service.
pause-----------Sends a PAUSE control request to a service.
interrogate-----Sends an INTERROGATE control request to a service.
continue--------Sends a CONTINUE control request to a service.
stop------------Sends a STOP request to a service.
config----------Changes the configuration of a service (persistant).
description-----Changes the description of a service.
failure---------Changes the actions taken by a service upon failure.
qc--------------Queries the configuration information for a service.
qdescription----Queries the description for a service.
qfailure--------Queries the actions taken by a service upon failure.
delete----------Deletes a service (from the registry).
create----------Creates a service. (adds it to the registry).
control---------Sends a control to a service.
sdshow----------Displays a service's security descriptor.
sdset-----------Sets a service's security descriptor.
GetDisplayName--Gets the DisplayName for a service.
GetKeyName------Gets the ServiceKeyName for a service.
EnumDepend------Enumerates Service Dependencies.

The following commands don't require a service name:
sc <server> <command> <option>
boot------------(ok | bad) Indicates whether the last boot should
be saved as the last-known-good boot configuration
Lock------------Locks the Service Database
QueryLock-------Queries the LockStatus for the SCManager Database
EXAMPLE:
sc start MyService

Would you like to see help for the QUERY and QUERYEX commands? :
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
10 发表于 2008-05-20 10:23 ·  中国 上海 联通
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
19年会员
UID 89899
性别 男
状态 离线
11 发表于 2008-05-20 12:05 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
积分 2,278
发帖 1,020
注册 2007-11-19 13:34
18年会员
UID 103127
性别 男
状态 离线
感动下,兄的这份真诚让我心里倍感温暖。
谢谢,
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
论坛跳转: