Reputation: 313
So I have this simple shortcut script but when I select a number that is higher than 9 it opens authorization manager and does not recognize the second digit. I have played around with the settings but to no avail and Google isn't much of a help with this one.
@title Microsoft Management Console
@echo ┌───────────────MAIN MENU─────────────────▄
@echo │Choices: █
@echo │ █
@echo │ 1. Authorization Manager █
@echo │ 2. Certificates Local Computer █
@echo │ 3. Certificates Current User █
@echo │ 4. Component Services █
@echo │ 5. Computer Management █
@echo │ 6. Device Manager █
@echo │ 7. Disk Manager █
@echo │ 8. Event Viewer █
@echo │ 9. Local Users Manager █
@echo │10. Performance Manager █
@echo │11. Print Server █
@echo │12. Services █
@echo │13. Shared Folder Manager █
@echo │14. SQL Server Config █
@echo │15. Task Scheduler █
@echo │16. Windows Firewall █
@echo │17. Exit █
@echo │ █
@echo └▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
@set /p userinp=Type the number of your choice:
@set userinp=%userinp:~0,1%
@if "%userinp%"=="1" azman.msc
@if "%userinp%"=="2" certlm.msc
@if "%userinp%"=="3" certmgr.msc
@if "%userinp%"=="4" comexp.msc
@if "%userinp%"=="5" compmgmt.msc
@if "%userinp%"=="6" devmgmt.msc
@if "%userinp%"=="7" diskmgmt
@if "%userinp%"=="8" eventvwr.msc
@if "%userinp%"=="9" lusrmgr.msc
@if "%userinp%"=="10" perfmon.msc
@if "%userinp%"=="11" printui /s /t2
@if "%userinp%"=="12" services.msc
@if "%userinp%"=="13" fsmgmt.msc
@if "%userinp%"=="14" sqlservermanager10.msc
@if "%userinp%"=="15" taskschd.msc
@if "%userinp%"=="16" wf.msc
@if "%userinp%"=="17" exit
Upvotes: 0
Views: 2270
Reputation: 8185
Change
@set userinp=%userinp:~0,1%
to
@set userinp=%userinp:~0,2%
In your original version, you are requesting 1 character starting from the 0th character. The first number represents the starting character index, and the second one represents the number of characters to get.
Upvotes: 2