Uzibhala njani izikripthi zebhetshi ukwenza ngokuzenzekelayo imisebenzi kwiWindows

Uhlaziyo lokugqibela: 23/04/2025
umbhali: Andres Leal

Uyenza njani imenyu kwiskripthi sebhetshi

Ukuba usebenzisa iiWindows kwaye uhlala usenza imisebenzi efanayo okanye uqhuba iinkqubo ezifanayo ngokuphindaphindiweyo, eli nqaku liya kuba luncedo kakhulu kuwe. Siza kucacisa indlela yokubhala izikripthi zebhetshi ukwenza imisebenzi kwiWindows kunye nokwandisa imveliso yakho. Nangona iyinkqubo esisiseko kakhulu kwaye ilula, isasebenza ngokufanayo yenza imisebenzi ephindaphindwayo kwaye wonge ixesha.

Ukubhala izikripthi zebhetshi ukwenza ngokuzenzekelayo imisebenzi kwiWindows

Ukubhala izikripthi zebhetshi ukwenza ngokuzenzekelayo imisebenzi kwiWindows

Masithi uvula ikhompyuter yakho kwaye, njengalo lonke ixesha, uvule isikhangeli osithandayo ukukhangela into kwiwebhu. Emva koko uvule usetyenziso lweSpotify ukumamela umculo owuthandayo kwaye wenza okufanayo nge-WhatsApp ukuqhubeka nencoko oyishiyileyo kwifowuni yakho. Kwaye ulandela le nkqubo inye phantse yonke imihla, ngamanye amaxesha ungayiqondi nokuyiqonda. Kulungile ke, Ungacinga ukuba uqhuba yonke loo misebenzi ngokucofa kabini?

Oko kunye nokunye okuninzi kanye kanye okufumanayo xa ubhala izikripthi zebhetshi ukwenza imisebenzi kwiWindows. Ngale nkqubo, awukwazi kuphela ukuqalisa iinkqubo ezininzi xa iWindows iqala, kodwa unokucwangcisa ii-backups okanye ucoce iifayile zexeshana ngokuzenzekelayo. Ngokwenene, Sisisombululo esilula nesisebenzayo ukuzenzekelayo inani elingenasiphelo leenkqubo kunye nemisebenzi. kwiinkqubo ezahlukeneyo zokusebenza.

Yintoni iskripthi sebhetshi?

Masiqale ekuqaleni kwaye sichaze ngokufutshane ukuba yintoni iskripthi sebhetshi. Ayisiyonto ngaphandle nje kokuthozama kwaye kulula Ifayile yokubhaliweyo enolwandiso lwe-.bat oluqulethe uluhlu lwemiyalelo eyenziwa yiWindows ngokulandelelana.. Ngamanye amagama, ifana noluhlu lwemiyalelo oyinika ikhompyuter yakho ukuba iphumeze usebenzisa i Itoliki yomyalelo weWindows (cmd.exe). Nangona kukho iilwimi zale mihla zokubhala ezineempawu eziphucukileyo, ezinje ngePowerShell, izikripthi zebhetshi ziseluncedo kakhulu kwi-automation imisebenzi ngokukhawuleza nangokulula.

Umxholo okhethekileyo- Cofa Apha  Khubaza okungeyomfuneko Windows 11 iinkonzo zokuphucula ukusebenza

Ukukwazi ukubhala izikripthi zebhetshi ukwenza imisebenzi ngokuzenzekelayo ibisoloko ikhona kwiWindows, kodwa ihlala ingaqatshelwa ngabasebenzisi abaninzi. Inzuzo kukuba Kulula kakhulu ukwenza kwaye ayifuni ulwazi oluphambili lwenkqubo. ukuqalisa ukuzisebenzisa. Ngapha koko, ezi fayile zinokuba zizixhobo eziluncedo kakhulu ezikuvumela ukuba ukhuphele, ukhuphele okanye unike igama ngokutsha iifayile, wenze ii-backups, kunye nokunye okuninzi, konke ngokucofa kabini.

Uzibhala njani izikripthi zebhetshi ukwenza ngokuzenzekelayo imisebenzi kwiWindows

Ubhalwa njani umbhalo webhetshi

Ukubhala i-batch script kulula njengokuvula i-Notepad kwi-Windows, ukubhala phantsi imiyalelo kunye gcina ifayile ngolwandiso lwe-.bat. Emva koko, yiya nje apho ugcine khona ifayile kwaye ucofe kabini ukuze iqokobhe liyenze. Masenze uvavanyo olulula ngokulandela la manyathelo:

  1. Vula iBlog yamanqaku okanye nayiphi na enye umhleli wokubhaliweyo ukuba uyifakile
  2. Bhala lo mgca ulandelayo: echo Molo TecnobitsWamkelekile kwilizwe le-batch scripts.
  3. Ngoku cofa ku Oovimba kwaye ukhethe Gcina njenge.
  4. Kwindawo yokubhaliweyo yegama leFayile, chwetheza igama olifunayo, lilandelwe yi .ulwandiso lwelulwane
  5. Fumana ifayile ye-.bat osanda kuyidala kwaye uyicofe kabini.
  6. Uya kubona ukuba itoliki yomyalelo ivula ngomyalezo Hola TecnobitsWamkelekile kwilizwe le-batch scripts., kwaye emva koko ivale ngokuzenzekelayo. I-CMD eqhuba ifayile ye-.bat
  7. Ukuba ufuna itoliki ihlale ivuliwe de ucinezele naliphi na isitshixo, bhala lo myalelo nqumama kumgca olandelayo.
Umxholo okhethekileyo- Cofa Apha  UMicrosoft ulumkisa ngokusilela komshicileli we-USB emva kohlaziyo lweWindows

Eminye imiyalelo yebhetshi esisiseko ekufuneka uyazi

Xa ubhala izikripthi zebhetshi ukwenza ngokuzenzekelayo imisebenzi kwiWindows kufuneka usebenzise ezinye imiyalelo, Oko kukuthi, amagama kunye neempawu ezivumela itoliki ukuba iqonde umsebenzi ofuna ukuwenza. Kumzekelo odlulileyo sele sisebenzise imiyalelo emibini: Bhala y nqumama. Ngezantsi uya kubona uluhlu lwemiyalelo yebhetshi esisiseko, elandelwa yimisebenzi abayenzayo.

  • i-echo: Ibonisa okubhaliweyo kwifestile yomyalelo. Echo off ifihla imiyalelo ekusebenzeni, kwaye @echophe wenza kwa into enye, kodwa ukwafihla umyalelo ngokwawo @echophe.
  • nqumama: Misa usetyenziso lwescript de umsebenzisi acofe iqhosha.
  • ngcolile: Isetyenziselwa ukujonga uluhlu lweefayile kulawulo olukhankanyileyo.
  • CD: Guqula uvimba weefayili wangoku.
  • ikopi: Khuphela iifayile ukusuka kwenye indawo ukuya kwenye.
  • hambisa: Hambisa iifayile ukusuka kwenye indawo ukuya kwenye.
  • ye: Cima iifayile.
  • qala: Vula usetyenziso kunye neefayile.
  • rem: Ikuvumela ukuba wongeze izimvo kwiscript. Oko kukuthi, imigca eqala ngayo rem Azihoywa yitoliki, kwaye zisetyenziselwa ukongeza iingcaciso.
  • Ren: Yithiya ngokutsha ifayile.
  • umnxeba: Iqhuba iskripthi sebhetshi kwesinye iskripthi sebhetshi.
  • Phuma: Ikhupha iqokobhe okanye iphelisa ukuphunyezwa koshicilelo lwangoku.

Le miyalelo isisiseko, idityaniswe nephezulu kakhulu, ivumela sebenzisa phantse nawuphi na umsebenzi ngaphakathi kwenkqubo yokusebenza yeWindows. Ngoku makhe sijonge indlela yokuzisebenzisa ukwenza imisebenzi ezenzekelayo, enjengokugcina iifayile, ukucima iifayile zexeshana, okanye ukuvula usetyenziso olunye okanye ngaphezulu ngokuzenzekelayo.

Ukubhala izikripthi zebhetshi ukwenza ngokuzenzekelayo imisebenzi: Gcina

Isikripthi sebhetshi yogcino lweWindows

Kulo mzekelo wendlela yokubhala izikripthi zebhetshi ukwenza ngokuzenzekelayo imisebenzi kwiWindows, siza kubhala enye esivumela ukuba iifayile zogcino, ngokukodwa, khuphela iifayile ukusuka kuMqulu oneenkcukacha kwidrive yangaphandle. Ukwenza oku, vula iBlog yeeNqaku kwaye uchwetheze le miyalelo ilandelayo, omnye kumgca ngamnye:

  • @echophe
  • xcopy "C:\Abasebenzisi\%amagama abasebenzisi%\Amaxwebhu\*" "D:\Backup\" /E /I /Y
  • echo Ugcino lugqityiwe
  • nqumama 
    
    

Kulo mzekelo, umyalelo we-xcopy ukhuphela iifayile kunye neefolda; /E ikhuphela onke amacandelo angaphantsi, kuquka angenanto; /Ndithatha indawo ekuyiwa kuyo luluhlu, kwaye /Y inqanda ukubhala ngaphezulu iziqinisekiso. Nje ukuba ifayile ilungile, kufuneka Yigcine ngolwandiso lwe-.bat kwaye ngalo lonke ixesha uyiqhuba, iya kwenza i-backup ngokuzenzekelayo. ukusuka kuMaxwebhu ulawulo kwi drive yangaphandle.

Umxholo okhethekileyo- Cofa Apha  Ezona ndlela zingcono kwi-Microsoft Office: Gqibezela iSikhokelo esiHlaziyiweyo

Ibatch script ukucima iifayile zexeshana

Esinye iskripthi sebhetshi esiluncedo sesi sisetyenzisiweyo Cima iifayile zexeshana kwaye ngaloo ndlela ukhulule imemori kwikhompyuter yakho. Kwakhona, vula incwadana kwaye uchwetheze le miyalelo ilandelayo (i / s / q umyalelo ucima zonke iifayile ngaphakathi kwifolda ngaphandle kokucela isiqinisekiso):

  • @echophe
  • del /s /q "C: \Windows\Temp\*.*"
  • echo Iifayile zexeshana zicinyiwe
  • nqumama

Vula ii-aplikeshini ezininzi usebenzisa i-batch script

Ibhetshi iskripthi sokuvula iinkqubo

Kwaye ukuba usebenzisa ii -apps ezininzi mihla le, unako Zivule zonke ngonqakrazo olunye usebenzisa i-batch script elandelayo (oku kuvula iGoogle Chrome, iFayile Explorer, kunye ne-Notepad apps):

  • @echophe
  • qala chrome.exe
  • qala i-notepad.exe
  • qala umhloli wamanzi.exe
  • echo Vula ii-Aplikheshini
  • nqumama

Ngoku, nqakraza ngokulula kabini isiphumo .bat ifayile ukuvula zonke izicelo ngexesha elinye. Njengoko ubona, ukubhala izikripthi zebhetshi ukwenza imisebenzi kwiWindows kulula kakhulu, kodwa kunokukugcina ixesha elininzi. Ngokuziqhelanisa, uya kuba nakho ukwenza izikripthi zakho zebhetshi zesiko kwaye ukhulise imveliso yakho..