Cov txheej txheem:

Cov Ntaub Ntawv Batch: Qee Qhov Yooj Yim ..: 8 Kauj Ruam
Cov Ntaub Ntawv Batch: Qee Qhov Yooj Yim ..: 8 Kauj Ruam

Video: Cov Ntaub Ntawv Batch: Qee Qhov Yooj Yim ..: 8 Kauj Ruam

Video: Cov Ntaub Ntawv Batch: Qee Qhov Yooj Yim ..: 8 Kauj Ruam
Video: Musicians talk about Buckethead 2024, Hlis ntuj nqeg
Anonim
Cov Ntaub Ntawv Batch: Qee Qhov Tseem Ceeb …
Cov Ntaub Ntawv Batch: Qee Qhov Tseem Ceeb …

Cov lus qhia no yuav qhia koj qee qhov pib ntawm kev sau cov ntaub ntawv, thiab yuav qhia koj yuav ua li cas los tsim tus lej twv ua si nrog ob peb twists, tsuas yog ua kom muaj kev nthuav …

Kuv tau kawm feem ntau ntawm kuv cov lus txib tam sim, thiab txhua yam ntawm kuv cov ntawv sau los ntawm internet feem ntau, thiab Instuctables tshwj xeeb. Kuv xav ua tus ua tsaug rau Instructables user Neodudeman rau nws cov lus qhia zoo ntawm kev sau ntawv. Ua tsaug!

Kauj Ruam 1: Dab tsi yog Batch File?

Dab tsi yog Batch File?
Dab tsi yog Batch File?

Zoo, feem ntau ntawm kuv cov neeg nyeem tej zaum twb paub lawm tias cov ntawv ua ke yog dab tsi, tab sis tsuas yog thaum….

Cov ntawv ua pawg yog ib qho yooj yim sau ua ke (pawg) ntawm MSDOS cov lus txib uas ua tiav ua ntu zus thaum koj khiav cov ntawv ua ke. Batch cov ntaub ntawv pib ua.txt cov ntaub ntawv hauv notepad, thiab dhau los ua cov ntaub ntawv thaum thaum koj khaws lawv ua qee yam nrog.bat txuas ntxiv. Yog li ntawd, txhua yam koj ua yog sau cov ntawv hauv Notepad, thiab tom qab ntawd khaws nws raws li, hais, "instructable.bat". Thaum lub.bat tso rau ntawm qhov kawg ntawm lub npe cov ntaub ntawv, qhov zoo, cov ntaub ntawv tshiab yuav tshwm, muaj npe dab tsi koj hu nws, nrog qhov zoo, iav saib lub cim. Okay, tam sim no peb paub tias cov ntaub ntawv no yog dab tsi, cia peb sau ntawv!

Kauj Ruam 2: Cov Lus Qhia Tseem Ceeb

Cov lus txib yooj yim
Cov lus txib yooj yim
Cov lus txib yooj yim
Cov lus txib yooj yim
Cov lus txib yooj yim
Cov lus txib yooj yim
Cov lus txib yooj yim
Cov lus txib yooj yim

Zoo, koj yuav tsum tau kawm ob peb lus txib. Yog li ua ntej, qhib MSDOS hais kom sai. Qhib lub qhov rai pib, nyem rau ntawm lub pob, ntaus "cmd.exe" thiab tom qab ntawd nyem run. Okay. Ua ntej tshaj, peb yuav saib cov kev hloov pauv. Variables yog tus lej, lo lus, lossis lwm yam uas, (qee qhov pom tseeb), sib txawv. Command Prompt muaj qhov ua haujlwm sib txawv. Nws muaj qee qhov kev hloov pauv uas twb tau teeb tsa, xws li TIME, DATE, thiab ob peb lwm yam. Feem ntau cov kev hloov pauv, txawm li cas los xij, koj tuaj yeem teeb tsa koj tus kheej. Nyem rau ntawm Command Prompt window, thiab ntaus: SET hloov pauv = random Nws tsis muaj teeb meem tiag tiag yog tias koj nqis peev "SET" lossis tsis yog, tab sis kuv nyiam ua kom muaj nuj nqis txhua yam ntawm kuv cov lus txib, tshwj xeeb tshaj yog thaum sau cov ntaub ntawv. Nws tsuas yog ua kom yooj yim los qhia dab tsi koj tab tom ua tam sim no ntaus nkag. Zoo rau koj! Koj tau teeb tsa koj thawj qhov sib txawv! Tab sis peb tuaj yeem ua dab tsi nrog nws? leej twg mob siab tias txhua yam peb tuaj yeem ua tau teeb tsa qhov sib txawv kom raug? Zoo, raws li nws tshwm sim, peb tuaj yeem ua ntau ntau dua li qhov ntawd, tab sis ua ntej, cia li sim ua kom lub khoos phis tawj qhia peb seb qhov txawv txav tau teeb tsa li cas. Okay, txhawm rau kom lub khoos phis tawj nyeem qhov txiaj ntsig ntawm qhov sib txawv, peb ntaus lub npe ntawm qhov sib txawv, qhov no, "hloov pauv" thiab tso lub npe sab hauv %cim, zoo li no: %sib txawv %. Mus tom ntej thiab ntaus ntawv hauv, thiab ntaus nkag:%sib txawv%Qhov txawv yuam kev huh? Lub khoos phis tawj hais tias "'hloov pauv' tsis tau lees paub tias yog kev hais sab hauv lossis sab nraud, cov haujlwm ua haujlwm, lossis cov ntawv ua haujlwm." Yog li vim li cas nws thiaj muab qhov yuam kev ntawd? Zoo, qhov tseem ceeb, nws muab qhov yuam kev ntawd vim hais tias Command Prompt kho tus nqi ntawm qhov sib txawv xws li yog koj ntaus nws hauv koj tus kheej. Yog li thaum koj ntaus %hloov pauv %, lub khoos phis tawj xav tias koj tau qhia nws kom ua raws cov lus txib "random". Pom tseeb, peb xav tau lwm yam ntxiv txhawm rau pom tus nqi ntawm peb qhov sib txawv. Nov yog qhov ECHO cov lus txib los rau hauv. Qhov ECHO hais kom yooj yim qhia rau Command Prompt kom ncha, lossis hais, xijpeem koj tau ntaus tom qab ECHO. Yog li, yog tias peb ntaus ECHO cov lus txib ua ntej peb hloov pauv, peb yuav tsum tau txais yam peb xav tau: ECHO %sib txawv %Nyob ntawd! Tam sim no peb tau txais yam peb xav tau! Lub computer luam tawm "random". Pom tseeb, qhov no yog tus nqi peb ntaus rau peb qhov sib txawv, yog li nws yog qhov txiaj ntsig peb xav tau. Hauv kauj ruam tom ntej, peb yuav kawm paub ntau ntxiv txog qhov hloov pauv, thiab peb yuav siv lawv li cas.

Kauj Ruam 3: Siv SET Command thiab Variables

Siv SET Command thiab Variables
Siv SET Command thiab Variables
Siv SET Command thiab Variables
Siv SET Command thiab Variables

Okay, tam sim no peb paub qhov txawv txav yog dab tsi, peb tuaj yeem ua dab tsi ntxiv nrog lawv? Zoo, peb tuaj yeem ua lej, peb tuaj yeem siv lawv raws li xwm txheej rau kev sau cov haujlwm thiab cov ntaub ntawv cais, peb tuaj yeem ua cov lej yooj yim, peb tuaj yeem ua cov lus txib, thiab ntau ntxiv. Peb yuav tsis nkag mus rau txhua yam uas koj tuaj yeem ua nrog cov lej sib txawv, tab sis peb yuav tham txog qee qhov tseem ceeb ntawm kev ua haujlwm sib txawv. Qhov no txhais tau tias nws yuav tsis ntxiv lossis ua lwm yam lej. Yog tias koj yuav tsum qhia lub khoos phis tawj kom ntxiv 1 rau qhov sib txawv nrog tus nqi 1, nws yuav muab tus nqi 1+1 rau koj. Yog tias peb xav kom nws ntxiv ob tus lej, peb yuav tsum tso tus "/a" tom qab SET hais kom ua. Yog li ntawd, peb ntaus ntawv: SET /hloov pauv tau = (tus nqi) Tam sim no, xav tias peb xav muab qhov sib txawv hauv peb cov ntaub ntawv batch uas tus neeg siv yuav muab. Peb yuav xav ua qhov no yog tias peb tau suav cov txiaj ntsig raws li tus qauv, lossis, hauv peb qhov xwm txheej, yog tias peb xav kom tus neeg siv kwv yees tus lej uas lub khoos phis tawj tau los. Txhawm rau tsim cov neeg siv tshwj xeeb sib txawv, peb ntxiv a /p tom qab SET hais kom ua, thiab peb tawm thaj chaw tom qab = tsis muaj dab tsi: SET /p sib txawv = Muaj koj mus! Tus neeg siv tau teev tseg sib txawv! Yog tias peb tau muab cov kab no tso rau hauv cov ntawv ua pawg, tom qab ntawv pawg yuav khiav mus txog thaum nws mus txog kab no, thiab tom qab ntawd nws yuav tos cov neeg siv tswv yim ua ntej txuas ntxiv. Lwm qhov txias tshaj plaws txog ntawm /p yog tias nws ua tsis zoo tag nrho /a. Thaum peb suav nrog a /p peb tuaj yeem tso tseg qhov /a. Qhov tom ntej no peb yuav kawm txog nws tsim cov kev hloov pauv tsis raug. Yog tias peb xav kom lub khoos phis tawj xaiv tus lej tsis raug rau qhov sib txawv, peb yooj yim ntaus SET cov lus txib, tom qab ntawd hloov pauv, thiab tom qab ntawd teeb tsa qhov sib txawv kom sib npaug %RANDOM %. Ib zaug ntxiv, nws tsis tas yuav yog peev, tab sis kuv nyiam ua nws lawm. Yog li, peb ntaus: SET /qhov sib txawv =%RANDOM%Pom tseeb, qhov no tsis yog tus neeg siv tshwj xeeb sib txawv, yog li peb suav nrog /a. Txias! Yog li tam sim no peb paub yuav tsim tus lej random li cas! Tab sis nws zoo li cas? Zoo, nws hloov tawm tias lub khoos phis tawj xaiv tus lej nruab nrab ntawm 0 thiab ib puag ncig 37, 000. Kuv tsis paub meej tias tus lej pes tsawg yog dab tsi. Tab sis yuav ua li cas yog tias peb xav tau tus lej me? Piv txwv, zoo li hauv Cov Lus Qhia no, peb xav tau tus lej tswj tau rau qee yam xws li kev twv twv? Zoo, qhov ntawd yog qhov lus txib IF los rau hauv….

Kauj Ruam 4: IF thiab GOTO Commands. Lub Hwj Chim Nyob Hauv Tes ntawm Tus Sau Batch

IF thiab GOTO Commands. Lub Hwj Chim Nyob Hauv Tes ntawm Tus Sau Batch
IF thiab GOTO Commands. Lub Hwj Chim Nyob Hauv Tes ntawm Tus Sau Batch

Yog li, peb xav tsim tus lej tswj tau. Cia peb xav tias peb xav tsim tus lej tsis sib xws ntawm 1 thiab 20. Okay, qhov ntawd yooj yim hais, tab sis tus nqi RANDOM xaiv tus lej nruab nrab ntawm 1 thiab 37, 000. Qhov ntawd yog qhov peb yuav siv IF rau. IF hais kom ua hauv paus hais tias YOG qee yam tshwm sim, lossis YOG qee yam sib npaug, lossis tsis sib npaug, tus nqi tshwj xeeb, THIAB ua li no. Yog li, YOG teeb tsa cov lus txib raws cai. Peb xav tsim tus lej uas tsawg dua nees nkaum, tab sis ntau dua ib tus, pom tseeb, peb yuav pib nrog qhia rau lub khoos phis tawj kom xaiv tus lej tsis raug, tab sis tom qab ntawd peb yuav tsum muaj peev xwm qhia nws kom xaiv tus lej tshiab tus lej yog tus lej nws xaiv tsis haum rau peb qhov xav tau. Qhov ntawd yog qhov uas GOTO hais kom ua los. GOTO tsuas qhia lub khoos phis tawj kom mus rau ib lub npe tshwj xeeb hauv cov cai. Cov ntawv zoo li no:: khaws Ib lo lus twg tso tom qab txoj hnyuv los ua daim ntawv lo uas peb tuaj yeem nkag nrog GOTO hais kom ua. Yog li, yog tias peb xav mus rau ntu ntu ntawm cov cai nrog "xaiv" daim ntawv lo saum toj no, peb tsuas yog ntaus: GOTO pickAlright, yog li cia txuas ntxiv nrog peb cov lej. Peb twb tau hais qhia lub khoos phis tawj kom xaiv tus lej tsis raug, yog li peb tau sau: SET /cov lus teb =%RANDOM%Tam sim no peb xav rub tus lej no mus rau qhov me dua. Yog li peb yuav sau qhov IF hais kom ua. Tej yam zoo li no yuav tsum ua kom yuam kev: YOG % % teb % GTR 20 GOTO pickThis qhia rau lub khoos phis tawj kom GOTO tuaj tos yog tias cov lus teb yog GReaTer ntau dua 20. Peb kuj tseem tuaj yeem tso ib qho ntawm cov xwm txheej no uas hais kom ua: EQU - EqualNEQ - Tsis EqualLSS - Tsawg duaGTR - Zoo Tshaj Li QE - Tsawg dua lossis Zoo Li Qub - Zoo Tshaj Li lossis Zoo Li No, nrog IF, GOTO, cov ntawv cim, thiab cov kev hloov pauv no, peb tuaj yeem siv peb cov ntawv ua txhua txoj kev uas peb xaiv. Okay, yog li peb tau txais peb tus lej tsis raug nyob rau nees nkaum tam sim no, thiab ntawm no yog qhov peb tau txais kom deb li deb:: pickSET /cov lus teb =%RANDOM%YOG%%teb%GTR 20 GOTO pickNow, cia ua kom ntseeg tau tias lub computer tsis ua t xaiv 0 rau cov lus teb.: pickSET /cov lus teb =%RANDOM%YOG%%teb%GTR 20 GOTO pickIF $ teb%EQU 0 GOTO pickOkay! Tam sim no peb tau txais tus lej siv tau ntawm 1 thiab 20. Cia peb txav mus rau cov nqaij ntawm Batch.

Kauj Ruam 5: Nqaij Ntawm Peb Qhov Kev Ua Si

Nqaij Ntawm Peb Qhov Kev Ua Si
Nqaij Ntawm Peb Qhov Kev Ua Si

Zoo, peb tau txais peb tus lej random. Peb kuj xav suav pes tsawg qhov kwv yees peb cov neeg ua si ua, yog li peb yuav teeb tsa lwm qhov sib txawv: SET /qhov kwv yees = 0 Qhov ntawd teeb tsa geussnum sib txawv rau xoom, thiab peb muab nws /qhov ntsuas, yog li peb yuav tuaj yeem ntxiv rau nws txhua lub sijhawm tus neeg siv kwv yees. Okay. Peb tau txais tus lej tsis raug, thiab peb tau teeb tsa tus lej kwv yees. Tam sim no peb xav tau qee cov lus qhia, thiab peb yuav tsum muaj qee tus neeg siv nkag mus rau tus lej twv. Koj yuav tsum nkag siab feem ntau ntawm qhov no tam sim no, yog li kuv tsuas yog qhia koj txoj cai:: pibECHO Kuv yuav xav txog tus lej EKO kuv xav….. SET /a GuessNum = 0 (ECHOs ob kab no thiab teev tus lej kwv yees rau 0): pickASET /a Answer =%RANDOM%IF%%%%GTR 20 GOTO pickAIF%Teb%EQU 0 GOTO pickAECHO Kuv xav txog tus lej ntawm 1 txog 20ECHO kwv yees tus lej Kuv xav ntawm. (Tshooj loops kom txog thaum nws SETs peb tus lej tsis sib xws, thiab tom qab ntawd ECHOs cov lus qhia rau peb cov neeg uas ua ntawv): RetrySET /p Guess = Yog %Guess %LSS %Teb %ECHO Kuv Tus lej yog Siab Tshaj. IF %Kwv yees %GTR %Teb % ECHO Kuv Tus Zauv Yog Qis. IF%Guess%==%Teb%GOTO ENDECHO. SET /a GuessNum =%GuessNum%+1GOTO Rov Qab (Tshooj lus no qhia rau lub khoos phis tawj kom nug tus neeg siv nkag, thiab tom qab ntawd txuas ntxiv mus kom txog thaum tus neeg siv xaiv lub Tom qab ntawv, nws mus rau daim ntawv lo END): ENDECHO Koj hais raug lawm! Cov lus teb yog %Teb %ECHO Nws siv %GuessNum %Guesses. ECHO. PAUSECLSECHO Koj puas xav rov ua si dua? ECHO Y /N? SET /p play = YOG %play %EQU y GOTO beginIF %play %EQU n GOTO closeIF % ua si% GTR y GOTO playagainIF% ua si% LSS y GOTO playagainIF% ua si% GTR n GOTO playagainIF% ua si% LSS n GOTO playagain (Nov yog peb ntu kawg. Qhov no qhia rau tus neeg siv pes tsawg leej kwv yees lawv coj, thiab tom qab ntawd nug seb lawv puas nyiam nco qab tias peb tuaj yeem siv EQU, GTR, thiab LSS nrog cov tsiaj ntawv ib yam nkaus.) Okay! Yog tias koj tau theej theej cov cai no, koj yuav muaj kev twv txiaj raug cai raug cai. Tsis yog qhov zoo nkauj tiag tiag, tab sis hav, nws zoo dua li neeg feem coob tuaj yeem ua. Tab sis peb tab tom yuav ntxiv me ntsis sib tw, tsuas yog ua kom muaj tej yam ntxim nyiam….

Kauj Ruam 6: Twist

Lub Twist
Lub Twist
Lub Twist
Lub Twist
Lub Twist
Lub Twist

Tam sim no, peb muaj game ua haujlwm tam sim no, tab sis peb xav ua kom nws cuam tshuam me ntsis ntxiv. Yuav ua li cas ntxiv qee qhov kev txhawb siab rau peb cov neeg ua si los kwv yees tus lej raug? Yuav ua li cas txog peb ua qee yam zoo li.. kaw lawv lub computer yog tias lawv tsis xam tus lej? Qhov ntawd yuav zoo nkauj heev! Okay, tam sim no peb yuav ntxiv cov cai me me los ua cov kev hloov no. Ua ntej, peb yuav ntxiv kab rau ntu ntu ntawm cov cai peb sau tias "rov ua dua". Yog li mus nrhiav ntu ntawd. Nws zoo li qhov no: RetrySET /p Guess = IF%Guess%LSS%Answer%ECHO Kuv Tus lej yog Siab dua. IF%Guess%GTR%Teb%ECHO Kuv Tus lej yog Qis. IF%Guess%==%Teb%GOTO ENDECHO. SET /a GuessNum =%GuessNum%+1GOTO RetryOkay, peb yuav ntxiv cov kab no tom qab "ECHO." (Thaum peb tso ib lub sijhawm tom qab ECHO, nws tawm kab dawb.) Nov yog tus lej tshiab: Yog %GuessNum %EQU 4 GOTO kawG Thaum peb ntxiv kab no, ntu zoo li no:: RetrySET /p Guess = YOG %Guess % LSS%Teb%ECHO Kuv Tus Naj Npawb Ntau dua. IF%Kwv yees%GTR%Teb%ECHO Kuv Tus lej yog Qis. IF%Kwv yees%==%Teb%GOTO ENDECHO. SET /a GuessNum =%GuessNum%+1IF%GuessNum%EQU 4 GOTO kawGGOTO RetryBy tam sim no, nws yuav tsum pom tseeb tias qhov no ua dab tsi. Nws qhia rau lub khoos phis tawj tias yog GuessNum EQUals 4, nws yuav tsum mus rau ntu ntu ntawm cov ntawv cim npe "shutdownG". Yog li, peb xav kom ntu kaw no hais dab tsi? Zoo, pom tseeb, nws yuav tsum tau sau "shutdownG". Tom ntej no, nws yuav tsum kaw lub computer. Qhov hais kom kaw yog "SHUTDOWN -s". Qhov no yuav kaw lub khoos phis tawm, tab sis peb xav ntxiv qee qhov lus txib. Peb yuav ntxiv "-f". Qhov ntawd yuav yuam kom txhua txoj haujlwm kaw, thiab peb yuav ntxiv "-t 60". Qhov ntawd yuav qhia lub khoos phis tawj kom pom lub qhov rai thiab tos rau caum caum vib nas this kom kaw. Peb tseem yuav ntxiv "-c" cov lus ntawm no "". uas yuav tso tawm cov lus hauv lub qhov rai kaw. Tom qab peb kaw qhov kev hais kom ua, peb yuav cuam tshuam rau tib tus lej peb muaj saum toj no, cov cai uas tso cai rau peb cov neeg ua si xaiv cov lej, thiab muab lawv tawm tswv yim. -c "Kwv yees kwv yees! Yog tias koj tsis kwv yees tus lej raug, lub computer yuav kaw!": shutdownG1SET /p Guess = YOG %Guess %LSS %Teb %ECHO Kuv tus lej yog siab dua. IF %kwv yees %GTR %Teb %ECHO Kuv Tus lej yog Qis. IF%Guess%==%Teb%GOTO ENDECHO. SET /a GuessNum =%GuessNum%+1GOTO shutdownG1 Tam sim no peb tau teeb lub computer rau SHUTDOWN, thiab tso lus, tab sis peb kuj yuav tsum qhia khoos phis tawj kom tsis txhob kaw, yog tias nws tau pib lawm. Yog li, peb yuav ntxiv qhov ntawd rau ntu kev cim cim npe "kawg". Ntu ntawv zoo li qhov no:: ENDIF % GuessNum % GTR 4 SHUTDOWN -aECHO Koj hais raug lawm! Cov lus teb yog %Teb %ECHO Nws siv %GuessNum %Guesses. ECHO. PAUSECLSECHO Koj puas xav rov ua dua? ECHO Y /N? SET /p play = YOG %play %EQU y GOTO beginIF %play %EQU n GOTO closeIF % ua si% GTR y GOTO playagainIF% ua si% LSS y GOTO playagainIF% ua si% GTR n GOTO playagainIF% ua si% LSS n GOTO playagainWe xav kom nres qhov kaw, thiab peb ua qhov ntawd nrog "SHUTDOWN -a" hais kom ua. Yog li, peb yuav ntxiv kab uas zoo li no: YOG % % GuessNum % GTR 4 SHUTDOWN -a Peb yuav ntxiv cov lus txib ntawd tom qab daim ntawv lo, thiab qhov ntawd yuav qhia rau lub khoos phis tawj kom ua SHUTDOWN -a hais kom ua nkaus xwb yog tias tus neeg siv muaj ua ntau dua plaub qhov kev kwv yees, thiab pib kaw. Okay! koj yuav tsum muaj koj qhov kev ua si tam sim no! Peb yuav ua kom ntseeg tau tias tsis muaj kab nyob rau theem tom ntej.

Kauj Ruam 7: Kauj Ruam Kawg

Kauj Ruam Kawg
Kauj Ruam Kawg

Okay, tam sim no yog tias koj sib zog ua ke txhua qhov coding, tom qab ntawd koj yuav muaj qee yam uas zoo ib yam li no:: pibECHO Kuv yuav xav txog tus lej EKO kuv xav….. SET /a GuessNum = 0: pickASET / a Answer =%RANDOM%IF%Answer%GTR 20 GOTO pickAIF%Answer%EQU 0 GOTO pickAECHO Kuv tab tom xav txog tus lej nruab nrab ntawm 1 txog 20ECHO Kwv yees Tus lej Kuv tab tom xav txog.: RetrySET /p Guess = YOG%Guess %LSS%Teb%ECHO Kuv Tus Naj Npawb Ntau dua. IF%Kwv yees%GTR%Teb%ECHO Kuv Tus lej yog Qis. IF%Kwv yees%==%Teb%GOTO ENDECHO. SET /a GuessNum =%GuessNum%+1IF%GuessNum% EQU 4 GOTO shutdownGGOTO Retry: ENDIF % GuessNum % GTR 4 SHUTDOWN -aECHO Koj hais raug lawm! Cov lus teb yog %Teb %ECHO Nws siv %GuessNum %Guesses. ECHO. PAUSECLSECHO Koj puas xav rov ua dua? ECHO Y /N? SET /p play = YOG %play %EQU y GOTO beginIF %play %EQU n GOTO closeIF % ua si% GTR y GOTO playagainIF% ua si% LSS y GOTO playagainIF% ua si% GTR n GOTO playagainIF% ua si% LSS n GOTO playagain: closeECHO Ua tsaug rau kev ua si! PAUSEEXIT cmd: kawGSHUTDOWN -s -f -t 60 -c ! Yog tias koj tsis kwv yees tus lej raug, lub computer yuav kaw! : ShutdownG1SET /p Guess = YOG % Guess % LSS % Teb % ECHO Kuv Tus Naj Npawb Ntau dua. IF % Guess % GTR % Teb % ECHO Kuv Tus lej yog Lower. IF%Guess%==%Answer%GOTO ENDECHO. SET /a GuessNum =%GuessNum%+1GOTO shutdownG1That yuav yog txhua yam peb xav tau txoj cai? Yog li, mus tom ntej thiab khaws cov ntawv sau ntawd.txt uas koj muaj raws li GuessGame.bat. Qhov tseeb, koj tuaj yeem sau nws txhua yam koj xav tau, tsuav yog koj tso.bat kawg. Okay, yog li nyem rau ntawm lub cim thiab khiav qhov program! Nws puas ua haujlwm? Zoo sorta. Nws ua qee yam khoom coj txawv txawv tsis yog nws? Hloov tawm tias thaum peb sau Batch zoo li no, qhov hais kom sai ECHOs txhua qhov lus txib peb muab rau nws, ib yam li yog peb ntaus lawv rau hauv qhov hais kom ua sai. Yog li qhov kev ua si ua haujlwm, tab sis nws me ntsis tsis meej thiab tsis meej. Peb puas tuaj yeem ua dab tsi txog qhov no? Yog! Txhua yam peb yuav tsum ua yog ntaus kab no ntawm qhov pib ntawm peb tus lej: @ECHO OFF Qhov no qhia lub khoos phis tawj kom tig ECHO OFF. Thiab tus @ kos npe rau ntawm kev thov qhia nws kom tig ECHO OFF rau txhua qhov lus txib. Yog tias peb tso qhov @ tawm, ces nws tsuas yog tig ECHO OFF rau ib qho lus txib.

Kauj ruam 8: Txhua yam ua tiav

Nrog koj zoo siab! Koj nyuam qhuav sau Batch file game. Yooj yim zoo nkauj tsis yog nws? Yog tias koj tuaj yeem lis qhov no, tom qab ntawd koj tuaj yeem txiav txim siab yuav ua li cas ua me ntsis nrog Batch cov ntaub ntawv. Tsuas yog ua si nrog nws, ua qee qhov kev sim. Tsuas yog thaum koj tsis tuaj yeem tau txais ib yam dab tsi los ua haujlwm, lossis yog tias kuv tso qee yam tawm hauv txhua qhov coding, Kuv yuav muab cov ntawv no rau koj.

Pom zoo: