batch-file - How do I make a batch file that opens certain programs?
问题描述
cls
@ECHO OFF
title Heirloom SS Tool
:MENU
ECHO.
ECHO __________________________
ECHO| Select SS Option |
ECHO --------------------------
ECHO.
ECHO 1 -> Open Horion Folder
ECHO 2 -> Open Advanced Search Tool
ECHO 3 -> Open UserAssistView
ECHO 4 -> Open LastActivityView
ECHO 5 -> Open ProcessHacker
SET /P M=Type 1, 2, 3, 4 or 5 then press ENTER:
IF %M%==1 GOTO Horion
IF %M%==2 GOTO Search
IF %M%==3 GOTO UAV
IF %M%==4 GOTO LAV
IF %M%==5 GOTO PH
:Horion
explorer C:\Users\%USERNAME%\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\RoamingState
GOTO MENU
:Search
cd Tools\Search
start everything.exe
GOTO MENU
:UAV
cd Tools\UAV
start UserAssistView.exe
GOTO MENU
:LAV
cd Tools\LAV
start LastActivityView.exe
GOTO MENU
:PH
cd Tools\ProccessHacker
start ProcessHacker.exe
GOTO MENU
EXIT
Basically im trying to make a batch file that opens these certain files that i put in the same folder as this batch. When i start the batch file it just opens a CMD Prompt for a second and then closes! Can anyone help me solve this?
解决方案
You need to escape special characters redirect >
and pipe |
using caret ^
as already mentioned to you by @Neko in a comment.
I would however rather use choice
instead of set /p
cls
@echo off
title Heirloom SS Tool
:menu
echo.
echo __________________________
echo ^| Select SS Option ^|
echo --------------------------
echo.
echo 1 -^> Open Horion Folder
echo 2 -^> Open Advanced Search Tool
echo 3 -^> Open UserAssistView
echo 4 -^> Open LastActivityView
echo 5 -^> Open ProcessHacker
choice /c 12345 /M "Select: "
goto choice%errorlevel%
:choice5
echo cd Tools\ProccessHacker
echo start ProcessHacker.exe
goto menu
:choice4
echo cd Tools\LAV
echo start LastActivityView.exe
goto menu
:choice3
echo cd Tools\UAV
echo start UserAssistView.exe
goto menu
:choice2
echo cd Tools\Search
echo start everything.exe
goto menu
:choice1
echo explorer "C:\Users\%USERNAME%\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\RoamingState"
goto menu
:choice0
exit
You can read more about choice
by running choice /?
from cmd
推荐阅读
- azure-active-directory - 调用 .\auth\refresh 端点后 Azure 应用服务身份验证令牌未刷新
- reactjs - 我收到一个错误“未定义许可证”,即使我确定它们在 setdetails 函数中是什么?我该如何解决这个问题?
- android-tv - 如何检测消防电视应用程序何时最小化?
- visual-studio - 通过命令行发布 Windows 应用程序包项目
- c - 带返回值的 pthread 函数的基本用法
- tensorflow - 为 SQLite 格式的 TFF 创建自定义联合图像数据集的最佳方法是什么?
- sql - SQL returning two rows matching different criteria into separate columns
- python - 删除标头和尾标后如何将文件从一个位置复制到 S3 中的另一个位置
- ajax - Wordpress 通过 Ajax 发送电子邮件而不刷新页面挂在 admin_ajax.php
- firebase - 使用 Firebase 图像制作轮播滑块时出错