|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
Originally posted by jasonwang at 2007-1-23 14:22:
@echo off
for /f "delims=" %%i in ('SC QUERY TLNTSVR^|FIND "STATE"') do ( 这句看懂了,根据state来做DO后面的工作)
echo %%i|find /i "RUNNING" ...
去这个的帖子4楼看看。
Originally posted by jasonwang at 2007-1-23 14:22:
@echo off
for /f "delims=" %%i in ('SC QUERY TLNTSVR^|FIND "STATE"') do ( I understand this, do the work after DO according to STATE)
echo %%i|find /i "RUNNING" ...
Go to the 4th floor of this post to have a look.
|
|
2007-1-24 06:42 |
|
|
agesbgfe
新手上路

积分 2
发帖 1
注册 2007-1-13
状态 离线
|
|
2007-1-24 10:50 |
|
|
hangyug
初级用户
 
积分 99
发帖 43
注册 2007-1-12
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
RE:jasonwang
&& 意思是 命令执行成功,就会执行其后面的命令
|| 正好与&&相反,意思是命令执行失败,就会执行其后面的命令
RE: jasonwang
&& means that if the command is executed successfully, the command following it will be executed
|| is exactly the opposite of &&, meaning that if the command fails to execute, the command following it will be executed
|

我很菜,但我很努力~ |
|
2007-1-24 12:07 |
|
|
jasonwang
初级用户
 
积分 122
发帖 54
注册 2006-11-3
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
谢谢楼上解释,我在03下测试没有成功啊,是不是服务在禁用状态下,此命令无效?
Thanks to the explanation of the upstairs, I didn't succeed in the test under 03. Is this command invalid when the service is in the disabled state?
|
|
2007-1-24 23:15 |
|
|
jasonwang
初级用户
 
积分 122
发帖 54
注册 2006-11-3
状态 离线
|
『第 20 楼』:
使用 LLM 解释/回答一下
C:\>sc query tlntsvr
SERVICE_NAME: tlntsvr
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\>services.bat
请按任意键继续. . .
C:\>sc query tlntsvr
SERVICE_NAME: tlntsvr
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\>
@echo off
for /f "delims=" %%i in ('sc query tlntsvr^|find "state"') do (
echo %%i|find /i "running" && (
sc stop tlntsvr
sc config tlntsvr start=disabled) || (
sc config tlntsvr start=auto
sc start tlntsvr)
)
pause
C:\>sc query tlntsvr
SERVICE_NAME: tlntsvr
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\>services.bat
Press any key to continue . . .
C:\>sc query tlntsvr
SERVICE_NAME: tlntsvr
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\>
@echo off
for /f "delims=" %%i in ('sc query tlntsvr^|find "state"') do (
echo %%i|find /i "running" && (
sc stop tlntsvr
sc config tlntsvr start^=disabled) || (
sc config tlntsvr start^=auto
sc start tlntsvr)
)
pause
|
|
2007-1-24 23:40 |
|
|
bob1989
中级用户
  
积分 322
发帖 144
注册 2007-1-10
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
用net start命令好了`
SC在WIN2000下没有
It's okay with the net start command. SC is not available under WIN2000.
|
|
2007-1-25 00:09 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
Originally posted by jasonwang at 2007-1-24 10:40:
C:\>sc query tlntsvr
SERVICE_NAME: tlntsvr
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ...
你的代码有误,复制我写的代码试试看。
Originally posted by jasonwang at 2007-1-24 10:40:
C:\>sc query tlntsvr
SERVICE_NAME: tlntsvr
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ...
There is an error in your code. Try copying the code I wrote.
|
|
2007-1-25 00:41 |
|
|
jasonwang
初级用户
 
积分 122
发帖 54
注册 2006-11-3
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
搞定了,在第1个find后面加个/i
start= auto 前面应该有个空格。
呵呵,谢谢所有人
Got it, add /i after the first find. There should be a space before start= auto. Hehe, thank you everyone
|
|
2007-1-25 02:47 |
|