Board logo

标题: 【求助】关于at命令 [打印本页]

作者: plp626     时间: 2008-5-19 21:28    标题: 【求助】关于at命令
以前不怎么用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:大家认为弹对话框最可靠的命令是那个?

作者: HAT     时间: 2008-5-19 21:50
1. 是不是你的命令写错了?

sc应该用service_name
net start应该用display_name

SERVICE_NAME: Schedule
DISPLAY_NAME: Task Scheduler

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

3. 没有最可靠的,具体情况具体分析吧。

作者: plp626     时间: 2008-5-19 22:06
sc start schedule

提示:
StartService FAILED 1056:

作者: HAT     时间: 2008-5-19 22:24
sc config schedule start= auto
sc start schedule

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

作者: plp626     时间: 2008-5-19 22:58
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"

作者: HAT     时间: 2008-5-20 01:47
奇怪,不知楼主用的哪个版本的系统。到别人电脑上拷贝一个sc.exe,覆盖到自己电脑上不知可否。

作者: plp626     时间: 2008-5-20 08:34
Originally posted by HAT at 2008-5-20 01:47 AM:
奇怪,不知楼主用的哪个版本的系统。到别人电脑上拷贝一个sc.exe,覆盖到自己电脑上不知可否。

Microsoft Windows XP
(C) 版权所有 1985-2001 Microsoft Corp.
我机子是刚装的,没有染毒,只是我对SC命令用法不很熟悉

作者: HAT     时间: 2008-5-20 09:31
又看了一边帮助,没发现什么特别之处啊。楼主的系统是正版的吗?

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? :

作者: plp626     时间: 2008-5-20 09:51
盗版,
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? :

作者: HAT     时间: 2008-5-20 10:23
作者: plp626     时间: 2008-5-20 12:05
感动下,兄的这份真诚让我心里倍感温暖。
谢谢,