|
cjw114
新手上路

积分 18
发帖 7
注册 2005-11-7
状态 离线
|
『楼 主』:
xp下如何智能启动多程序批处理命令!<圆满结帖>
使用 LLM 解释/回答一下
我想做一个批处理文件,实现启动多个程序用。
比如按下1就启动QQ,
按下2就启动IE,
按下3就启动BT
按下回车就退出命令窗口。
拟用Start和GOTO命令实现,请教高手:怎么样才能等待并判断键盘输入??
----------------------------------------------------------------------
『第 5 楼』: 请帮我看看这样哪里出问题了,怎么在xp下没反映啊?
@ echo 1.启动QQ-1
@ echo 2.启动BT下载
@ echo 3.启动Maxthon浏览器
@ echo 4.启动QQ-2
@ echo 0.退出
choice /c 12340 /m "请选择需要启动的程序代号:"
if errorlevel 5 goto end
if errorlevel 4 goto qq2
if errorlevel 3 goto myie
if errorlevel 2 goto bt
if errorlevel 1 goto qq1
:qq2
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
:myie
start D:\Maxthon\Maxthon.exe
:bt
start D:\Progra~1\BitComet\BitComet.exe
:qq1
start D:\Progra~1\Tencent\qq\CoralQQ.exe
:end
exit
Last edited by cjw114 on 2005-11-12 at 00:34 ]
I want to make a batch file for starting multiple programs. For example, pressing 1 starts QQ, pressing 2 starts IE, pressing 3 starts BT, and pressing Enter exits the command window. I plan to use the Start and GOTO commands to implement it. Please teach me experts: How can I wait and judge the keyboard input??
----------------------------------------------------------------------
『Post 5』: Please help me see where is wrong, why is there no response under xp?
@ echo 1. Start QQ-1
@ echo 2. Start BT download
@ echo 3. Start Maxthon browser
@ echo 4. Start QQ-2
@ echo 0. Exit
choice /c 12340 /m "Please select the program code you need to start:"
if errorlevel 5 goto end
if errorlevel 4 goto qq2
if errorlevel 3 goto myie
if errorlevel 2 goto bt
if errorlevel 1 goto qq1
:qq2
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
:myie
start D:\Maxthon\Maxthon.exe
:bt
start D:\Progra~1\BitComet\BitComet.exe
:qq1
start D:\Progra~1\Tencent\qq\CoralQQ.exe
:end
exit
Last edited by cjw114 on 2005-11-12 at 00:34 ]
|
|
2005-11-7 20:21 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
choice
但要用返回码识别的
choice
But it needs to be identified by the return code
|
|
2005-11-7 20:43 |
|
|
220110
荣誉版主
      
积分 718
发帖 313
注册 2005-9-26
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
请查对你的XP中有没有CHOICE.COM 。
Please check if there is CHOICE.COM in your XP.
|
|
2005-11-7 21:24 |
|
|
cjw114
新手上路

积分 18
发帖 7
注册 2005-11-7
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
没有哦,怎么办?哪里有呢?
No, what should I do? Where can I find it?
|
|
2005-11-7 21:28 |
|
|
220110
荣誉版主
      
积分 718
发帖 313
注册 2005-9-26
状态 离线
|
|
2005-11-7 21:34 |
|
|
cjw114
新手上路

积分 18
发帖 7
注册 2005-11-7
状态 离线
|
|
2005-11-7 21:38 |
|
|
cjw114
新手上路

积分 18
发帖 7
注册 2005-11-7
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
咋还是不行捏????急死我鸟!
那个choice感觉不大对劲,xp下变dos窗口变英文了。。
还有其他方法吗?
Last edited by cjw114 on 2005-11-7 at 21:45 ]
Why still not working??? So anxious!
That choice doesn't seem right. Under XP, the DOS window becomes English.
Are there any other methods?
Last edited by cjw114 on 2005-11-7 at 21:45 ]
|
|
2005-11-7 21:40 |
|
|
220110
荣誉版主
      
积分 718
发帖 313
注册 2005-9-26
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by cjw114 at 2005-11-7 21:40:
咋还是不行捏????急死我鸟!
那个choice感觉不大对劲,xp下变dos窗口变英文了。。
还有其他方法吗?
Last edited by cjw114 on 2005-11-7 at 21:45 ]
我也是发现这个问题.
得请下 Michael 帮忙指导下.
Originally posted by cjw114 at 2005-11-7 21:40:
Why still not working???? So anxious!
That choice doesn't seem right, the DOS window in XP becomes English.
Any other methods?
Last edited by cjw114 on 2005-11-7 at 21:45 ]
I also noticed this problem.
Need to ask Michael to help guide.
|
|
2005-11-7 21:51 |
|
|
cjw114
新手上路

积分 18
发帖 7
注册 2005-11-7
状态 离线
|
『第 9 楼』:
我又弄了一个,可是只能分两步,有没有更好的办法啊?
使用 LLM 解释/回答一下
@ echo 按下键盘启动QQ1+BT+MyIE程序,再按一下启动QQ2,要退出请关闭此窗口!
pause
start D:\Progra~1\Tencent\qq\CoralQQ.exe
start D:\Progra~1\BitComet\BitComet.exe
start D:\Maxthon\Maxthon.exe
pause
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
--------------------------------
@ echo Press the keyboard to start QQ1+BT+MyIE program, press again to start QQ2, to exit please close this window!
pause
start D:\Progra~1\Tencent\qq\CoralQQ.exe
start D:\Progra~1\BitComet\BitComet.exe
start D:\Maxthon\Maxthon.exe
pause
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
--------------------------------
|
|
2005-11-7 22:00 |
|
|
Archimonde
新手上路

积分 3
发帖 2
注册 2005-11-1
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
按照你的意思,写了一个,仅做参考
@echo off
echo 1.启动QQ-1
echo 2.启动BT下载
echo 3.启动Maxthon浏览器
echo 4.启动QQ-2
echo 0.退出
:INPUT
set /p Input_=请选择需要启动的程序代号:
if %Input_% == "4" goto QQ2
if %Input_% == "3" goto MYIE
if %Input_% == "2" goto BT
if %Input_% == "1" goto QQ1
if %Input_% == "0" goto END
echo 输入了错误参数.请重试.
goto INPUT
:END
@echo on
exit
:QQ2
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
goto END
:MYIE
start D:\Maxthon\Maxthon.exe
goto END
:BT
start D:\Progra~1\BitComet\BitComet.exe
goto END
:QQ1
start D:\Progra~1\Tencent\qq\CoralQQ.exe
goto END
Last edited by Archimonde on 2005-11-8 at 17:25 ]
According to your meaning, I wrote one, for reference only
@echo off
echo 1. Start QQ-1
echo 2. Start BT download
echo 3. Start Maxthon browser
echo 4. Start QQ-2
echo 0. Exit
:INPUT
set /p Input_=Please select the program code to start:
if %Input_% == "4" goto QQ2
if %Input_% == "3" goto MYIE
if %Input_% == "2" goto BT
if %Input_% == "1" goto QQ1
if %Input_% == "0" goto END
echo Incorrect parameter entered. Please try again.
goto INPUT
:END
@echo on
exit
:QQ2
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
goto END
:MYIE
start D:\Maxthon\Maxthon.exe
goto END
:BT
start D:\Progra~1\BitComet\BitComet.exe
goto END
:QQ1
start D:\Progra~1\Tencent\qq\CoralQQ.exe
goto END
Last edited by Archimonde on 2005-11-8 at 17:25 ]
|
|
2005-11-8 17:00 |
|
|
0401
中级用户
   带走
积分 435
发帖 88
注册 2005-9-24
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
加一句
set Input_=%Input_:~0,1%
否则输入的字符多出来时会出错~
Add a line
set Input_=%Input_:~0,1%
Otherwise, an error will occur when the input characters are excessive~
|
|
2005-11-9 22:13 |
|
|
cjw114
新手上路

积分 18
发帖 7
注册 2005-11-7
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
经试验,Archimonde 同志的命令总是出错,无论输入什么字符都不行。
请重新输入
After testing, Comrade Archimonde's commands always go wrong, no matter what characters are entered. Please re-enter
|
|
2005-11-10 12:47 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
按照你的意思,写了一个,仅做参考
@echo off
echo 1.启动QQ-1
echo 2.启动BT下载
echo 3.启动Maxthon浏览器
echo 4.启动QQ-2
echo 0.退出
:INPUT
set /p In=请选择需要启动的程序代号:
set In=%In:~0,1%
if #%In% ==#4 goto QQ2
if #%In% ==#3 goto MYIE
if #%In% == #2 goto BT
if #%In% == #1 goto QQ1
if #%In% == #0 goto END
echo 输入了错误参数.请重试.
goto INPUT
:END
@echo on
exit
:QQ2
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
goto END
:MYIE
start D:\Maxthon\Maxthon.exe
goto END
:BT
start D:\Progra~1\BitComet\BitComet.exe
goto END
:QQ1
start D:\Progra~1\Tencent\qq\CoralQQ.exe
:END
According to your meaning, I wrote one, for reference only
@echo off
echo 1. Start QQ-1
echo 2. Start BT download
echo 3. Start Maxthon browser
echo 4. Start QQ-2
echo 0. Exit
:INPUT
set /p In=Please select the program code to start:
set In=%In:~0,1%
if #%In% ==#4 goto QQ2
if #%In% ==#3 goto MYIE
if #%In% == #2 goto BT
if #%In% == #1 goto QQ1
if #%In% == #0 goto END
echo Incorrect parameter entered. Please try again.
goto INPUT
:END
@echo on
exit
:QQ2
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
goto END
:MYIE
start D:\Maxthon\Maxthon.exe
goto END
:BT
start D:\Progra~1\BitComet\BitComet.exe
goto END
:QQ1
start D:\Progra~1\Tencent\qq\CoralQQ.exe
:END
|

我的网络U盘 我的网络第2个U盘
论坛软件下载链接
灵雨飘零论坛
论坛新手必读,所有人的基本行为准则
刷QQ空间人气、留言的小软件 |
|
2005-11-10 17:54 |
|
|
cjw114
新手上路

积分 18
发帖 7
注册 2005-11-7
状态 离线
|
『第 14 楼』:
感谢Archimonde和q版主,经测试运行正常<结帖>!!
使用 LLM 解释/回答一下
最后应返回 INPUT函数,因此最终代码如下:
@echo off
echo 1.启动QQ-1
echo 2.启动BT下载
echo 3.启动Maxthon浏览器
echo 4.启动QQ-2
echo 0.退出
:INPUT
set /p In=请选择需要启动的程序代号:
set In=%In:~0,1%
if #%In% ==#4 goto QQ2
if #%In% ==#3 goto MYIE
if #%In% == #2 goto BT
if #%In% == #1 goto QQ1
if #%In% == #0 goto END
echo 输入了错误参数.请重试.
goto INPUT
:END
@echo on
exit
:QQ2
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
goto INPUT
:MYIE
start D:\Maxthon\Maxthon.exe
goto INPUT
:BT
start D:\Progra~1\BitComet\BitComet.exe
goto INPUT
:QQ1
start D:\Progra~1\Tencent\qq\CoralQQ.exe
goto INPUT
Finally, the INPUT function should be returned. Therefore, the final code is as follows:
@echo off
echo 1. Start QQ-1
echo 2. Start BT download
echo 3. Start Maxthon browser
echo 4. Start QQ-2
echo 0. Exit
:INPUT
set /p In=Please select the program code to start:
set In=%In:~0,1%
if #%In% ==#4 goto QQ2
if #%In% ==#3 goto MYIE
if #%In% == #2 goto BT
if #%In% == #1 goto QQ1
if #%In% == #0 goto END
echo Incorrect parameter entered. Please try again.
goto INPUT
:END
@echo on
exit
:QQ2
start D:\Progra~1\Tencent\qq1\CoralQQ.exe
goto INPUT
:MYIE
start D:\Maxthon\Maxthon.exe
goto INPUT
:BT
start D:\Progra~1\BitComet\BitComet.exe
goto INPUT
:QQ1
start D:\Progra~1\Tencent\qq\CoralQQ.exe
goto INPUT
|
|
2005-11-12 00:31 |
|