China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 13:44
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to use intelligent startup multi-program batch commands under XP! <Closed and Settled> View 2,684 Replies 13
Original Poster Posted 2005-11-07 20:21 ·  中国 湖北 孝感 汉川市 电信
新手上路
Credits 18
Posts 7
Joined 2005-11-07 20:18
20-year member
UID 44777
Status Offline
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 ]
Floor 2 Posted 2005-11-07 20:43 ·  中国 广东 广州 教育网
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
choice
But it needs to be identified by the return code
Floor 3 Posted 2005-11-07 21:24 ·  中国 广东 广州 白云区 电信
荣誉版主
★★★
Credits 718
Posts 313
Joined 2005-09-26 00:00
20-year member
UID 42844
Gender Male
Status Offline
Please check if there is CHOICE.COM in your XP.
Floor 4 Posted 2005-11-07 21:28 ·  中国 湖北 孝感 汉川市 电信
新手上路
Credits 18
Posts 7
Joined 2005-11-07 20:18
20-year member
UID 44777
Status Offline
No, what should I do? Where can I find it?
Floor 5 Posted 2005-11-07 21:34 ·  中国 广东 广州 白云区 电信
荣誉版主
★★★
Credits 718
Posts 313
Joined 2005-09-26 00:00
20-year member
UID 42844
Gender Male
Status Offline
http://www.cn-dos.net/forum/viewthread.php?tid=17250&fpage=1&highlight=choice

Sent by friend Michael. (But there are some problems when running in my XP)
Floor 6 Posted 2005-11-07 21:38 ·  中国 湖北 孝感 汉川市 电信
新手上路
Credits 18
Posts 7
Joined 2005-11-07 20:18
20-year member
UID 44777
Status Offline
Thanks
Floor 7 Posted 2005-11-07 21:40 ·  中国 湖北 孝感 汉川市 电信
新手上路
Credits 18
Posts 7
Joined 2005-11-07 20:18
20-year member
UID 44777
Status Offline
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 ]
Floor 8 Posted 2005-11-07 21:51 ·  中国 广东 广州 白云区 电信
荣誉版主
★★★
Credits 718
Posts 313
Joined 2005-09-26 00:00
20-year member
UID 42844
Gender Male
Status Offline
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.
Floor 9 Posted 2005-11-07 22:00 ·  中国 湖北 孝感 汉川市 电信
新手上路
Credits 18
Posts 7
Joined 2005-11-07 20:18
20-year member
UID 44777
Status Offline
@ 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

--------------------------------
Floor 10 Posted 2005-11-08 17:00 ·  中国 河北 石家庄 联通
新手上路
Credits 3
Posts 2
Joined 2005-11-01 11:55
20-year member
UID 44402
Status Offline
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 ]
Floor 11 Posted 2005-11-09 22:13 ·  中国 福建 漳州 电信
中级用户
★★
带走
Credits 435
Posts 88
Joined 2005-09-24 19:22
20-year member
UID 42793
Status Offline
Add a line

set Input_=%Input_:~0,1%

Otherwise, an error will occur when the input characters are excessive~
Floor 12 Posted 2005-11-10 12:47 ·  中国 湖北 孝感 电信
新手上路
Credits 18
Posts 7
Joined 2005-11-07 20:18
20-year member
UID 44777
Status Offline
After testing, Comrade Archimonde's commands always go wrong, no matter what characters are entered. Please re-enter
Floor 13 Posted 2005-11-10 17:54 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
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
Floor 14 Posted 2005-11-12 00:31 ·  中国 湖北 孝感 电信
新手上路
Credits 18
Posts 7
Joined 2005-11-07 20:18
20-year member
UID 44777
Status Offline
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
Forum Jump: