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
Related
#echo off
set /P user= Enter number:
echo You have entered %user%
if %user%
(
start "C:\Program Files\Mozilla Firefox\firefox.exe"
)
else if %user%
(
start "C:\Program Files\google chrome\chrome.exe"
)
else
Pause
You can do like this with a Menu :
#Echo OFF
Mode 60,12 & color 9E
Title Start and open a Program
:MENU
CLS
ECHO.
ECHO =====================================================
ECHO PRESS 1, 2 OR 3 to select your task, or 4 to EXIT.
ECHO =====================================================
ECHO.
ECHO 1 - Open Firefox
ECHO 2 - Open Chrome
ECHO 3 - Open Internet Explorer
ECHO 4 - EXIT
ECHO.
SET /P "user=Type 1, 2, 3, or 4 then press ENTER : "
IF "%user%"=="1" GOTO Firefox
IF "%user%"=="2" GOTO Chrome
IF "%user%"=="3" GOTO Internet Explorer
IF "%user%"=="4" GOTO EOF
GOTO MENU
:Firefox
start "" "Firefox.exe"
GOTO MENU
:Chrome
start "" "chrome.exe
GOTO MENU
:Internet Explorer
Start "" "iexplore.exe"
GOTO MENU
The code below lets the user to choose whether they want to open chrome or Firefox by choosing y for Firefox and n for chrome you can change the inputs to 1 or 2 or what ever you like.
Check if your paths are correct to the .exes
(Paths are different on my PC)
#echo off
set user=
set /P user=Type input y/n: %=%
pause
if "%user%" == "y" goto mozzila
if "%user%" == "n" goto chrome
:mozzila
cd C:\Program Files\Mozilla Firefox\
firefox.exe
:chrome
cd C:\Program Files\google chrome\
chrome.exe
Pause
I hope this solves your problem
#echo on
set /P user=Enter number:
echo You have entered %user%
IF /i "%user%" == "1" goto 1
IF /i "%user%" == "2" goto 2
:1
cd "C:\Program Files\Mozilla Firefox"
start firefox.exe
exit
:2
cd "C:\Program Files\google chrome"
start chrome.exe
exit
When the user enters 1 the first program is execute when 2 the second
You can use the choice command too:
#Echo Off
Echo 1. Firefox
Echo 2. Chrome
Echo 3. Internet Explorer
Choice /C 123 /M "Please make your choice"
If ErrorLevel 3 (Set "BEP=Internet Explorer\iexplore.exe"
) Else If ErrorLevel 2 (Set "BEP=Google Chrome\chrome.exe"
) Else Set "BEP=Mozilla Firefox\firefox.exe"
If Exist "%ProgramFiles%\%BEP%" Start "" "%ProgramFiles%\%BEP%"
The correct format of "IF...ELSE..." is :
IF %user% (
start "C:\Program Files\Mozilla Firefox\firefox.exe"
) ELSE (
IF %user% (
start "C:\Program Files\google chrome\chrome.exe"
) ELSE ( sth. )
)
the ELSE must follow the round bracket in the same line.
I wonder if there is a possibility the code below to enable a progress bar or percentage counter to check the progress of download, however alternativar not seen since the download is being executed by the FTP client.
Follows the code:
ECHO OFF
Color 17
Setlocal ENABLEDELAYEDEXPANSION
CLS
:MENU
ECHO.
ECHO ...............................................
ECHO . Selecione o numero desejado no menu abaixo .
ECHO ...............................................
ECHO.
ECHO 1 - Atualizar Frente/Retaguarda
ECHO 2 - Atualizar Rgourmet
ECHO 3 - Exit
ECHO.
SET /P M=Selecione 1, 2, ou 3 e pressione ENTER:
IF %M%==1 GOTO FRENTE
IF %M%==2 GOTO RGOURMET
IF %M%==3 GOTO SAIR
:FRENTE
# echo off
echo open 177.125.217.138>>frente.ftp
echo ****>>frente.ftp
echo ****>>frente.ftp
echo hash>>frente.ftp
echo cd atualizador>>frente.ftp
echo binary>>frente.ftp
echo get "libx12.dll">>frente.ftp
echo get "rjkmonitor.exe">>frente.ftp
echo get "rjkini.exe">>frente.ftp
echo quit>>frente.ftp
# echo off
echo off taskkill /F /IM rjkpdv.exe > NUL
echo off taskkill /F /IM libx12.dll > NUL
echo off taskkill /F /IM rjkretaguarda.exe > NUL
ftp -v -i -s:frente.ftp
if exist macro.txt (
rjkpdv.exe /a
rjkini.exe
) else (
del rjkretaguarda.exe
ren libx12.dll rjkretaguarda.exe
rjkretaguarda.exe /a
rjkini.exe
)
del frente.ftp
cls
GOTO MENU
:RGOURMET
# echo off
taskkill /F /IM rgourmet.exe
taskkill /F /IM rmt.exe
echo open 177.125.217.138>>rgourmet.ftp
echo ****>>rgourmet.ftp
echo ****>>rgourmet.ftp
echo hash>>rgourmet.ftp
echo cd atualizador>>rgourmet.ftp
echo binary>>rgourmet.ftp
echo get "rgourmet.exe">>rgourmet.ftp
echo get "rmt.exe">>rgourmet.ftp
echo get "rjkini.exe">>rgourmet.ftp
echo quit>>rgourmet.ftp
# echo off
ftp -v -i -s:rgourmet.ftp
rgourmet.exe /asgb
rjkini.exe
del rgourmet.ftp
cls
GOTO MENU
:SAIR
exit
The build-in Windows command-line FTP client (ftp.exe) cannot display progress of the transfer. All it can do, is what you already get with the hash command.
You have to use another FTP client to get percentage progress.
For example with WinSCP FTP client, you get the percentage progress by default.
winscp.com /command ^
"open ftp://rjk:password#177.125.217.138/" ^
"cd atualizador" ^
"get libx12.dll" ^
"get rjkmonitor.exe" ^
"get rjkini.exe" ^
"exit"
See a guide for converting Windows FTP script to WinSCP script.
(I'm the author of WinSCP)
I am combining multiple Batch files I made into 1 Batch file.
I have a few questions.
I am going through thousands of pictures and when I come across 1 that I need I copy it to my documents to review later, that's what the "copy" in the script is for. I have it set up to loop so I can just keep entering files to send to my documents.
First. I would like to be able to jump back to the menu when I type Menu, so it would leave the loop and goto :MENU.
Second. I have no idea if this is possible... but going through so many pictures that I would like to be able to save where I left off. Thats where the GOTO :Set comes in to play. I would like to be able to type in the number of the picture and have the Batch file save it, so that when I enter GOTO :OPEN it will then open the picture I left off on.
Sorry if this sounds confusing, any help would be great. If you have any questions feel free to ask
Thank you
ECHO OFF
CLS
:MENU
CLS
ECHO.
ECHO ...............................................
ECHO Welcome to the sub-menu
ECHO ...............................................
ECHO.
ECHO 1 - Rename files in folder.
ECHO 2 - Copy files to My Documents.
ECHO 3 - Set file to you left off on.
ECHO 4 - Open file you left off on.
ECHO 5 - Exit.
ECHO.
SET /P M=Type 1, 2, 3, or 4 then press ENTER:
IF %M%==1 GOTO Rename
IF %M%==2 GOTO COPY
IF %M%==3 GOTO SET
IF %M%==4 GOTO OPEN
:Rename
setlocal EnableDelayedExpansion
set i=0
for %%a in (*.jpg) do (
set /a i+=1
ren "%%a" "!i!.new"
)
ren *.new *.jpg
GOTO MENU
:COPY
cls
SET /P filename=Enter the file which should be moved:
xcopy %filename%.* C:\Users\USERNAME\Documents
if not exist %filename%.* goto :Failure
if exist %filename%.* goto :data
GOTO MENU
:SET
GOTO MENU
:OPEN
GOTO Me
:Failure
echo Failure
pause
goto :COPY
:data
timeout /t 3
goto :COPY
I Figured out another way to leave the loop, now I just need to enter anything that does not match a name in the folder.
This is what I have now and is working Great.
ECHO OFF
CLS
:MENU
CLS
ECHO.
ECHO ...............................................
ECHO Welcome to the sub-menu
ECHO ...............................................
ECHO.
ECHO 1 - Rename files in folder.
ECHO 2 - Copy files to My Documents.
ECHO 3 - Set file to you left off on.
ECHO 4 - Open file you left off on.
ECHO 5 - Exit.
ECHO.
SET /P M=Type 1, 2, 3, or 4 then press ENTER:
IF %M%==1 GOTO Rename
IF %M%==2 GOTO COPY
IF %M%==3 GOTO SET
IF %M%==4 GOTO OPEN
:Rename
setlocal EnableDelayedExpansion
set /p i=Enter Starting Number:
for %%a in (*.JPG) do (
set /a i+=1
ren "%%a" "!i!.new"
)
ren *.new *.JPG
GOTO MENU
:COPY
cls
SET /P filename=Enter the file which should be moved:
xcopy %filename%.* C:\Users\USERNAME\Documents
if not exist %filename%.* goto :Failure
if exist %filename%.* goto :data
:Failure
goto :menu
:data
timeout /t 3
goto :copy
GOTO MENU
:SET
cls
del temp.txt
set INPUT=
set /P INPUT=Type input: %=%
echo Your input was: %INPUT%
pause
echo %INPUT%.JPG >>temp.txt
GOTO MENU
:OPEN
set /p texte=< temp.txt
echo %texte%
pause
set q=%texte%
start %texte%
GOTO menu
:Failure
echo Failure
pause
goto :COPY
:data
timeout /t 3
goto :COPY
So here's my ENTIRE code:
#echo off
cls
color fc
:Start
cls
echo Welcome to -{GAMELOADER}-
set/p u=Username:
if %u%==username goto Correct1
if not %u%==username goto Incorrect
:Incorrect
cls
echo You Have Entered Incorrect Pass And/Or Username!
set/p t=Try Again? (Y/N)
if %t%==Y goto Start
if %t%==y goto Start
if %t%==N goto Quit
if %t%==n goto Quit
:Correct1
set/p p=Password:
if %p%==password goto Open
if not %p%==password goto Incorrect
:Open
cls
echo Games:
echo ------------------------
echo [1]Kerbal Space Program
echo ------------------------
set/p g=Choice:
if %g%== 1 goto KSPEnd
:KSPEnd
start "" "C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP.exe"
cls
goto Quit
:Quit
cls
echo Goodbye
Timeout 1
But the code opens the .exe AND a .txt file with exactly the same name. I can't rename the files. So basically i'm asking how to open a specific file type.
Thanks
Instead of starting C:\....\KSP.exe, first go to the right directory, then start KSP:
cd "C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program"
KSP.exe
Ok I've got two things for you. Firstly I'll give you you desired solution.
Treat it like an operatable program
rem To start Kerbal Space Program:
set Path=C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program;%Path%
start KSP
Thats it. Really.
Secondly:
Use the Choice command
you keep on using set /p where choice would be much better.
Just to be convenient I redid you code with everything I would do. Have fun!
Code :
#echo off
cls
color fc
title -{GAMELOADER}-
:Start
echo Welcome to -{GAMELOADER}-
set/p u=Username:
if %u%==username goto Correct1
if not %u%==username goto Incorrect
set Er=Userid
goto :Crash
:Incorrect
cls
echo You Have Entered Incorrect Pass And/Or Username!
choice /c yn /m "Try Again?"
if %errorlevel%==1 goto Start
if %errorlevel%==2 goto Quit
set Er=Loop-End_of_stream
goto :Crash
:Correct1
set/p p=Password:
if %p%==password goto Open
if not %p%==password goto Incorrect
set Er=Passid
goto :Crash
:Open
cls
echo Games:
echo ------------------------
echo [1]Kerbal Space Program
echo ------------------------
echo.
Choice /c 1 /m "Game: "
if %errorlevel%==1 goto KSPEnd
set Er=Gameid
goto :Crash
:KSPEnd
set Path=C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program;%Path%
start KSP
goto Quit
set Er=End_of_file___UNKNOWN
goto :Crash
:Quit
cls
echo Goodbye
Timeout 1
Exit
:Crash
Rem Always useful :)
Echo Program has crashed Error: %Er%
Pause
Exit
Hope that helped. Mona
i have a question . It is possible to make a batch menu to accept multiple commands at the same time?
Example : ( my code )
#ECHO OFF
set tries=6
:top
cls
set /a tries=%tries% -1
if %tries%==0 (
goto penalty
)
Echo You have %tries% attempts left.
Echo Please enter your password to proceed
set /p password=
if %password%==Parola ta (
echo Welcome Your Name
ping localhost -n 5 >nul
cls
Echo CONNECTED!
C:
CD\
CLS
:MENU
CLS
ECHO ============= MENU NAME =============
ECHO -------------------------------------
ECHO 1. System Information TXT file
ECHO 2. Selection 2
ECHO 3. Selection 3
ECHO 4. Selection 4
ECHO 5. Selection 5
ECHO 6. Selection 6
ECHO 7. Selection 7
ECHO -------------------------------------
ECHO 8. Selection 8
ECHO -------------------------------------
ECHO 9. Selection 9
ECHO -------------------------------------
ECHO ==========PRESS 'Q' TO QUIT==========
ECHO.
SET INPUT=
SET /P INPUT=Please select a number:
IF /I '%INPUT%'=='1' GOTO Selection1
IF /I '%INPUT%'=='2' GOTO Selection2
IF /I '%INPUT%'=='3' GOTO Selection3
IF /I '%INPUT%'=='4' GOTO Selection4
IF /I '%INPUT%'=='5' GOTO Selection5
IF /I '%INPUT%'=='6' GOTO Selection6
IF /I '%INPUT%'=='7' GOTO Selection7
IF /I '%INPUT%'=='8' GOTO Selection8
IF /I '%INPUT%'=='9' GOTO Selection9
IF /I '%INPUT%'=='Q' GOTO Quit
CLS
ECHO ============INVALID INPUT============
ECHO -------------------------------------
ECHO Please select a number from the Main
echo Menu [1-9] or select 'Q' to quit.
ECHO -------------------------------------
ECHO ======PRESS ANY KEY TO CONTINUE======
PAUSE > NUL
GOTO MENU
:Selection1
systeminfo.exe>systeminfo.txt
ECHO ============INVALID INPUT============
ECHO -------------------------------------
ECHO Please select a number from the Main
echo Menu [1-9] or select 'Q' to quit.
ECHO -------------------------------------
ECHO ======PRESS ANY KEY TO CONTINUE======
PAUSE > NUL
GOTO MENU
:Selection2
Call cleanup.bat
:Selection3
and in here too...
:Selection4
and so on
:Selection5
and so on
:Selection6
and so on
:Selection7
and so on
:Selection8
and so on
:Selection9
and so on
:Quit
CLS
ECHO ==============THANKYOU===============
ECHO -------------------------------------
ECHO ======PRESS ANY KEY TO CONTINUE======
PAUSE>NUL
EXIT
pause
cls
) else (
goto top
)
goto top
How to make the program accept more than 1 command?
For example 1,3,5 to execute in the same time?
or another question, how its possible to undo .exe back to .bat?
there such a program?
Suggestion: make call from goto and concatenate the commands with &:
IF /I '%INPUT%'=='1' GOTO:Selection1
IF /I '%INPUT%'=='2' CALL:Selection2&CALL:Selection2&CALL:Selection4
IF /I '%INPUT%'=='3' CALL:Selection3&CALL:Selection3
IF /I '%INPUT%'=='4' CALL:Selection4&CALL:Selection4
IF /I '%INPUT%'=='5' CALL:Selection5
IF /I '%INPUT%'=='6' CALL:Selection6
IF /I '%INPUT%'=='7' CALL:Selection7
IF /I '%INPUT%'=='8' CALL:Selection8
IF /I '%INPUT%'=='9' CALL:Selection9
IF /I '%INPUT%'=='Q' GOTO:Quit
To get this work you must alse add goto:eof (eof=end of file) after the jump labels, eg.:
:Selection2
Call cleanup.bat
goto:eof
:Selection3
and in here too...
goto:eof
:Selection4
and so on
goto:eof
:Selection5
and so on
goto:eof
...
..
.
goto:eof returns control to the main program.
Is this what you were looking for?
File Menu.cmd
#echo off
setlocal
set quit=false
set /p InputChoices=Enter Choice(s) (A,B,C)
echo %InputChoices%
call :executeChoices %InputChoices%
endlocal
goto :eof
:executeChoices
if [%1]==[] goto :eof
call :Step%1
shift
goto :executeChoices
goto :eof
:StepA
echo Step A
goto :eof
:StepB
echo Step B
goto :eof
:StepC
echo Step C
goto :eof
Works like this:
c:\>Menu.cmd
Enter Choice(s) (A,B,C) b c a
b c a
Step B
Step C
Step A
You can use the start "" command keyword and each command will run in it's own window, but initiated by your menu batch file.