Hi ✌
Just i want to share with you this batch script with a dynamic menu
So in this batch there are 3 items to choice on the menu
Just i want to share with you this batch script with a dynamic menu
So in this batch there are 3 items to choice on the menu
- [1] Start a Process or Multi Processes
- [2] Kill a Process or Multi Processes
- [3] Search for files
PHP Code
<?php
@Echo off & cls & color 0B
Mode con cols=72 lines=11
Set TmpFile=TmpFile.txt
Set Resultat=KillResult.txt
If Exist %TmpFile% Del %TmpFile%
If Exist %Resultat% Del %Resultat%
:menuLOOP
Mode con cols=72 lines=11
Cls & color 0B
Title Process Starter and Killer by Hackoo 2015
echo(
echo( ==========================Menu============================
echo(
for /f "tokens=2* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo( %%A %%B
echo(
echo( ==========================================================
set choice=
echo( & set /p choice=Make a choice or hit ENTER to quit: || GOTO :EOF
echo( & call :menu_[%choice%]
GOTO:menuLOOP
::********************************************************************************************
:menu_[1] Start a Process or Multi Processes
cls & color 0A
echo(
echo Enter the process name or processes names separated by a space
echo(
Set /p "MyProcess=What process(es) do you want to Start ?>"
cls
echo(
echo The process(es) "%MyProcess%" is launched ...
TimeOut /T 1 /NoBreak>nul
For %%a in (%Myprocess%) Do (Start %%a)
GOTO :menuLOOP
::********************************************************************************************
:menu_[2] Kill a Process or Multi Processes
Title Process Killer by Hackoo 2015
cls & color 0B
echo(
echo Enter the process name or processes names separated by a space
echo(
set /p "process=What process(es) do you want to kill ?>"
cls & color 0C
Title Killing "%process%" ...
echo(
echo Killing "%process%" ...
echo(
echo %date% *** %time% >> %TmpFile%
For %%a in (%process%) Do Call :KillMyProcess %%a
Cmd /U /C Type %TmpFile% > %Resultat%
Start %Resultat%
GOTO :menuLOOP
::********************************************************************************************
:menu_[3] Search for files
cls & color 0A
echo(
Set /p "Location=Enter the folder location where do you want to serach> "
cls & echo(
echo You chose this location "%Location%"
echo(
Set /p "FileName=Enter the file name to looking for> "
Mode con cols=90 lines=11
Set Tmp=Tmp.txt
Set SearchResult=SearchResult.txt
echo( & cls
echo( & echo Please Wait for moment .... Searching for "%FileName%" on "%Location%"
where /r "%Location%" "%FileName%" > %Tmp%
Cmd /U /C Type %Tmp% > %SearchResult%
Del %Tmp%
Start %SearchResult%
GOTO :menuLOOP
::*********************************************************************************************
:KillMyProcess
Taskkill /IM "%~n1.exe" /F >> %TmpFile% 2>&1
echo ***************************************************************************** >> %TmpFile%
exit /b
::*********************************************************************************************
:EOF
EXIT

