MS dos - Enter ?
Moderator: DosItHelp
MS dos - Enter ?
hey,
i've been working on a personal batch script to make stuff a lot faster and easier for me to do.
like i have ccleaner installed and now i just need to fire up my batch ( which is always on ) and type in "clean" and it will autorun ccleaner and close it after it finished, etc, i also added some links to sites i visit a lot like youtube and stuff.
but i found that there was 1 big thing that didn't work the way i want it to.
if i don't type in nothing, but just press enter, the script will close
i tried doing
echo errorlevel=%errorlevel%
pause
to check what the errorlevel was and when i saw it was 1
i just did
if errorlevel 1 goto a ( which is the main label )
that seemed to work, but then i saw that i couldn't do anything nemore,
i mean i had shortwords like youtube and clean but they didn't execute nemore due to the fact that the errorlevel was before it :/.
also for some reason the batch closes when i enter more than 1 word, is there a way to solve this ?
this is my code
----edit : for code see below -----
i've been working on a personal batch script to make stuff a lot faster and easier for me to do.
like i have ccleaner installed and now i just need to fire up my batch ( which is always on ) and type in "clean" and it will autorun ccleaner and close it after it finished, etc, i also added some links to sites i visit a lot like youtube and stuff.
but i found that there was 1 big thing that didn't work the way i want it to.
if i don't type in nothing, but just press enter, the script will close
i tried doing
echo errorlevel=%errorlevel%
pause
to check what the errorlevel was and when i saw it was 1
i just did
if errorlevel 1 goto a ( which is the main label )
that seemed to work, but then i saw that i couldn't do anything nemore,
i mean i had shortwords like youtube and clean but they didn't execute nemore due to the fact that the errorlevel was before it :/.
also for some reason the batch closes when i enter more than 1 word, is there a way to solve this ?
this is my code
----edit : for code see below -----
Last edited by dragovian on 30 Jul 2009 17:11, edited 1 time in total.
ok i managed to fix the "no-input" ( just pressing enter would close it )
i fixed it by setting the standard value of my input on NOTHING
if the user pressed enter, it wouldn't change the variable, meaning the variables' value would still be NOTHING, therefore adding a
if %INPUT% == NOTHING goto a
to my batch file, and resetting the value each time a command was entered does the trick ( be it a little more work then what would normally be the standard procedure ).
i'm still having the problem of closing when i enter more than 1 word though
this is the updated code, be it v 2.0
---- edit : for code see below ----
i fixed it by setting the standard value of my input on NOTHING
if the user pressed enter, it wouldn't change the variable, meaning the variables' value would still be NOTHING, therefore adding a
if %INPUT% == NOTHING goto a
to my batch file, and resetting the value each time a command was entered does the trick ( be it a little more work then what would normally be the standard procedure ).
i'm still having the problem of closing when i enter more than 1 word though
this is the updated code, be it v 2.0
---- edit : for code see below ----
Last edited by dragovian on 30 Jul 2009 17:11, edited 1 time in total.
Response
I tried a lot but i can't from this way i can't but for another way i can:
For this can result you need to put ")" if you don't put him this don't result.
Code: Select all
if not defined input goto a
if /i %input% == Music (
set input=
cls
goto Music
)
if /i %input% == Movie (
set input=
cls
goto Movie
)
For this can result you need to put ")" if you don't put him this don't result.
sorry
his doesn't result i am learning english
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
thanks for the replies guys really helped me a lot, i know for the 2 word "problem" that i needed to use quotes, but i didn't know in what order.
thanks ^^
i've been using cmd for couple years now, but i'm only just really getting into batch scripting
it can really make a difference
it's just so hard to find good structural tutorials on it .
i'm kinda making my own reference ( i'm a student in multimedia comm. technology ), if i finish it i'll place it here , spread the code
thanks ^^
i've been using cmd for couple years now, but i'm only just really getting into batch scripting
it can really make a difference
it's just so hard to find good structural tutorials on it .
i'm kinda making my own reference ( i'm a student in multimedia comm. technology ), if i finish it i'll place it here , spread the code
Re
avery_larry the code you put results???? Hey thanks!!!!!!
Re
avery_larry that code doesn't results i test it!
Re
Dragovian you are very smart that program is awesom e like it expecialy that thing of date and the day you teach me that acidentally tankhs sorry my english
Re: Re
rfpd wrote:Dragovian you are very smart that program is awesom e like it expecialy that thing of date and the day you teach me that acidentally tankhs sorry my english
thanks
whatever i can do to keep batch scripting alive !
i'm only learning, and so are you the only thing we can do is learn from each other ^^
here's the "updated" code ;D, i added a little piece to the music, i now get a list of music, and i can select one of em, and it loads em all into foobar ;D
i also added a "website" piece, only works with .com websites but still is a fast way
cheers
-----edit : for code check below ----
Last edited by dragovian on 30 Jul 2009 17:30, edited 1 time in total.
thanks
thanks for the help but i need to go goodbye.
this probably is the final version ( for today ;D )
the website code is as follows
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 ------------ Dragovian Design Quick Finder ------------
echo -------------------------------------------------------------
echo.
set date=%date /t%
set time=%time /t%
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%"=="WMP" goto WMP
if "%INPUT%"=="wmp" goto WMP
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%"=="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
echo.
echo command not valid
echo.
goto a
:Music
@echo off
PUSHD G:\Muziek
echo.
FOR /D %%i IN (*.*) DO echo - %%i
echo.
POPD
echo Choose one from the previous list or press Enter to return
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 G:\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
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
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
REM --------
REM COMMANDS
REM --------
:cls
cls
goto a
:exit
echo thank you for using dragovian apps quick finder
pause
exit
: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 -
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 : https://webmail.howest.be
echo - ^dokeos : https://dokeos.howest.be
echo -
echo -----------------------------------------
echo - ^Adobe Programs ------------------------
echo -----------------------------------------
echo -
echo - ^Photoshop : Adobe Photoshop
echo - ^Illustrator : Adobe Illustrator
echo - ^Flash : Adobe flash
echo - ^Dreamweaver : Adobe Dreamweaver
echo -
echo -----------------------------------------
echo - Microsoft Tools -----------------------
echo -----------------------------------------
echo -
echo - ^WMP^|wmp : Windows Media Player
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 -
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
:website
set input=
set /p input=Website input:
if not defined input (echo.
echo website not defined
echo.
goto a)
call website.bat %INPUT%
goto a
:musicDir
start /MAX /ABOVENORMAL \Users\install.install8510w-PC\Music
goto a
:homeDir
start /MAX /ABOVENORMAL \Users\install.install8510w-PC
goto a
:picturesDir
start /MAX /ABOVENORMAL \Users\install.install8510w-PC\Pictures
goto a
:documentsDir
start /MAX /ABOVENORMAL \Users\install.install8510w-PC\Documents
goto a
the website code is as follows
Code: Select all
@echo off
start http://%1%.com
Re:
the thing of cls results !