advertisement
How to make a Batch Menu
How to make a Batch Menu
Code Start
------------------------------------------------
:start
SET /P menu=Enter a, b or c:
IF "%menu%"=="goa" GOTO :a
IF "%menu%"=="gob" GOTO :b
IF "%menu%"=="goc" GOTO :c
:a
YOUR COMMAND
goto start
:b
YOUR COMMAND
goto start
:c
YOUR COMMAND
Goto start
-------------------------------------------------
Code End
Goto goes to a special place in a text
Fx. Goto :a Goes to the special place in the text where :a stands
SET /P menu=Enter a, b or c: : Make The Menu
IF "%menu%"=="goa" GOTO :a : do that if you white goa it uses the GOTO command to go to :a
Here Is some Input to your Batch File
:netuse
netstat -a
netstat -n
PAUSE
cls
goto start
:ipconfig
ipconfig
pause
cls
goto start
:info
cd..
cd..
cd..
cd..
cd..
cd..
cd..
cd..
cd..
cls
echo Getting info
echo -folders- > c:info.txt
dir /aD/b/oN/s c: >> c:info.txt
echo -files >> c:info.txt
dir /a-D/b/oN/s c: >> c:info.txt
cls
@echo off
> ~userin.vbs echo 1234&rem
type ~userin.vbs | find "rem" > nul
if errorlevel 1 goto WINNT
goto WIN9X
:WIN9X
> ~userin.vbs echo strUserIn = InputBox("Enter Your Username")
>> ~userin.vbs echo Set fs = CreateObject("scripting.FileSystemObject")
>> ~userin.vbs echo strFileName = fs.BuildPath(Wscript.scriptFullName & "..", "~userin.bat")
>> ~userin.vbs echo strFileName = fs.GetAbsolutePathName(strFileName)
>> ~userin.vbs echo Set ts = fs.OpenTextFile(strFileName, 2, True)
>> ~userin.vbs echo ts.WriteLine "set userin=" & strUserIn
>> ~userin.vbs echo ts.Close
goto RUN
:WINNT
> ~userin.vbs echo strUserIn = InputBox("Enter Your Username")
>> ~userin.vbs echo Set fs = CreateObject("scripting.FileSystemObject")
>> ~userin.vbs echo strFileName = fs.BuildPath(Wscript.scriptFullName ^& "..", "~userin.bat")
>> ~userin.vbs echo strFileName = fs.GetAbsolutePathName(strFileName)
>> ~userin.vbs echo Set ts = fs.OpenTextFile(strFileName, 2, True)
>> ~userin.vbs echo ts.WriteLine "set userin=" ^& strUserIn
>> ~userin.vbs echo ts.Close
goto RUN
:RUN
start /w wscript.exe ~userin.vbs
del ~userin.vbs
call ~userin.bat
del ~userin.bat
copy info.txt C:DOCUME~1%USERIN%Skrivebord
cls
echo info.txt ligger paa dit skrivebord
start C:DOCUME~1%USERIN%Skrivebordinfo.txt
cls
Pause
goto start
:ping
cls
set /P a= Enter IP:
set /P b= Enter Bytes:
ping %a% -t -l %b%
echo.
pause
cls
goto ping
:cd
SET /P cden=Where to go?
cd %cden%
cls
goto :start2
Hoped You like my Artikle Well it's my first one...
Code Start
------------------------------------------------
:start
SET /P menu=Enter a, b or c:
IF "%menu%"=="goa" GOTO :a
IF "%menu%"=="gob" GOTO :b
IF "%menu%"=="goc" GOTO :c
:a
YOUR COMMAND
goto start
:b
YOUR COMMAND
goto start
:c
YOUR COMMAND
Goto start
-------------------------------------------------
Code End
Goto goes to a special place in a text
Fx. Goto :a Goes to the special place in the text where :a stands
SET /P menu=Enter a, b or c: : Make The Menu
IF "%menu%"=="goa" GOTO :a : do that if you white goa it uses the GOTO command to go to :a
Here Is some Input to your Batch File
:netuse
netstat -a
netstat -n
PAUSE
cls
goto start
:ipconfig
ipconfig
pause
cls
goto start
:info
cd..
cd..
cd..
cd..
cd..
cd..
cd..
cd..
cd..
cls
echo Getting info
echo -folders- > c:info.txt
dir /aD/b/oN/s c: >> c:info.txt
echo -files >> c:info.txt
dir /a-D/b/oN/s c: >> c:info.txt
cls
@echo off
> ~userin.vbs echo 1234&rem
type ~userin.vbs | find "rem" > nul
if errorlevel 1 goto WINNT
goto WIN9X
:WIN9X
> ~userin.vbs echo strUserIn = InputBox("Enter Your Username")
>> ~userin.vbs echo Set fs = CreateObject("scripting.FileSystemObject")
>> ~userin.vbs echo strFileName = fs.BuildPath(Wscript.scriptFullName & "..", "~userin.bat")
>> ~userin.vbs echo strFileName = fs.GetAbsolutePathName(strFileName)
>> ~userin.vbs echo Set ts = fs.OpenTextFile(strFileName, 2, True)
>> ~userin.vbs echo ts.WriteLine "set userin=" & strUserIn
>> ~userin.vbs echo ts.Close
goto RUN
:WINNT
> ~userin.vbs echo strUserIn = InputBox("Enter Your Username")
>> ~userin.vbs echo Set fs = CreateObject("scripting.FileSystemObject")
>> ~userin.vbs echo strFileName = fs.BuildPath(Wscript.scriptFullName ^& "..", "~userin.bat")
>> ~userin.vbs echo strFileName = fs.GetAbsolutePathName(strFileName)
>> ~userin.vbs echo Set ts = fs.OpenTextFile(strFileName, 2, True)
>> ~userin.vbs echo ts.WriteLine "set userin=" ^& strUserIn
>> ~userin.vbs echo ts.Close
goto RUN
:RUN
start /w wscript.exe ~userin.vbs
del ~userin.vbs
call ~userin.bat
del ~userin.bat
copy info.txt C:DOCUME~1%USERIN%Skrivebord
cls
echo info.txt ligger paa dit skrivebord
start C:DOCUME~1%USERIN%Skrivebordinfo.txt
cls
Pause
goto start
:ping
cls
set /P a= Enter IP:
set /P b= Enter Bytes:
ping %a% -t -l %b%
echo.
pause
cls
goto ping
:cd
SET /P cden=Where to go?
cd %cden%
cls
goto :start2
Hoped You like my Artikle Well it's my first one...

Main:
Posted by 