dos batch quick finder v 1.0

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
dragovian
Posts: 17
Joined: 30 Jul 2009 09:43
Location: Belgium - Leuven
Contact:

dos batch quick finder v 1.0

#1 Post by dragovian » 01 Aug 2009 09:40

first of all :) feel free to copy and use this code. all i wish is that if you "distribute" it or send the code to someone else, that you keep the heading as it is :).

My thanks to avery_larry and rfpd for helping me with code optimization and sorting out some of the input errors :)

second of all :

the program i used for the Music part, is foobar2000, which is operable through cmd.

i also used ccleaner and it's cmd commands.

the personal folders will need to be adjusted to your folders. ( as will the Music folders that i'm pushing to :) ).

cheers

and enjoy :)

Code: Select all

check below :) 
Last edited by dragovian on 24 Aug 2009 13:13, edited 1 time in total.

thr333
Posts: 16
Joined: 24 Aug 2009 10:24

#2 Post by thr333 » 24 Aug 2009 13:05

Excellent Man ++++
Very useful tool.
A great little minimalist launcher.
well done.

dragovian
Posts: 17
Joined: 30 Jul 2009 09:43
Location: Belgium - Leuven
Contact:

#3 Post by dragovian » 24 Aug 2009 13:12

thr333 wrote:Excellent Man ++++
Very useful tool.
A great little minimalist launcher.
well done.


i've been doing some "extra" coding to it, and enhancing some of the stuff i already had in there :)

here's the "updated" code.

hope ya like it :)

ps: if you spread the code to your friends/colleauges/pets/whatever please mention my name and this site ( for future reference that is ^^ )

Dos Batch Quick Finder v 2.0

ps : the music part, works on any drive, as long as the directory is called Muziek and is directly in the drive folder, not in any subdirectory. ( and if you're usin foobar of course^^ ) i've also added a defrag section, which was a real challenge to me, since i too am quite new to cmd scripting

Code: Select all

@echo off
title Quick Finder
color 0A
echo -------------------------------------------------------------
echo ------------    Dragovian Design Quick Finder    ------------
echo -------------------------------------------------------------
echo.
echo.
set name=
set /p name=What's your name ?
cls
echo -----------------------------------------------------------
echo ---------@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-------------
echo ---------^|^|                                 ^|^|-------------
echo ---------^|^|  Dragovian Design Quick Finder  ^|^|-------------
echo ---------^|^|                                 ^|^|-------------
echo ---------@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-------------
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo ----------x----------------x----------------x--------------
echo ---------xxx--------------xxx--------------xxx-------------
echo --------xxxxx------------xxxxx------------xxxxx------------
echo -------xxxxxxx----------xxxxxxx----------xxxxxxx-----------
echo ------xxxxxxxxx--------xxxxxxxxx--------xxxxxxxxx----------
echo -------^|     ^|----------^|     ^|----------^|     ^|-----------
echo ------@^| 0 0 ^|@--------@^| 0 0 ^|@--------@^| 0 0 ^|@----------
echo -------^\  o  ^/----------^\  o  ^/----------^\  o  ^/-----------
echo --------^\   ^/------------^\   ^/------------^\   ^/------------
echo ---------°°°--------------°°°--------------°°°-------------
echo ---------°°°--------------°°°--------------°°°-------------
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo.
set date=%date /t%
set time=%time /t%
set ver=%VER%
echo Date : %date%
echo Time : %time%
echo.
echo hello %name%, welcome to dragovian apps quick finder
echo.
echo this is one of the faster ways to fly around windows
echo.
echo if you want to check the list of available commands
echo type in "help" and all available commands will be shown
echo in an instant
echo.
echo.
echo enjoy
echo.
echo.
:a
set input=
set /p input=input:
REM the following line will make sure that if the user just presses enter, the command
REM window does not close

if not defined input goto a
if "%INPUT%"=="Music" goto Music
if "%INPUT%"=="Movie" goto Movie
if "%INPUT%"=="CMD" goto CMD
if "%INPUT%"=="cmd" goto CMD
if "%INPUT%"=="clean" goto clean
if "%INPUT%"=="exit" goto exit
if "%INPUT%"=="youtube" goto youtube
if "%INPUT%"=="tribalwars" goto tribalwars
if "%INPUT%"=="google" goto google
if "%INPUT%"=="hotmail" goto hotmail
if "%INPUT%"=="howestmail" goto howestmail
if "%INPUT%"=="dokeos" goto dokeos
if "%INPUT%"=="facebook" goto facebook
if "%INPUT%"=="netlog" goto netlog
if "%INPUT%"=="wikipedia" goto wikipedia
if "%INPUT%"=="photoshop" goto photoshop
if "%INPUT%"=="illustrator" goto illustrator
if "%INPUT%"=="flash" goto flash
if "%INPUT%"=="notepad" goto notepad
if "%INPUT%"=="word" goto word
if "%INPUT%"=="powerpoint" goto powerpoint
if "%INPUT%"=="excel" goto excel
if "%INPUT%"=="onenote" goto onenote
if "%INPUT%"=="outlook" goto outlook
if "%INPUT%"=="officepmng" goto officepmng
if "%INPUT%"=="msclip" goto msclip
if "%INPUT%"=="mquery" goto mquery
if "%INPUT%"=="mspublisher" goto mspublisher
if "%INPUT%"=="access" goto access
if "%INPUT%"=="msinfopath" goto msinfopath
if "%INPUT%"=="groove" goto groove
if "%INPUT%"=="dreamweaver" goto dreamweaver
if "%INPUT%"=="help" goto help
if "%INPUT%"=="documentsDir" goto documentsDir
if "%INPUT%"=="picturesDir" goto picturesDir
if "%INPUT%"=="homeDir" goto homeDir
if "%INPUT%"=="musicDir" goto musicDir
if "%INPUT%"=="website" goto website
if "%INPUT%"=="cls" goto cls
if "%INPUT%"=="colorChange" goto colorChanger
if "%INPUT%"=="calc" goto calc
if "%INPUT%"=="discovery" goto discovery
if "%INPUT%"=="w3schools" goto w3schools
if "%INPUT%"=="defrag" goto defrag
if "%INPUT%"=="afterEffects" goto afterEffects
if "%INPUT%"=="flash" goto flash
if "%INPUT%"=="contribute" goto contribute
if "%INPUT%"=="bridge" goto bridge
if "%INPUT%"=="fireworks" goto fireworks
if "%INPUT%"=="encore" goto encore
if "%INPUT%"=="indesign" goto indesign
if "%INPUT%"=="premiere" goto premiere
if "%INPUT%"=="soundbooth" goto soundbooth
if "%INPUT%"=="aptana" goto aptana
echo.
echo command not valid
echo.
goto a

:Music
@echo off
fsutil fsinfo drives >> temp.txt
for /f "delims=" %%A in ('findstr /b "Drives" temp.txt') do set YourVar=%%A
set mysubstr=%YourVar:~8%
del temp.txt
IF EXIST "drives.txt" (
del drives.txt
)
set /a count=1
echo.
echo Music Menu
echo.
for %%A in (%mysubstr%) do (
call countIncrement.bat %count% %%A
)
echo.
echo please specify the drive containing the Music Directory ?
echo Type the drivename and a colon
echo.
echo Example : "C:"
echo.
set input=
set /p input=Drive :
set increment=0;
set driveMusic=
if not defined input (goto a)
for /f "delims=" %%A in ('findstr /b %INPUT% drives.txt') do set driveMusic=%%A
set mymusicDrive=%driveMusic:~0,3%
if not defined driveMusic (echo.
echo Drive not found
echo.
goto a)
echo %mymusicDrive%Muziek
PUSHD %mymusicDrive%Muziek
echo.
FOR /D %%i IN (*.*) DO echo - %%i
echo.
POPD
echo Choose one from the previous list or press Enter to return
echo.
echo Music Controls :
echo.
echo    - pause
echo    - play
echo    - next
echo    - previous
echo    - show
echo    - hide
echo.
set input=
set /p input=Music input:

REM this checks if the input isn't "nothing"

if not defined input goto a

REM this goes to the the directory where i store my music

PUSHD %mymusicDrive%Muziek

REM this checks if the directory does actually exist ( if the user didn't mistype )

For /D %%i IN (*.*) DO if "%INPUT%" EQU "%%i" goto startMusic
if "%INPUT%"=="next" (c:"Program files"\foobar2000\foobar2000.exe /next
goto a)
if "%INPUT%"=="previous" (c:"Program files"\foobar2000\foobar2000.exe /prev
goto a)
if "%INPUT%"=="pause" (c:"Program files"\foobar2000\foobar2000.exe /pause
goto a)
if "%INPUT%"=="play" (c:"Program files"\foobar2000\foobar2000.exe /play
goto a)
if "%INPUT%"=="show" (c:"Program files"\foobar2000\foobar2000.exe /show
goto a)
if "%INPUT%"=="hide" (c:"Program files"\foobar2000\foobar2000.exe /hide
goto a)

REM if the user mistyped he'll come here

echo.
echo The directory does no exist
echo.
goto a

REM if the user typed correctly the songs in the directory will be loaded into foobar

:startMusic
start c:"Program files"\foobar2000\foobar2000.exe /command:open "%INPUT%" /play
POPD
goto a
   
:Movie
start C:"Program Files""Real Alternative""Media Player Classic"\mplayerc.exe
goto a
:CMD
start C:\WINDOWS\System32\cmd.exe
goto a
:clean
start c:"Program Files"\CCleaner\ccleaner.exe /AUTO
goto a

REM --------------
REM ADOBE PROGRAMS
REM --------------

:photoshop
start photoshop.exe
goto a
:illustrator
start illustrator.exe
goto a
:flash
start flash.exe
goto a
:dreamweaver
start dreamweaver.exe
goto a
:afterEffects
start AfterFX.exe
goto a
:flash
start flash.exe
:contribute
start contribute.exe
goto a
:bridge
start Bridge.exe
goto a
:fireworks
start fireworks.exe
goto a
:encore
start C:"Program Files"\Adobe"Adobe Encore CS4""Adobe Encore".exe
goto a
:indesign
start InDesign.exe
goto a
:premiere
start c:"program files"\Adobe"Adobe Premiere Pro CS4""Adobe Premiere Pro".exe
goto a
:soundbooth
start C:"Program Files"\Adobe"Adobe Soundbooth CS4""Adobe Soundbooth CS4".exe
goto a

REM --------
REM PROGRAMS
REM --------

:notepad
start notepad.exe
goto a

REM ------
REM OFFICE
REM ------

:word
start winword.exe
goto a
:powerpoint
start powerpnt.exe
goto a
:excel
start EXCEL.exe
:onenote
start onenote.exe
goto a
:outlook
start outlook.exe
goto a
:officepmng
start ois.exe
goto a
:msclip
start mstore.exe
goto a
:mquery
start MSQRY32.exe
goto a
:mspublisher
start mspub.exe
goto a
:access
start MSACCESS.exe
goto a
:msinfopath
start INFOPATH.exe
goto a
:groove
start GROOVE.exe
goto a
:aptana
start %userprofile%\AppData\Local"Aptana Studio 1.2"\AptanaStudio.exe
goto a
REM --------
REM COMMANDS
REM --------
:defrag
fsutil fsinfo drives >> temp.txt
for /f "delims=" %%A in ('findstr /b "Drives" temp.txt') do set YourVar=%%A
set mysubstr=%YourVar:~8%
del temp.txt
IF EXIST "drives.txt" (
del drives.txt
)
set /a count=1
echo.
echo Defragment Menu
echo.
for %%A in (%mysubstr%) do (
call countIncrement.bat %count% %%A
)
echo.
echo please specify the drive to defrag ?
echo Type the drivename and a colon
echo.
echo Example : "C:"
echo.
set input=
set /p input=Drive :
set increment=0;
set driveDefrag=
if not defined input (goto a)
for /f "delims=" %%A in ('findstr /b %INPUT% drives.txt') do set driveDefrag=%%A
if not defined driveDefrag (echo.
echo Drive not found
echo.
goto a)
start defrag /v %driveDefrag%
goto a
:cls
cls
echo -----------------------------------------------------------
echo ---------@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-------------
echo ---------^|^|                                 ^|^|-------------
echo ---------^|^|  Dragovian Design Quick Finder  ^|^|-------------
echo ---------^|^|                                 ^|^|-------------
echo ---------@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@-------------
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo ----------x----------------x----------------x--------------
echo ---------xxx--------------xxx--------------xxx-------------
echo --------xxxxx------------xxxxx------------xxxxx------------
echo -------xxxxxxx----------xxxxxxx----------xxxxxxx-----------
echo ------xxxxxxxxx--------xxxxxxxxx--------xxxxxxxxx----------
echo -------^|     ^|----------^|     ^|----------^|     ^|-----------
echo ------@^| 0 0 ^|@--------@^| 0 0 ^|@--------@^| 0 0 ^|@----------
echo -------^\  o  ^/----------^\  o  ^/----------^\  o  ^/-----------
echo --------^\   ^/------------^\   ^/------------^\   ^/------------
echo ---------°°°--------------°°°--------------°°°-------------
echo ---------°°°--------------°°°--------------°°°-------------
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo.
echo.
goto a
:exit
echo.
echo thank you for using dragovian apps quick finder
echo.
exit
:calc
start calc.exe
goto a
:help
echo -------------------------------------------------
echo ------------- HELP SECTION ----------------------
echo -------------------------------------------------
echo.
echo ^>^>^>^>^> the word before the colon is the command
echo ^>^>^>^>^> the text after the colon is the descr.
echo.
echo - ^Music : opens the music userinput
echo - ^clean : Autoruns Ccleaner
echo - ^exit : exits the quick finder
echo - cls : cleans the screen
echo - colorChange : opens the Color menu
echo - defrag : opens defrag menu
echo - aptana : fires up aptana studio
echo -
echo -------------------------------------------------
echo - Websites --------------------------------------
echo -------------------------------------------------
echo -
echo - ^youtube : goes to youtube.com
echo - ^tribalwars : tribalwars.nl
echo - ^google : google.be
echo - ^hotmail : hotmail.Com
echo - ^howestmail : opens howest webmail
echo - ^dokeos : opens howest dokeos
echo - ^facebook : opens facebook
echo - ^netlog : opens netlog
echo - ^wikipedia : opens wikipedia
echo - ^Discovery : opens discovery channel
echo - ^w3schools : opens w3schools
echo -
echo - website : opens the website input
echo -
echo -------------------------------------------------
echo - Adobe Programs --------------------------------
echo -------------------------------------------------
echo -
echo - ^Photoshop : Adobe Photoshop
echo - ^Illustrator : Adobe Illustrator
echo - ^Flash : Adobe flash
echo - ^Dreamweaver : Adobe Dreamweaver
echo - ^afterEffects : Adobe After Effects
echo - ^flash : Adobe Flash
echo - ^contribute : Adobe Contribute
echo - ^bridge : Adobe Bridge
echo - ^fireworks : Adobe Fireworks
echo - ^encore : Adobe Encore
echo - ^indesign : Adobe Indesign
echo - ^premiere : Adobe Premiere
echo - ^soundbooth : Adobe Soundbooth
echo -
echo -------------------------------------------------
echo - Microsoft Tools -------------------------------
echo -------------------------------------------------
echo -
echo - ^cmd^|CMD : Command ^Line
echo - ^notepad : opens ^notepad
echo - ^word : Ms Office Word
echo - ^powerpoint : Ms Office Powerpoint
echo - ^excel : Ms Office Excel
echo - ^onenote : Ms Office Onenote
echo - ^outlook : Ms Office Outlook
echo - ^officepmng : Ms Office picture manager
echo - ^msclip : Ms Clip Orangizer
echo - ^mquery : Ms Query
echo - ^mspublisher : Ms Office Publisher
echo - ^access : Ms Office Access
echo - ^msinfopath : Ms Office Infopath
echo - ^groove : Ms Office Groove
echo - ^calc : Ms Calculator
echo -
echo -------------------------------------------------
echo - Personal Folders ------------------------------
echo -------------------------------------------------
echo -
echo - musicDir : opens the music folder
echo - homeDir : opens the main folder
echo - picturesDir : opens the pictures folder
echo - documentsDir : opens the documents folder
echo -
echo -------------------------------------------------
timeout -1
goto a

REM --------
REM WEBSITES
REM --------

:youtube
start http://www.youtube.com
goto a
:tribalwars
start http://www.tribalwars.nl
goto a
:google
start http://www.google.be
goto a
:hotmail
start http://www.hotmail.com
goto a
:howestmail
start https://webmail.howest.be
goto a
:dokeos
start https://dokeos.howest.be
goto a
:facebook
start http://www.facebook.com
goto a
:netlog
start http://www.netlog.com
goto a
:wikipedia
start http://www.wikipedia.com
goto a
:discovery
start http://dsc.discovery.com/
goto a
:w3schools
start http://www.w3schools.com
goto a
:website
echo.
echo which domain is the website in ? [enter to exit]
echo.
echo       1 - .be
echo       2 - .nl
echo       3 - .com
echo.
choice /c:123
if not defined input goto a
if errorlevel 3 (set websiteDomain=.com
goto :websiteInput)
if errorlevel 2 (set websiteDomain=.nl
goto :websiteInput)
if errorlevel 1 (set websiteDomain=.be
goto :WebsiteInput)

goto a
:websiteInput
set input=
set /p input=Website input:
if not defined input (echo.
echo website not defined
echo.
goto a)
if %INPUT%==exit goto a
call website.bat %INPUT% %websiteDomain%
goto a

:musicDir
start /MAX /ABOVENORMAL %userprofile%\Music
goto a
:homeDir
start /MAX /ABOVENORMAL %userprofile%
goto a
:picturesDir
start /MAX /ABOVENORMAL %userprofile%\Pictures
goto a
:documentsDir
start /MAX /ABOVENORMAL %userprofile%\Documents
goto a

REM ------------
REM ColorChanger
REM ------------

:colorChanger
echo.
echo to get a quick list of the available colors
echo type colorHelp
echo.
set Background=
set Foreground=
set input=
for %%a in (Background Foreground) do (
   set /p input=%%a Color:
   if not defined input (
      echo.
      echo color not found
      echo.
      goto a
   )
   call :setcolor %%a
)
color %Background%%Foreground%
echo.
echo. do you wish to keep these changes ?
echo.
echo       1 - yes
echo       2 - no
echo.
choice /c:12
if errorlevel 2 (color 0A
goto a)
if errorlevel 1 goto a

goto :eof

:setcolor
if "%INPUT%"=="black" set %1=0&&goto :eof
if "%INPUT%"=="blue" set %1=1&&goto :eof
if "%INPUT%"=="green" set %1=2&&goto :eof
if "%INPUT%"=="aqua" set %1=3&&goto :eof
if "%INPUT%"=="red" set %1=4&&goto :eof
if "%INPUT%"=="purple" set %1=5&&goto :eof
if "%INPUT%"=="yellow" set %1=6&&goto :eof
if "%INPUT%"=="white" set %1=7&&goto :eof
if "%INPUT%"=="gray" set %1=8&&goto :eof
if "%INPUT%"=="light blue" set %1=9&&goto :eof
if "%INPUT%"=="light green" set %1=A&&goto :eof
if "%INPUT%"=="light aqua" set %1=B&&goto :eof
if "%INPUT%"=="light red" set %1=C&&goto :eof
if "%INPUT%"=="light purple" set %1=D&&goto :eof
if "%INPUT%"=="light yellow" set %1=E&&goto :eof
if "%INPUT%"=="bright white" set %1=F&&goto :eof
if "%INPUT%"=="colorHelp" (goto colorHelp)
if "%INPUT%"=="default" (color 0A
goto a)
echo.
echo Color Not Found
echo.
goto a
:colorHelp
echo -----------------------------------------
echo ----------- Available Colors ------------
echo -----------------------------------------
echo.
echo ^>^>^>^>^> reminder : don't use cases
echo.
echo - black
echo - blue
echo - green
echo - aqua
echo - red
echo - purple
echo - yellow
echo - white
echo - gray
echo - light blue
echo - light green
echo - light aqua
echo - light red
echo - light purple
echo - light yellow
echo - bright white
echo - default
echo -
echo -----------------------------------------
timeout -1
goto colorChanger



and also take these batch files (they're necessary for some features in the program )

countIncrement.bat

Code: Select all

@echo off
echo %count% - %2
echo %2 >> drives.txt
set increment = 1
set /a increment=increment+1
set /a count=%1%+increment


website.bat

Code: Select all

@echo off
if %1%=="exit" goto eof
start http://%1%2


cheers and stay tuned

dragovian
freelance webdesigner

ps : feel free to make any enhancements to this code ;), if you manage to make it "even" better, then do post it here :).

let the world know CMD scripting is still alive and kickin ;)

Post Reply