Yuav ua li cas los tsim bat cov ntaub ntawv hauv Windows

Pin
Send
Share
Send

Feem ntau, cov lus qhia rau qee yam kev ua thiab kev kho nyob rau hauv Windows 10, 8, thiab Windows 7 muaj cov kauj ruam xws li: "tsim .bat cov ntaub ntawv nrog cov ntsiab lus hauv qab no thiab khiav nws." Txawm li cas los xij, cov siv novice tsis paub ib txwm paub tias yuav ua li cas thiab qhov ntawv zoo li cas.

Phau ntawv qhia no yuav ua li cas thiaj li tsim tau cov ntawv puav bat, khiav nws, thiab qee cov ntaub ntawv ntxiv uas yuav pab tau zoo ntawm cov ncauj lus no.

Tsim cov ntaub ntawv .bat siv notepad

Thawj txoj hauv kev thiab yooj yim los tsim cov ntawv puav yog siv cov txheej txheem Notepad qhov kev pab cuam pom muaj nyob hauv txhua hom Windows tam sim no.

Cov kauj ruam los tsim yuav yog li hauv qab no

  1. Tshaj Tawm Cov Lus Cim (nyob hauv Cov Kev Pabcuam - Khoom Plig, nyob hauv Windows 10 nws pib sai dua los ntawm kev tshawb nrhiav hauv lub luag haujlwm, yog tias notepad tsis nyob hauv Start menu, koj tuaj yeem pib ntawm C: Windows notepad.exe).
  2. Sau tus lej cim ntawm koj cov ntawv bat mus rau hauv phau ntawv sau (piv txwv li, theej nws ntawm qhov chaw twg, lossis sau koj tus kheej, hais txog qee cov lus txib - ntxiv rau hauv cov lus qhia).
  3. Hauv notepad ntawv qhia zaub mov, xaiv "Cov Ntaub Ntawv" - "Txuag Raws Li", xaiv qhov chaw kom txuag tau cov ntawv, hais kom meej cov ntaub ntawv npe nrog txuas ntxiv .bat, thiab nco ntsoov teev "Txhua Cov Ntaub Ntawv" hauv "Cov hom File".
  4. Nyem rau "Txuag" khawm.

Nco tseg: yog tias cov ntawv tsis raug cawm mus rau qhov chaw tshwj xeeb, piv txwv li, kom tsav C, nrog cov lus "Koj tsis muaj kev tso cai los txuag cov ntaub ntawv hauv qhov chaw no", khaws nws rau "Cov Ntawv Teev Tseg" nplaub tshev lossis mus rau lub desktop, thiab tom qab ntawd luam mus rau qhov chaw xav tau ( qhov teeb meem yog vim li cas hauv Windows 10 koj xav tau cov thawj coj txoj cai sau rau qee cov ntawv tais ceev tseg, thiab vim tias notepad tsis tau ua tus thawj coj, nws tsis tuaj yeem khaws cov ntawv cia rau hauv daim nplaub tshev teev tseg).

Koj cov ntaub ntawv .bat yog npaj txhij: yog tias koj khiav nws, tag nrho cov lus txib uas teev rau hauv cov ntawv yuav muab nws tua (nws tsis muaj qhov yuam kev thiab cov thawj coj txoj cai yog qhov tsim nyog: hauv qee kis, koj yuav xav tau khiav lag luam ntawv bat ua tus tswj hwm: right-click rau hauv .bat file - khiav raws li cov thawj coj hauv cov ntawv qhia zaub mov).

Nco tseg: yav tom ntej, yog tias koj xav kho cov ntaub ntawv tsim, tsuas yog nyem txoj nws thiab xaiv "Hloov."

Muaj lwm txoj hauv kev los ua tus puav bat, tab sis lawv txhua tus tuaj sau ntawv cov lus txib ib kab rau ib tus ntawv nyob hauv txhua tus ntawv xov xwm (tsis muaj qauv), uas yog tau txais kev cawm nrog .bat txuas ntxiv (piv txwv, hauv Windows XP thiab 32-ntsis Windows 7 Koj tuaj yeem tsim tau ib tus .bat file ntawm kab lus txib siv cov ntawv sau kho hloov).

Yog tias koj muaj cov zaub ntawm cov ntawv txuas ntxiv tau qhib (hloov pauv ntawm lub vaj huam sib luag tswj - Explorer chaw - saib - nkaum txuas txuas ntxiv ntawm cov ntaub ntawv sau npe), tom qab ntawd koj tuaj yeem tsuas yog tsim .txt cov ntaub ntawv, tom qab ntawd muab cov ntaub ntawv los txhim kho .bat txuas ntxiv.

Si laim cov kev pab cuam nyob rau hauv puav cov ntaub ntawv thiab lwm yam yooj yim cov lus txib

Hauv cov ntawv batch, koj tuaj yeem khiav cov kev pab cuam thiab cov lus txib los ntawm cov npe no: //technet.microsoft.com/en-us/library/cc772390(v=ws.10).aspx (txawm hais tias qee qhov ntawm no yuav tsis muaj nyob rau hauv Windows 8 thiab Qhov rai 10). Cov hauv qab no tsuas yog qee cov lus qhia yooj yim rau cov neeg siv cov novice.

Feem ntau muaj cov haujlwm hauv qab no: pib ua haujlwm lossis ntau cov haujlwm los ntawm .bat cov ntaub ntawv, tua qee qhov haujlwm (piv txwv, ntxuav cov ntawv los teev cia, faib Wi-nkaus los ntawm lub laptop, tua lub computer ntawm timer).

Txhawm rau pib ua haujlwm lossis cov haujlwm, siv cov lus txib:

pib "" program_path

Yog tias txoj hauv kev muaj kab, thaiv tag nrho txoj hauv ob kab lus, piv txwv li:

pib "" "C:  Program Files  program.exe"

Tom qab txoj kev mus rau txoj haujlwm, koj tseem tuaj yeem hais qhia cov kev txwv uas nws yuav tsum tau tso tawm, piv txwv li (zoo ib yam li, yog tias qhov pib tsis muaj chaw, cim lawv):

pib "" c:  windows  notepad.exe file.txt

Nco tseg: nyob rau hauv ob kab lus tom qab pib, raws li cov lus qhia tshwj xeeb, cov npe ntim cov ntaub ntawv tso rau hauv kab lus hais kom tau kab header yuav tsum qhia. Qhov no yog qhov kev xaiv tsis tau tshaj tawm, tab sis qhov tsis muaj ntawm cov lus hais no, kev ua cov ntaub ntawv bat uas muaj cov cim kev qhia hauv cov kab thiab tsis muaj peev xwm mus yam tsis tau xav txog.

Lwm qhov tseem ceeb yog tsim los tso lwm tus ntawv bat los ntawm cov ntawv tam sim no, koj tuaj yeem ua qhov no siv hu rau kev hu:

hu rau path_to_file_bat tsis

Cov tsis dhau ntawm thaum pib yuav nyeem tau hauv lwm cov ntaub ntawv puav, piv txwv li, peb hu cov ntawv nrog qhov tsis muaj:

hu rau file2.bat parameter1 parameter2 parameter3

Hauv file2.bat koj tuaj yeem nyeem cov lus no thiab siv lawv ua txoj hauv kev, ntsuas rau kev tsim lwm cov kev pab cuam raws li no:

ncha% 1 echo% 2 ncha% 3 ncua

I.e. rau txhua qhov ntsuas peb siv nws tus lej nrog cov cim feem pua. Qhov tshwm sim hauv qhov muab piv txwv yuav yog cov zis mus rau lub qhov rai ntawm txhua qhov tsis dhau (qhov hais kom ua ncha siv tau los nthuav cov ntawv hauv lub qhov rai console).

Los ntawm lub neej ntawd, qhov hais kom ua lub qhov rais kaw tam sim ntawd tom qab tag nrho cov lus txib tau raug tua. Yog tias koj xav nyeem cov ntaub ntawv sab hauv lub qhov rais, siv lub pluaj hais kom ua haujlwm - nws yuav nres qhov kev ua tiav cov lus txib (lossis kaw lub qhov rai) ua ntej ib tus neeg siv nias tus yuam sij hauv lub console.

Qee zaum, ua ntej yuav ua tiav cov lus txib tom ntej, koj yuav tsum tos ib pliag (piv txwv, kom txog thaum thawj qhov haujlwm pib tiav). Ua qhov no, koj tuaj yeem siv cov lus txib:

timeout / t sijhawm_seconds

Yog tias xav tau, koj tuaj yeem khiav qhov program hauv qhov tsawg los yog nthuav cov yees duab siv MIN thiab MAX tsis dhau los ua ntej ua kom tiav qhov kev zov me nyuam nws tus kheej, piv txwv li:

pib "" / MIN c:  windows  notepad.exe

Yuav kom kaw qhov kev hais kom ua lub qhov rai tom qab tag nrho cov lus txib tau ua tiav (txawm tias nws feem ntau kaw thaum siv pib pib), siv cov lus qhia tawm ntawm txoj kab kawg ntawm kab. Yog tias lub console tseem tsis kaw tom qab pib cov program, sim siv cov lus hais hauv qab no:

cmd / c pib / b "" program_path xaiv

Nco tseg: hauv qhov lus txib no, yog tias txoj kev mus rau qhov program lossis cov ciaj ciam muaj cov chaw, yuav muaj teeb meem nrog lub community launch, uas tuaj yeem daws raws li hauv qab no:

cmd / c pib "" / d "path_to_folder_with_space_space" / b program_file_name "parameters_with whitespace"

Raws li tau sau tseg, qhov no tsuas yog cov lus qhia yooj yim heev txog cov kev cai nquag siv hauv cov ntaub ntawv bat. Yog tias koj xav tau ua cov haujlwm ntxiv, sim nrhiav cov ntaub ntawv koj xav tau hauv Is Taws Nem (saib, piv txwv li, "ua qee yam ntawm cov kab hais kom ua" thiab siv tib cov lus txib hauv .bat file) lossis nug ib lo lus hauv cov lus, Kuv yuav sim pab.

Pin
Send
Share
Send