Kommentare: wie erstelle ich eine Batch Datei - Grundlagen
Fragen / Kommentare zu wie erstelle ich eine Batch Datei - Grundlagen
(neueste zuerst)User: Anfger06 Danke für die gute Anleitung. Dieser Skript müsste doch eigentlich den pc herunterfahren oder? : Shutdown : Ich freu mich auf Rückmeldungen
User: Flo Rida hi.. ich hab noch keinen plan wie das geht..also such ich jmd der mir das erklären kann..ich finde das iwie toll^^
User: PC Freak Ich besitze zwar einen PC aber ich gehe damit nur ins Internet unt spiele Spiele aber jetzt wo ich das gesehen habe sehe ich Computer mit ganz anderen Augen. Und das es im Prinzip so "einfach" ist, ist für mich unglaublich!
User: Marky71 Das liest sich richtig genial... die Progs haben echt was! Ich hoffe mir kann hier einer helfen! Ich versuche eine Batch-Datei zu schreiben mit der ich einer bestimmten Dateiendung eine bestimmte exe-Datei zum Ausführen zuweisen kann. Hintergrund: Ich möchte eine CD mit .swf-Dateien fertig machen und diese mit einem auf der CD enthaltenen Player abspielen; oftmals sind diese aber bereits im System mit einem Browser verknüpft; mit dem soll aber nicht geöffnet werden. Ist sowas möglich? Hab schon Versuche mit ASSOC und FTYPE gestartet, da ich dachte das wären die richtigen Befehle, klappte aber nicht!
User: konne alles langweig meins ist besser @echo off echo Loading... setlocal enabledelayedexpansion set dealdone=0 set Spaces= for /l %%I in (1,1,22) do set gapline%%I= ___________ set amount1=1 set amount2=10 set amount3=50 set amount4=100 set amount5=500 set amount6=1000 set amount7=5000 set amount8=10000 set amount9=25000 set amount10=50000 set amount11=75000 set amount12=100000 set amount13=300000 set amount14=500000 set amount15=1000000 set amount16=1500000 set amount17=2000000 set amount18=3500000 set amount19=5000000 set amount20=7500000 set amount21=10000000 set amount22=25000000 set famount1=$0.01 set famount2=$0.1 set famount3=$0.50 set famount4=$1 set famount5=$5 set famount6=$10 set famount7=$50 set famount8=$100 set famount9=$250 set famount10=$500 set famount11=$750 set famount12=$1,000 set famount13=$3,000 set famount14=$5,000 set famount15=$10,000 set famount16=$15,000 set famount17=$20,000 set famount18=$35,000 set famount19=$50,000 set famount20=$75,000 set famount21=$100,000 set famount22=$250,000 set Damount1={___$0.01___} set Damount2={____$0.1___} set Damount3={____$0.5___} set Damount4={_____$1____} set Damount5={_____$5____} set Damount6={____$10____} set Damount7={____$50____} set Damount8={____$100___} set Damount9={____$250___} set Damount10={____$500___} set Damount11={____$750___} set Damount12={___$1000___} set Damount13={___$3000___} set Damount14={___$5000___} set Damount15={___$10000__} set Damount16={___$15000__} set Damount17={___$20000__} set Damount18={___$35000__} set Damount19={___$50000__} set Damount20={___$75000__} set Damount21={__$100000__} set Damount22={__$250000__} for /l %%I in (1,1,22) do set boxtop%%I= _____ for /l %%I in (1,1,22) do set boxlid%%I=[_____] for /l %%I in (1,1,9) do set boxmid%%I=[ %%I ] for /l %%I in (10,1,22) do set boxmid%%I=[ %%I ] for /l %%I in (1,1,22) do set boxbot%%I=[_____] for /l %%I in (23,1,24) do set boxtop%%I= for /l %%I in (23,1,24) do set boxlid%%I= for /l %%I in (23,1,24) do set boxmid%%I= for /l %%I in (23,1,24) do set boxbot%%I= for /l %%I in (1,4,24) do ( set /a box2number= %%I + 1 set /a box3number= %%I + 2 set /a box4number= %%I + 3 set DisplayLine%%I=#boxtop%%I##boxtop!box2number!##boxtop!box3number!##boxtop!box4number!# ) for /l %%I in (2,4,24) do ( set /a boxnumber= %%I - 1 set /a box2number= !boxnumber! + 1 set /a box3number= !boxnumber! + 2 set /a box4number= !boxnumber! + 3 set DisplayLine%%I=#boxlid!boxnumber!##boxlid!box2number!##boxlid!box3number!##boxlid!box4number!# ) for /l %%I in (3,4,24) do ( set /a boxnumber= %%I - 2 set /a box2number= !boxnumber! + 1 set /a box3number= !boxnumber! + 2 set /a box4number= !boxnumber! + 3 set DisplayLine%%I=#boxmid!boxnumber!##boxmid!box2number!##boxmid!box3number!##boxmid!box4number!# ) for /l %%I in (4,4,24) do ( set /a boxnumber= %%I - 3 set /a box2number= !boxnumber! + 1 set /a box3number= !boxnumber! + 2 set /a box4number= !boxnumber! + 3 set DisplayLine%%I=#boxbot!boxnumber!##boxbot!box2number!##boxbot!box3number!##boxbot!box4number!# ) set amountnumber1=0 set amountnumber2=11 for /l %%I in (1,2,22) do set /a AmountNumber1= !amountnumber1! + 1 && set /a Amountnumber2= !amountnumber2! + 1 && for /l %%J in (!Amountnumber1!,1,!Amountnumber1!) do for /l %%K in (!Amountnumber2!,1,!Amountnumber2!) do ( set Displayline%%I=#gapline%%J# !Displayline%%I! #gapline%%K# ) set amountnumber1=0 set amountnumber2=11 for /l %%I in (2,2,22) do set /a AmountNumber1= !amountnumber1! + 1 && set /a Amountnumber2= !amountnumber2! + 1 && for /l %%J in (!Amountnumber1!,1,!Amountnumber1!) do for /l %%K in (!Amountnumber2!,1,!Amountnumber2!) do ( set Displayline%%I=#Damount%%J# !Displayline%%I! #Damount%%K# ) for /l %%I in (23,1,24) do set displayline%%I= !Displayline%%I! set amountsleft= for /l %%I in (1,1,22) do set AmountsLeft=!Amountsleft!%%I, set Amountnumber=1 :RandomNumber set minval=1 set maxval=22 :NumberGenerator set /a RandomNumber= %random% / 1489 set /a RandomNumber= %RandomNumber% + %MinVal% if /i %RandomNumber% GTR %Maxval% goto NumberGenerator if not defined box%randomnumber% ( set box%randomnumber%=%amountnumber% set /a Amountnumber= !Amountnumber! + 1 if /i !amountnumber!==23 goto intro ) goto Randomnumber :intro cls echo Let's Play... echo. echo. echo ############################################ echo # # echo # @@ @@@@ @ @ @ @@@ # echo # @ @ @ @ @ @ @ @ @ @ # echo # @ @ @ @ @ @ @ @ @ # echo # @ @ @@@ @@@@@ @ @ @ @ # echo # @ @ @ @ @ @ @ @ @ # echo # @@ @@@@ @ @ @@@@ @ @ # echo # # echo # @ @ @ @@ @@@@ @ @ # echo # @@ @ @ @ @ @ @ @ @ @ # echo # @@ @ @ @ @ @ @ @ @ @ # echo # @ @@ @ @ @ @ @@@@ @@@@@ @ # echo # @ @@ @ @ @ @ @ @ @ @ # echo # @ @ @ @@ @@@@ @ @ @@@@ # echo # # echo ############################################ echo. echo I do not own the "Deal Or No Deal" format or concept. All copyrights echo and trademarks are property of their respective owners. echo. set /p helpyn="Press enter to continue, or type HELP for instructions. if /i "%HelpYN%"=="HELP" ( cls echo The aim of the game is to get as much money as possible for your box. echo The game concept is simple. There are 22 sums of money inside 22 boxes. echo The player must choose a box to keep, then remove the others from play, echo one by one not knowing what sum is inside each box. echo. echo After a certain number of choices, The Banker will phone. He will make echo you an offer to buy your box off you. You may choose to accept this offer, echo or keep removing money. Removing high sums makes lower offers and vice- echo versa. echo. echo If you play until there are only two boxes left, you have the choice to echo open the box you started with, or switch to the other box. You win the echo money in the box. echo. echo The knack to the game is knowing whether to take the deal or stop removing echo money from the game. pause ) cls :ChooseBox call :display set /p OwnBox="Choose your own box to keep: " if not defined Ownbox goto Choosebox if /i not %ownbox%0 leq 220 goto ChooseBox if /i not %ownbox%0 geq 10 goto ChooseBox set boxtop%ownbox%= set boxlid%ownbox%= set boxmid%ownbox%= set boxbot%ownbox%= set BoxesLeft=22 Set turns=5 set boxmessage=Choose the box you want to open call :gameloop if %dealdone%==1 exit /b Set turns=3 set boxmessage=Choose the box you want to open call :gameloop if %dealdone%==1 exit /b Set turns=3 set boxmessage=Choose the box you want to open call :gameloop if %dealdone%==1 exit /b Set turns=3 set boxmessage=Choose the box you want to open call :gameloop if %dealdone%==1 exit /b Set turns=3 set boxmessage=Choose the box you want to open call :gameloop if %dealdone%==1 exit /b Set turns=3 set boxmessage=Choose the box you want to open call :gameloop if %dealdone%==1 exit /b goto SwapOrNot :gameLoop cls call :display set boxtoremove= :OpenBox set /p BoxToRemove="%BoxMessage%" if not defined BoxToRemove goto OpenBox if /i not %BoxToRemove%0 leq 220 goto OpenBox if /i not %BoxToRemove%0 geq 10 goto openBox if /i %BoxToRemove%==%OwnBox% goto OpenBox if /i "!Box%boxtoremove%!"=="DONE" goto OpenBox call :removebox %boxtoremove% set /a BoxesLeft=%BoxesLeft% - 1 set /a Turns= %Turns% - 1 if /i %turns%==0 ( cls call :display set /p asdfghj="You lost amount %Amountinbox%. The Phone is ringing, press enter to answer it." set asdfghj= call :MakeOffer exit /b ) set boxmessage=You lost amount %Amountinbox%. Choose the box you want to open. Goto GameLoop :RemoveBox set boxtop%1= set boxlid%1%= set boxmid%1= set boxbot%1= set AmountInBox=!Box%1! call :Remove_Amounts %AmountInBox% set Box%1=DONE exit /b :Remove_Amounts set damount%1= set gapline%1= for /f "tokens=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 delims=," %%A in ("%AmountsLeft%") do ( set amountsleft= if /i not %%A==%1 set AmountsLeft=%%A, if /i not %%B==%1 set AmountsLeft=!AmountsLeft!%%B, if /i not %%C==%1 set AmountsLeft=!AmountsLeft!%%C, if /i not %%D==%1 set AmountsLeft=!AmountsLeft!%%D, if /i not %%E==%1 set AmountsLeft=!AmountsLeft!%%E, if /i not %%F==%1 set AmountsLeft=!AmountsLeft!%%F, if /i not %%G==%1 set AmountsLeft=!AmountsLeft!%%G, if /i not %%H==%1 set AmountsLeft=!AmountsLeft!%%H, if /i not %%I==%1 set AmountsLeft=!AmountsLeft!%%I, if /i not %%J==%1 set AmountsLeft=!AmountsLeft!%%J, if /i not %%K==%1 set AmountsLeft=!AmountsLeft!%%K, if /i not %%L==%1 set AmountsLeft=!AmountsLeft!%%L, if /i not %%M==%1 set AmountsLeft=!AmountsLeft!%%M, if /i not %%N==%1 set AmountsLeft=!AmountsLeft!%%N, if /i not %%O==%1 set AmountsLeft=!AmountsLeft!%%O, if /i not %%P==%1 set AmountsLeft=!AmountsLeft!%%P, if /i not %%Q==%1 set AmountsLeft=!AmountsLeft!%%Q, if /i not %%R==%1 set AmountsLeft=!AmountsLeft!%%R, if /i not %%S==%1 set AmountsLeft=!AmountsLeft!%%S, if /i not %%T==%1 set AmountsLeft=!AmountsLeft!%%T, if /i not %%U==%1 set AmountsLeft=!AmountsLeft!%%U, if /i not %%V==%1 set AmountsLeft=!AmountsLeft!%%V, ) set amountinbox=!FAmount%1! exit /b :MakeOffer set amount=0 for /f "tokens=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 delims=," %%A in ("%AmountsLeft%") do ( set /a Offer= !Amount%%A! + !Amount%%B! + !Amount%%C! + !Amount%%D! + !Amount%%E! + !Amount%%F! + !Amount%%G! + !Amount%%H! + !Amount%%I! + !Amount%%J! + !Amount%%K! + !Amount%%L! + !Amount%%M! + !Amount%%N! + !Amount%%O! + !Amount%%P! + !Amount%%Q! + !Amount%%R! + !Amount%%S! + !Amount%%T! + !Amount%%U! + !Amount%%V! + 0 ) set /a Offer= (%Offer%/((%BoxesLeft%*999)/500))/100 cls echo. echo #################################### echo ## ## echo ## ############################ ## echo ###### ## ## ###### echo ###################### echo ####### ####### echo ##### ##### echo #### #### echo #### #### echo ##### ##### echo ####### ####### echo ########################## echo ############################ echo ############################## echo ################################ echo. echo. echo The Banker Offers: $%Offer% echo. echo. echo DEAL OR NO DEAL? :DealOrNoDeal set deal= set /p Deal=" " if not defined Deal goto DealOrNoDeal if /i %Deal:~0,1%==d echo.&& Goto Deal_Taken if /i %Deal:~0,1%==N (exit /b) else (goto :DealOrNoDeal) :Display echo/ %displayline1:#=!% echo/ %displayline2:#=!% echo/ %displayline3:#=!% echo/ %displayline4:#=!% echo/ %displayline5:#=!% echo/ %displayline6:#=!% echo/ %displayline7:#=!% echo/ %displayline8:#=!% echo/ %displayline9:#=!% echo/ %displayline10:#=!% echo/ %displayline11:#=!% echo/ %displayline12:#=!% echo/ %displayline13:#=!% echo/ %displayline14:#=!% echo/ %displayline15:#=!% echo/ %displayline16:#=!% echo/ %displayline17:#=!% echo/ %displayline18:#=!% echo/ %displayline19:#=!% echo/ %displayline20:#=!% echo/ %displayline21:#=!% echo/ %displayline22:#=!% echo/ %displayline23:#=!% echo/ %displayline24:#=!% exit /b :SwapOrNot cls echo. echo #################################### echo ## ## echo ## ############################ ## echo ###### ## ## ###### echo ###################### echo ####### ####### echo ##### ##### echo #### #### echo #### #### echo ##### ##### echo ####### ####### echo ########################## echo ############################ echo ############################## echo ################################ echo. echo. echo The Banker Has Offered You The Swap echo. echo. echo SWAP OR NO SWAP? :SwapOrNoSwap set swap= set /p Swap=" " if not defined Swap goto SwapOrNoSwap if /i %Swap:~0,1%==S echo.&& goto Swap_Taken if /i %Swap:~0,1%==N (echo.&& goto Swap_Not_Taken) else (goto SwapOrNoSwap) :Swap_Not_Taken for /f "tokens=1,2 delims=," %%I in ("%AmountsLeft%") do if /i "%%I"=="!Box%OwnBox%!" (set Offer=!Amount%%I!& set OtherBox=%%J& Set OwnBox=%%I) else (set offer=!Amount%%J!& set OtherBox=%%I&& Set OwnBox=%%J) if /i %offer% lss 100 set offer=0.%offer%&& goto SwapResult set /a offer= %offer% / 100 if /i %Offer% geq 35000 call :bigWin goto SwapResult :Swap_Taken for /f "tokens=1,2 delims=," %%I in ("%AmountsLeft%") do if /i "%%I"=="!Box%OwnBox%!" (set Offer=!Amount%%J!& set OtherBox=%%I& Set OwnBox=%%J) else (set offer=!Amount%%I!& set OtherBox=%%J& Set OwnBox=%%I) if /i %offer% lss 100 set offer=0.%offer%&& goto SwapResult set /a offer= %offer% / 100 if /i %Offer% geq 35000 call :bigWin :SwapResult if /i %OwnBox% gtr %Otherbox% ( Echo You took the chance and won :D Well done ) else ( echo Hard luck, you got the smaller prize. ) echo You won $%Offer% :) pause>nul goto endofgame :Deal_Taken set dealdone=1 if /i %Offer% geq 35000 call :bigWin if /i %offer% lss 100 ( set Newoffer=0.%offer% ) else ( set Newoffer=%offer% ) set temp=!Box%ownbox%! if /i !Amount%temp%! lss 100 ( set Newtemp=0.!Amount%temp%! ) Else ( set /a Newtemp= !Amount%temp%! / 100 ) if /i %newtemp:.=% gtr %offer% ( echo Hard luck, in your box there was $%newtemp%, but you dealed at $%Newoffer% ) if /i %newtemp:.=% lss %offer% ( echo Well done, you beat the banker :D echo Your box was worth $%newtemp% but you sold it for $%NewOffer% ) if /i %newtemp:.=% equ %offer% ( echo You managed to sell your box for exactly what it was worth, well done :D echo You won $%NewOffer% :) ) pause >nul goto EndOfGame :BigWin cls echo ####################################################### echo # # echo # # echo # @ @ @ @ @ @ @ @@@@ @@@@ @ # echo # @ @ @ @@ @ @@ @ @ @ @ @ # echo # @ @ @ @ @ @ @ @ @ @ @ @ @ # echo # @ @ @ @ @ @ @ @ @ @ @@@ @@@ @ # echo # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # echo # @ @ @ @ @ @ @ @ @ @ @ @ @ @ # echo # @ @ @ @ @@ @ @@ @@@@ @ @ @ # echo # # echo # # echo ####################################################### echo. echo. exit /b :endOfGame exit /b
User: Dennis achja um das zu benutzen brauch man ein passwort das wäre pino123 ----------------------------------------------------------------
User: Dennis Also das ist garnichts im vergleich zu meiner arbeit: ------------------------------------------------------------ @echo off :start cls echo Zum starten beliebige Taste druecken pause nul cls echo Hallo, bitte Passwort eingeben: set /p X= if /I "%X%"=="pino123" goto right echo falsches Passwort echo Neustart in 3 sek ping localhost -n 3 goto start :right cls echo Der PC wird gestartet in 5 sek! ping localhost -n 5 cls echo Hallo echo. pause :inter echo wollen sie das internet benutzen! set/p frage5= if /i %frage5%== ja goto fr5ja if /i %frage5%== nein goto fr5nein echo bitte nur mit ja oder nein antworten! pause>nul :fr5ja cls ok internet starte in 5 sek! ping localhost -n 5 pause start iexplore :fr5nein cls echo ok :wordpad echo möchten sie auch wordpad benutzen? oder drucken sie enter um das fenster zu schließen! (!!!Bitte nur mit ja/nein Antworten!!!) set/p frage1= if /i %frage1%== ja goto fr1ja if /i %frage1%== nein goto fr1nein echo bitte nur mit ja oder nein antworten! pause >nul goto wordpad :fr1ja cls echo wordpad wird in 5 sek benutzt! ping localhost -n 5 pause start wordpad :fr1nein cls echo wollen sie dann notepad benutzen? oder drucken sie enter um das fenster zu schließen! (!!!Bitte nur mit ja/nein Antworten!!!) :notepad set/p frage2= if /i %frage2%== ja goto fr2ja if /i %frage2%== nein goto fr2nein echo bitte nur mit ja oder nein antworten! pause >nul goto notepad :fr2ja cls echo OK ich starte notepad in 5 sek! ping localhost -n 5 pause start notepad :fr2nein cls echo Ok zum schließen einfach enter drucken! pause :schließen echo wollen sie wirklich schleißen bei nein konnen sie den shutdown antivirus benutzen ! (!!!Bitte nur mit ja/nein Antworten!!!) set/p frage3= if /i %frage3%== ja goto fr13a if /i %frage3%== nein goto fr3nein echo bitte nur mit ja oder nein antworten! pause >nul goto schließen :fr3ja cls echo ok bis bald! exit :fr3nein cls echo ok dann nicht! :sh echo wollen sie shutdown schliesen! set/p frage4= if /i %frage4%== ja goto fr4ja if /i %frage4%== nein goto fr4nein if /i %frage4%== ich will zuruck goto right echo nur mit ja oder nein antworten! pause>nul :fr4ja cls echo ok pause>nul shutdown -a echo sie konnen jetzt auch noch unseren taschenrechner benutzen! goto a :fr4nein cls echo ok mit! pause :a echo Willkommen im Taschenrechner! echo Verwenden sie folgende zeichen (+*-/) echo oder drucken sie exit zum schlißen set /p Y= if /i %Y%==exit goto schließen set /a l=%Y% echo echo Ergebnis: %L% pause cls goto a --------------------------------------------------------- PS:ICH SUCHE NOCH EINEN LEHRER BITTE MELDET EUCH UND ZWAR EINEN LEHRER DER MIR NOCH MEHR BEI BRINGEN KANN ALS DAS Z.B.EINEN BOT DAMIT ERSTELLEN WÄRE DAS MÖGLICH WENN JA DANN SCHREIBT MIR!!! ICQ-NUMMER:596-787-110 DANKE -----------------------------------------------------------------