Cov txheej txheem:

Cov hauv paus ntawm Cov Ntaub Ntawv Batch: 5 Kauj Ruam
Cov hauv paus ntawm Cov Ntaub Ntawv Batch: 5 Kauj Ruam

Video: Cov hauv paus ntawm Cov Ntaub Ntawv Batch: 5 Kauj Ruam

Video: Cov hauv paus ntawm Cov Ntaub Ntawv Batch: 5 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Hlis ntuj nqeg
Anonim
Pib ntawm Cov Ntaub Ntawv Batch
Pib ntawm Cov Ntaub Ntawv Batch
Pib ntawm Cov Ntaub Ntawv Batch
Pib ntawm Cov Ntaub Ntawv Batch

Yog tias koj muaj lus nug dab tsi, thov tso lawv rau ntawm kuv qhov BLOG: https://tamsanh.com/blog/2008/07/10/batch-tutorial-1-basics-of-batch-files/Kuv tsis mus saib Instructables ntxiv lawm, yog li koj yuav tau txais cov lus teb sai dua li ntawd. Ntawm no yog cov hauv paus ntawm Batch cov ntaub ntawv, tshwj xeeb tau ua rau pab pawg "Batch Lovers" Cov pawg yog cov ntaub ntawv me me uas khiav DOS cov lus txib hauv qee qhov kev xaj khoom. Qhov no muaj txiaj ntsig zoo rau kev ua yooj yim, tab sis ib qho yuav tsum nco ntsoov nws tsis yog hom lus programming, thiab tsis tuaj yeem ua Txhua Yam. cov ntawv qhia zaub mov thiab ntaus hauv CMD. PSI

Kauj ruam 1: DIR Command

DIR hais kom ua
DIR hais kom ua

DIR hais kom ua yog ib qho ntawm cov lus txib muaj txiaj ntsig zoo tshaj plaws uas ib tus tuaj yeem siv. Thiab, rau cov neeg siv tshiab, nws zoo li haxxor, vim tsis muaj lo lus zoo dua. = D. What qhov lus txib ua yog nws qhia txog DIRectory, lub ntsiab lus tag nrho cov ntaub ntawv, thiab tag nrho cov ntawv tais ceev tseg uas muaj nyob hauv qee cov npe. Qhov no suav nrog TXHUA cov ntaub ntawv, tsis muaj teeb meem yog tias lawv tau muab zais, lossis nyeem nkaus xwb, lossis xijpeem, DIR yuav qhia txhua tus ntawm lawv. Nws tseem yuav qhia lub cim xeeb los ntawm phau ntawv teev npe, thiab lub cim xeeb pub dawb. Txawm hais tias tom kawg raug txiav tawm ntawm daim duab los qhia cov lus txib uas tau siv. Los ntawm kev siv DIR hais kom ua, peb tuaj yeem pom cov ntaub ntawv, thiab cov ntawv tais ceev tseg uas peb yuav xav siv yav tom ntej nrog lwm cov lus txib.

Kauj ruam 2: CD thiab CHDIR Commands

CD thiab CHDIR Commands
CD thiab CHDIR Commands

CD thiab CHDIR Commands yog cov lus txib uas yuav coj koj mus qhov twg koj xav mus! Tab sis vim li cas ob lo lus txib sib txawv?

Cia kuv piav! CD hais kom siv los ntawm ib qho mus rau ib qho chaw sib cais kiag li. Lub ntsiab lus tsis yog subfolder, lossis niam txiv daim nplaub tshev. Txhawm rau siv CD cov lus txib, ib tus yuav tsum sau tag nrho qhov chaw nyob ntawm phau ntawv teev npe uas koj xav mus ntsib. I. E.: CD C: / Cov Ntaub Ntawv thiab Cov Chaw / Neo / Kuv Cov Ntaub Ntawv coj kuv mus rau kuv li My Documents nplaub tshev hauv ib kauj ruam nrawm. CHDIR cov lus txib tau siv kom mus txog qhov chaw ze los ntawm yam tsis tas yuav ntaus tus lej chaw nyob tas mus li. I. E.: CHDIR Kuv Lub Suab Nkauj Coj kuv mus rau kuv phau ntawv teev suab paj nruag. Yog tias kuv yuav siv CD, Kuv yuav tsum tau ntaus CD C: / Cov Ntaub Ntawv thiab Chaw> Neo / Kuv Cov Ntaub Ntawv / Kuv Lub Suab Nkauj Thiab qhov ntawd tuaj yeem ua rau muaj kev ntxhov siab tom qab ib ntus. tab sis yuav ua li cas thiaj li nce ib daim nplaub tshev nrog CHDIR? Koj yooj yim ntxiv ob lub sijhawm tom qab CHDIR hais kom ua, thiab nws yuav coj koj mus! CHDIR.. Yog li, nrog CD thiab CHDIR, koj lub khoos phis tawj tuaj yeem tshawb xyuas kom ntxaws, thiab yooj yim! Thiab thaum ua ke nrog DIR hais kom ua, tsis muaj dab tsi zais! Kho kom raug: Kuv nyuam qhuav pom tias CHDIR hais kom peb ua tsis tiav, thiab daim CD hais kom tuaj yeem siv nkag mus rau cov ntawv tais ceev tseg, thiab niam txiv cov ntawv yooj yim. Tab sis txij li qhov no yuav tsis muaj tseeb ntawm cov tshuab qub, kuv tseem yuav khaws CHDIR hais kom ua!

Kauj ruam 3: COPY thiab XCOPY

COPY thiab XCOPY
COPY thiab XCOPY

COPY thiab XCOPY ua raws nraim qhov koj xav. Lawv Luam cov khoom! Yay!

COPY hais kom ua yog siv rau kev luam cov ntaub ntawv. COPY "FILE PATH" "DESTINATION PATH" I. E. Luam "C: / test.txt" "C: / Test / test.txt" Cov lus hais los saum no yuav luam cov ntawv test.txt los ntawm C: / rau C: / Test nplaub tshev. XCOPY hais kom ua yuav luam cov ntawv lawv tus kheej tib yam li COPY saum toj no. I. E. XCOPY "C: Test" "C: Test Test Copy" Cov lus hais los saum toj no yuav luam theej tawm daim nplaub tshev mus rau Test Copy folder. Txawm li cas los xij, daim ntawv theej theej tawm tsis suav nrog cov subfolders tshwj tsis yog koj ntxiv cov lus txib /S mus rau qhov kawg. Tsis tas li, yog tias phau ntawv qhia chaw tseem tsis tau tsim tam sim no, nws yuav nug seb nws puas yog Cov Ntaub Ntawv lossis Cov Npe Xaiv Cov Ntawv Teev Npe Yooj yim yog?

Kauj ruam 4: DEL Command

DEL hais kom ua
DEL hais kom ua

Ua oh. Qhov txaus ntshai DEL hais kom ua!

Kwv yees cov lus txib no ua dab tsi! I. E. DEL "C: / Test / Test.txt" Qhov ntawd yuav tshem tawm cov ntawv xeem tsis zoo uas peb tau siv. Nco tseg, Kev hais kom Del yuav tsis xav tau tag nrho cov ntawv hauv kab ntawv, tsuav yog cov ntawv koj tab tom rho tawm yog nyob hauv daim nplaub tshev uas koj nyob. Ua tib zoo nrog cov lus txib no, vim tias DEL hauv DOS lub qhov rai hais kom ua dhau los ntawm Recycle Bin, thiab cov ntaub ntawv nyuaj dua los khaws. Thiab nws tsis muab rau koj ib qho kev pom zoo ntawm koj kev tshem tawm, raws li koj tuaj yeem pom hauv daim duab.

Kauj Ruam 5: Tsim Batch File

Tsim Cov Ntaub Ntawv Batch
Tsim Cov Ntaub Ntawv Batch

Ok, yog li peb tau npog cov hauv paus ntawm DOS Command window, tab sis peb tuaj yeem tsim daim Batch li cas?

Zoo kuv zoo siab heev koj tau nug lo lus nug, vim qhov ntawd yog qhov peb tab tom sim npog! Batch cov ntaub ntawv tsuas yog Cov Ntawv Cov Ntaub Ntawv nrog kev hloov pauv hloov mus rau.bat Cov khoom yooj yim tiag tiag. Tsuas yog qhib cov ntawv sau, ntaus koj cov lus txib, thiab khaws nws ua.bat! Tada! Koj tau ua koj thawj daim ntawv ua tiav! Yog li koj tuaj yeem ua dab tsi nrog cov ntawv me me no? Zoo qhov kuv nyiam siv yog lub flash drive syncing yam tsis muaj txhua qhov software vwm! Nov yog cov lus txib kuv siv: XCOPY "E: \" "C: / Documents and Settings / Neo / My Documents / Flash Drive" /S Qhov no yuav luam tawm txhua cov ntaub ntawv tawm ntawm kuv lub flash drive, uas yog ib txwm E: /, suav nrog subfolders, txoj cai rau hauv Kuv Cov Ntaub Ntawv/Flash Drive, yog li ua kom txhua yam ntawm kuv cov ntaub ntawv tau rov qab sai! Qhov zoo tshaj plaws, cov pob tuaj yeem nqa nrog koj sab xis hauv koj lub flash drive, yog li koj tuaj yeem rov qab tau txhua qhov chaw koj ntsaws! Zoo nkauj dandy eh? Tab sis ntawm chav kawm, peb tseem tsis tau khawb qhov saum npoo ntawm cov ntaub ntawv batch tsis tau. Kuv yuav qhia koj cov lus zais ntawm kev lag luam hauv Batch Tom ntej Qhia ntawm no hauv Batch Lover's pab pawg! ~ tso ~

Pom zoo: