Yadda ake rubuta rubutun batch don sarrafa ayyuka ta atomatik a cikin Windows

Sabuntawa na karshe: 23/04/2025

Yadda ake ƙirƙirar menu a cikin rubutun tsari

Idan kuna amfani da Windows kuma galibi kuna yin ayyuka iri ɗaya ko gudanar da shirye-shirye iri ɗaya akai-akai, wannan labarin zai yi muku amfani sosai. Za mu yi bayanin yadda ake rubuta rubutun batch don sarrafa ayyuka a cikin Windows da haɓaka haɓakar ku. Ko da yake shi ne mai matukar asali da kuma sauki hanya, shi ne har yanzu kamar yadda tasiri ga sarrafa ayyuka masu maimaitawa da adana lokaci.

Rubuta rubutun batch don sarrafa ayyuka a cikin Windows

Rubuta rubutun batch don sarrafa ayyuka a cikin Windows

Bari mu ce kun kunna kwamfutar ku kuma, kamar kowane lokaci, buɗe burauzar da kuka fi so don bincika wani abu akan gidan yanar gizo. Sannan ka bude Spotify app don sauraron kiɗan da kuka fi so kuma ku yi haka tare da WhatsApp don ci gaba da tattaunawar da kuka bari a kan wayarku. Kuma kuna bin wannan al'ada kusan kowace rana, wani lokacin ba tare da saninsa ba. To sai, Za ku iya tunanin gudanar da waɗannan ayyuka tare da danna sau biyu?

Wannan da ƙari mai yawa shine ainihin abin da kuke samu lokacin da kuke rubuta rubutun batch don sarrafa ayyuka a cikin Windows. Tare da wannan tsari, ba za ku iya ƙaddamar da shirye-shirye da yawa kawai lokacin da Windows ya fara ba, amma kuma kuna iya tsara tsarin ajiya ko tsaftace fayilolin wucin gadi ta atomatik. A gaskiya, Magani ne mai sauƙi kuma mai inganci don sarrafa sarrafa matakai da ayyuka marasa iyaka. akan tsarin aiki daban-daban.

Menene rubutun batch?

Bari mu fara daga farko kuma mu ayyana a taƙaice menene rubutun batch. Ba kome ba ne face tawali'u da sauƙi Fayil ɗin rubutu tare da tsawo na .bat wanda ya ƙunshi jerin umarni waɗanda Windows ke aiwatarwa a jere.. A wasu kalmomi, yana kama da jerin umarnin da ka ba kwamfutarka don aiwatarwa ta amfani da Mai fassarar umarnin Windows (cmd.exe). Ko da yake akwai ƙarin harsunan rubutun zamani tare da ƙarin abubuwan ci gaba, kamar PowerShell, rubutun batch har yanzu suna da amfani sosai don sarrafa ayyuka cikin sauri da sauƙi.

Keɓaɓɓen abun ciki - Danna nan  Yadda ake Buɗe fayilolin DLL a cikin Windows 11: Cikakken Jagora

Ƙarfin rubuta rubutun batch don sarrafa ayyuka ya kasance koyaushe a cikin Windows, amma galibi yawancin masu amfani ba su lura da shi ba. Fa'idar ita ce Yana da sauƙin yi kuma baya buƙatar ilimin shirye-shirye na ci gaba. don fara amfani da su. A zahiri, waɗannan fayilolin na iya zama kayan aiki masu amfani da yawa waɗanda ke ba ku damar adanawa, kwafi ko sake suna fayiloli, aiwatar da madadin, da ƙari mai yawa, duk tare da danna sau biyu sau ɗaya.

Yadda ake rubuta rubutun batch don sarrafa ayyuka ta atomatik a cikin Windows

Yadda ake rubuta rubutun batch

Rubuta rubutun tsari yana da sauƙi kamar buɗe Notepad a cikin Windows, rubuta umarni da ajiye fayil ɗin tare da tsawo na .bat. Bayan haka, kawai je inda kuka ajiye fayil ɗin kuma danna shi sau biyu don harsashin ya aiwatar da shi. Bari mu yi gwaji mai sauƙi ta bin waɗannan matakan:

  1. Bude Blog ɗin Bayanan kula ko wani editan rubutu da kuka shigar
  2. Rubuta layi mai zuwa: amsa Hello TecnobitsBarka da zuwa duniyar rubutun batch.
  3. Yanzu danna kan Amsoshi kuma zaɓi Ajiye kamar yadda.
  4. A cikin filin rubutu na sunan fayil, rubuta sunan da kake so, sannan kuma .wato tsawo
  5. Nemo fayil ɗin .bat ɗin da kuka ƙirƙira kuma danna sau biyu.
  6. Za ku ga cewa mai fassarar umarni yana buɗewa da saƙon hola TecnobitsBarka da zuwa duniyar rubutun batch., sannan yana rufewa ta atomatik. CMD yana gudanar da fayil ɗin .bat
  7. Idan kuna son mai fassara ya kasance a buɗe har sai kun danna kowane maɓalli, rubuta umarnin ɗan hutu a layi na gaba.
Keɓaɓɓen abun ciki - Danna nan  Kalma tana lalata rubutunku ba tare da dalili ba: Ga abin da yakamata kuyi don gyara matsalolin tsarawa

Wasu mahimman umarnin tsari da yakamata ku sani

Lokacin rubuta rubutun batch don sarrafa ayyuka a cikin Windows kuna buƙatar amfani da wasu umarni, watau kalmomi da alamomin da ke ba mai fassara damar fahimtar aikin da kake son yi. A cikin misalin da ya gabata mun riga mun yi amfani da umarni guda biyu: Kira y a ɗan dakata A ƙasa zaku ga jerin ƙa'idodi na asali, sannan ayyukan da suke yi.

  • amsa: Nuna rubutu a cikin taga umarni. A kashe echo boye umarni a cikin aiwatarwa, kuma @echo kashe yana yin abu ɗaya, amma kuma yana ɓoye umarnin da kansa @echo kashe.
  • dakatar: Dakatar da aiwatar da rubutun har sai mai amfani ya danna maɓalli.
  • dir: Ana amfani da shi don duba jerin fayiloli a cikin kundin adireshi da kuka ayyana.
  • CD: Canja kundin adireshi na yanzu.
  • kwafi: Kwafi fayiloli daga wuri guda zuwa wani.
  • motsawa: Matsar da fayiloli daga wuri guda zuwa wani.
  • m: Share fayiloli.
  • fara: Buɗe aikace-aikace da fayiloli.
  • rem: Yana ba ku damar ƙara sharhi zuwa rubutun. Wato layin da suka fara da rem Mai fassara ya yi watsi da su, kuma ana amfani da su don ƙara bayani.
  • Ren: Sake suna fayil.
  • kira: Yana gudanar da rubutun tsari daga wani rubutun tsari.
  • fita: Yana fita harsashi ko ya ƙare aiwatar da rubutun na yanzu.

Waɗannan umarni na asali, haɗe tare da ƙarin ci gaba, suna ba da izini gudanar da kusan kowane aiki a cikin tsarin aiki na Windows. Bari yanzu mu kalli yadda ake amfani da su don sarrafa ayyuka, kamar su adana fayiloli, share fayiloli na wucin gadi, ko buɗe aikace-aikace ɗaya ko fiye ta atomatik.

Rubuta rubutun batch don sarrafa ayyuka: Ajiyayyen

Rubutun tsari na madadin Windows

A cikin wannan misalin yadda ake rubuta rubutun batch don sarrafa ayyuka a cikin Windows, za mu rubuta ɗaya wanda zai ba mu damar. madadin fayiloli, musamman, kwafi fayilolin daga babban fayil ɗin Takardu zuwa wani waje na waje. Don yin wannan, buɗe Blog ɗin Bayanan kula kuma rubuta umarni masu zuwa, ɗaya akan kowane layi:

  • @echo kashe
  • xcopy "C: \ Masu amfani \% sunayen masu amfani% \ Takardu \*" "D: \ Ajiyayyen \" / E / I / Y
  • echo Ajiyayyen an gama
  • ɗan hutu 
    
    

A cikin wannan misalin, umarnin xcopy yana kwafi fayiloli da manyan fayiloli; /E yana kwafi duk kundin adireshi, gami da mara komai; /Na ɗauka maƙasudi shugabanci ne, kuma /Y yana hana sake rubutawa. Da zarar kun shirya fayil ɗin, dole ne ku Ajiye shi tare da tsawo na .bat kuma duk lokacin da kuka kunna shi, zai yi ta atomatik. daga babban fayil ɗin Takaddun bayanai akan faifan waje.

Keɓaɓɓen abun ciki - Danna nan  Shin babban fayil ɗin Desktop ɗinku ya ɓace a cikin Windows? Ga yadda ake dawo da shi ba tare da rasa komai ba.

Rubutun tsari don share fayilolin wucin gadi

Wani rubutun rukuni mai amfani shine wannan wanda aka saba dashi share fayilolin wucin gadi kuma don haka yantar da ƙwaƙwalwar ajiya a kan kwamfutarka. Bugu da ƙari, buɗe faifan rubutu kuma buga waɗannan umarni masu zuwa (umarnin / s / q yana share duk fayiloli a cikin babban fayil ba tare da neman tabbaci ba):

  • @echo kashe
  • del /s /q "C: \Windows\Temp\*.*"
  • echo An goge fayilolin wucin gadi
  • ɗan hutu

Buɗe aikace-aikace da yawa ta amfani da rubutun tsari

Rubutun tsari don buɗe shirye-shirye

Kuma idan kuna amfani da apps da yawa kullum, zaku iya Bude su duka tare da dannawa ɗaya ta amfani da rubutun batch mai zuwa (wannan yana buɗe Google Chrome, File Explorer, da ƙa'idodin Notepad):

  • @echo kashe
  • fara chrome.exe
  • fara notepad.exe
  • fara gano .exe
  • echo Buɗe Aikace-aikace
  • ɗan hutu

Sa'an nan, kawai danna sakamakon .bat fayil sau biyu don buɗe duk aikace-aikace a lokaci guda. Kamar yadda kake gani, rubuta rubutun batch don sarrafa ayyuka a cikin Windows abu ne mai sauƙi, amma yana iya ceton ku lokaci mai yawa. Tare da yin aiki, zaku iya ƙirƙirar rubutun ku na al'ada da haɓaka haɓakar ku..