中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-25 05:22
47,813 topics / 349,918 posts / today 1 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » 请问这个带有选择项的批处理是怎么样实现的 请问这个带有选择项的批处理是怎么样实现的 请问这个带有选择项的批处理是怎么样实现的 What is the way to implement this batch processing with options? What is the way to implement this batch processing with options? What is the way to implement this batch processing with options?
Printable Version  4,192 / 35
Floor1 qingyangecho Posted 2006-11-02 08:50
初级用户 Posts 40 Credits 97
CLSERVICE1
NET START VMNETUSERIF
NET START VMNETBRIDGE
GOTO MENU

:SERVICE2
NET START HCMON
NET START VMPARPORT
GOTO MENU

:SERVICE3
SC CREATE VMnetDHCP BINPATH= "%WINDIR%\SYSTEM32\VMNETDHCP.EXE" DISPLAYNAME= "VMware DHCP Service" DEPEND= VMnetuserif
SC CREATE "VMware NAT Service" BINPATH= "%WINDIR%\SYSTEM32\VMNAT.EXE" DISPLAYNAME= "VMware NAT Service" DEPEND= VMnetuserif
NET START VMnetDHCP
NET START "VMware NAT Service"
GOTO MENU

:SERVICE4
SC CREATE VMAuthdService BINPATH= "%CD%\VMWARE-AUTHD.EXE" DISPLAYNAME= "VMware Authorization Service" DEPEND= vmx86
NET START VMAUTHDSERVICE
GOTO MENU

:SERVICE5
NET START VMNETUSERIF
NET START VMNETBRIDGE
SC CREATE VMnetDHCP BINPATH= "%WINDIR%\SYSTEM32\VMNETDHCP.EXE" DISPLAYNAME= "VMware DHCP Service" DEPEND= VMnetuserif
SC CREATE "VMware NAT Service" BINPATH= "%WINDIR%\SYSTEM32\VMNAT.EXE" DISPLAYNAME= "VMware NAT Service" DEPEND= VMnetuserif
NET START VMnetDHCP
NET START "VMware NAT Service"
NET START HCMON
NET START VMPARPORT
SC CREATE VMAuthdService BINPATH= "%CD%\VMWARE-AUTHD.EXE" DISPLAYNAME= "VMware Authorization Service" DEPEND= vmx86
NET START VMAUTHDSERVICE
GOTO MENU

:SERVICE6
DEVCON -R INSTALL %SYSTEMROOT%\INF\VMNETADAPTER.INF *VMnetAdapter1
DEVCON -R INSTALL %SYSTEMROOT%\INF\VMNETADAPTER.INF *VMnetAdapter8
GOTO MENU

:END

[ Last edited by namejm on 2006-11-2 at 09:37 AM ]
Floor2 lxmxn Posted 2006-11-02 09:25
版主 Posts 4,938 Credits 11,386

  It mainly makes use of the characteristics of the choice command to be realized, but the xp system seems not to have this command by default.


[ Last edited by lxmxn on 2006-11-2 at 09:27 AM ]
Floor3 kcdsw Posted 2006-11-02 10:49
中级用户 Posts 179 Credits 404


  1. CLS
  2. COLOR 0A
  3. GOTO MENU

  4. :MENU
  5. ECHO.
  6. ECHO. =-=-=-=-=Please select the service item to start=-=-=-=-=
  7. ECHO.
  8. ECHO. 1 Start - Local network service
  9. ECHO.
  10. ECHO. 2 Start - USB and COM service
  11. ECHO.
  12. ECHO. 3 Start - DHCP and NAT service
  13. ECHO.
  14. ECHO. 4 Start - User permission service
  15. ECHO.
  16. ECHO. 5 Start - Start all services
  17. ECHO.
  18. ECHO. 6 Install virtual network cards 1 and 8
  19. ECHO.
  20. ECHO. 7 Exit
  21. ECHO.
  22. ECHO.
  23. ECHO.
  24. set /p in = Please enter the serial number of the selected item:
  25. IF [%in%] == GOTO SERVICE1
  26. IF [%in%] == GOTO SERVICE2
  27. IF [%in%] == GOTO SERVICE3
  28. IF [%in%] == GOTO SERVICE4
  29. IF [%in%] == GOTO SERVICE5
  30. IF [%in%] == GOTO SERVICE6
  31. IF [%in%] == GOTO END
  32. PAUSE >nul

  33. :SERVICE1
  34. NET START VMNETUSERIF
  35. NET START VMNETBRIDGE
  36. GOTO MENU

  37. :SERVICE2
  38. NET START HCMON
  39. NET START VMPARPORT
  40. GOTO MENU

  41. :SERVICE3
  42. SC CREATE VMnetDHCP BINPATH= "%WINDIR%\SYSTEM32\VMNETDHCP.EXE" DISPLAYNAME= "VMware DHCP Service" DEPEND= VMnetuserif
  43. SC CREATE "VMware NAT Service" BINPATH= "%WINDIR%\SYSTEM32\VMNAT.EXE" DISPLAYNAME= "VMware NAT Service" DEPEND= VMnetuserif
  44. NET START VMnetDHCP
  45. NET START "VMware NAT Service"
  46. GOTO MENU

  47. :SERVICE4
  48. SC CREATE VMAuthdService BINPATH= "%CD%\VMWARE-AUTHD.EXE" DISPLAYNAME= "VMware Authorization Service" DEPEND= vmx86
  49. NET START VMAUTHDSERVICE
  50. GOTO MENU

  51. :SERVICE5
  52. NET START VMNETUSERIF
  53. NET START VMNETBRIDGE
  54. SC CREATE VMnetDHCP BINPATH= "%WINDIR%\SYSTEM32\VMNETDHCP.EXE" DISPLAYNAME= "VMware DHCP Service" DEPEND= VMnetuserif
  55. SC CREATE "VMware NAT Service" BINPATH= "%WINDIR%\SYSTEM32\VMNAT.EXE" DISPLAYNAME= "VMware NAT Service" DEPEND= VMnetuserif
  56. NET START VMnetDHCP
  57. NET START "VMware NAT Service"
  58. NET START HCMON
  59. NET START VMPARPORT
  60. SC CREATE VMAuthdService BINPATH= "%CD%\VMWARE-AUTHD.EXE" DISPLAYNAME= "VMware Authorization Service" DEPEND= vmx86
  61. NET START VMAUTHDSERVICE
  62. GOTO MENU

  63. :SERVICE6
  64. DEVCON -R INSTALL %SYSTEMROOT%\INF\VMNETADAPTER.INF *VMnetAdapter1
  65. DEVCON -R INSTALL %SYSTEMROOT%\INF\VMNETADAPTER.INF *VMnetAdapter8
  66. GOTO MENU

  67. :END

  68. Code not tested
kcdsw Posted on: 2006-11-01 22:53
Floor4 youxi01 Posted 2006-11-02 10:51
高级用户 Posts 247 Credits 846 From 湖南==》广东
In Windows 2000/XP, there is no `choice` command. To achieve the function described by the thread starter, you can use `set /P`
Floor5 qingyangecho Posted 2006-11-02 12:03
初级用户 Posts 40 Credits 97
Strangely, adding this file can run in WINDOWS, but no matter whether choice.exe or choice.com is added, it cannot run in DOS.
Floor6 lxmxn Posted 2006-11-02 12:14
版主 Posts 4,938 Credits 11,386

Where did you put the chioce.exe?
Floor7 qingyangecho Posted 2006-11-02 12:35
初级用户 Posts 40 Credits 97
TO:lxmxn
Add to the virtual memory disk generated by the 98 startup disk, in the root directory of this disk along with the batch file.

TO:kcdsw
Thank you for writing this batch file, but it still didn't succeed. No matter which value is selected, it still executes the first one.
Floor8 youxi01 Posted 2006-11-02 12:56
高级用户 Posts 247 Credits 846 From 湖南==》广东
If you add a detection statement and then directly use a goto :service%in%, wouldn't that be much simpler?
Floor9 lxmxn Posted 2006-11-02 13:08
版主 Posts 4,938 Credits 11,386

Should it be added to the system folder?
Floor10 qingyangecho Posted 2006-11-02 13:13
初级用户 Posts 40 Credits 97
This I don't understand, I don't even know where the addition is.
Floor11 qingyangecho Posted 2006-11-02 13:16
初级用户 Posts 40 Credits 97
Originally posted by lxmxn at 2006-11-2 01:08 PM:

Should it be added to the system folder?



The system starts searching for the required files from the folder where it is located, and only goes to the system folder if it can't find them. DOS should be no exception. Also, I want to put this batch file on the boot disk, so there is no such thing as a system folder at all
Floor12 不得不爱 Posted 2006-11-02 20:38
超级版主 Posts 2,044 Credits 5,310 From 四川南充
Then your work path for adding this file in AUTOEXEC.BAT
Floor13 fastslz Posted 2006-11-02 21:24
铂金会员 Posts 2,315 Credits 5,493 From 上海
AUTOEXEC.BAT, NET START I'm wondering whether this batch file is run under pure DOS or in XP?
Floor14 qingyangecho Posted 2006-11-02 22:04
初级用户 Posts 40 Credits 97
Does choice not work in a VM and must be used on a physical machine?
Floor15 fastslz Posted 2006-11-02 22:13
铂金会员 Posts 2,315 Credits 5,493 From 上海
CHOICE extracted from Win2003
http://www.cn-dos.net/forum/viewthread.php?tid=21689&fpage=1&highlight=choice

What system is in the VM? Be sure to clarify whether it's a pure DOS batch or a CMD (XP) batch. There are essential differences between the two
1 2 3  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023