Isticmaal PowerShell si aad u tirtirto faylasha iyo faylasha gudaha Windows 11/10

Haddii aadan awoodin inaad ka tirtirto faylka ama galka kombiyuutarkaaga, waxaad isticmaali kartaa Windows PowerShell si aad u tirtirto fayl kasta iyo gal kasta si dadaal la'aan ah. Faa'iidada isticmaalka PowerShell waa inaad awood u yeelatid inaad tirtirto faylka(force delete a file) oo aad ka saarto dhammaan walxaha ku jira galka. Waxaan aragnay sida loo tirtiro faylasha & galka iyadoo la adeegsanayo Command Prompt . Hadda aan aragno sida loo sameeyo adoo isticmaalaya PowerShell .

Isticmaal PowerShell(Use PowerShell) si aad u tirtirto faylasha iyo faylalka

Si aad u tirtirto faylasha iyo faylalka addoo(delete files and folders) isticmaalaya Windows PowerShell , raac tillaabooyinkan-

  1. Fur Windows PowerShell
  2. Aqoonso galka
  3. Isticmaal amarka ka saar shayga.

Waa kan casharka oo qaab faahfaahsan

Tirtir(Delete) hal fayl adoo isticmaalaya PowerShell

Si aad u bilowdo, waxaad u baahan tahay inaad furto PowerShell . Taas awgeed, waxaad riixi kartaa Win+X , oo ka dooro Windows PowerShell liiska. Haddii kale, waxaad ka raadin kartaa sanduuqa raadinta Taskbar . Intaa ka dib, geli amarka soo socda-

Remove-item file-path

Kani waa qaabka aasaasiga ah ee amarka.

Aynu ka soo qaadno inaad ku haysato fayl la yiraahdo TWC.png galka TWC ee ku yaal Desktop- ka . Si aad u tirtirto adigoo isticmaalaya Windows PowerShell , waxaad u baahan tahay inaad geliso amarkan-

Remove-item C:\Users\user-name\Desktop\TWC\TWC.png

Sida loo tirtiro faylalka iyo galka iyadoo la isticmaalayo Windows PowerShell

Waa inaad ku darto kordhinta faylka amarka. Haddii kale, ma aqoonsan doonto amarkaaga, oo farriin soo dhawayn ah ayaa ku soo dhawaynaysa.

la xiriira(Related) : Sida loo tirtiro faylalka ka weyn maalmaha X ee Windows

Tirtir(Delete) hal gal oo isticmaalaya PowerShell

Haddii aad rabto in aad tirtirto gal adiga oo isticmaalaya Windows PowerShell , waxaad u baahan tahay inaad geliso amarka sidaan hore u soo sheegnay-

Remove-Item folder-path

Aynu ka soo qaadno inaad ku haysato galka(Desktop) kombuyuutarkaaga TWC . Haddii aad rabto inaad tirtirto, waxaad u baahan tahay inaad geliso amarkan-

Remove-item C:\Users\user-name\Desktop\TWC

Haddii galku madhan yahay, isla markiiba waa la tirtiri doonaa. Si kastaba ha noqotee, haddii galku leeyahay faylal qaar, waxaad u baahan tahay inaad xaqiijiso tirtirka adigoo riixaya Y iyo badhamada Gelida .(Enter)

Tirtir(Delete) faylal badan adoo isticmaalaya PowerShell

Haddii aad hayso faylal badan oo aad tirtirto, waxaad u baahan tahay inaad geliso amar ka duwan. Amarka wuxuu u eg yahay isku mid, laakiin waxaa jira farqi yar.

Remove-item file-path, file-path1, file-path2

Waxaad u baahan tahay inaad geliso dhammaan dariiqyada faylka sida tan. Tusaale ahaan, waxaad haysataa hal fayl oo lagu magacaabo TWC.png oo ku yaal Desktop iyo fayl kale oo lagu magacaabo TWC1.txt oo ku jira galka Downloads . Si aad hal mar u tirtirto, waxaad geli kartaa amarkan soo socda-

Remove-item C:\Users\user-name\Desktop\TWC.png, C:\Users\user-name\Downloads\TWC1.txt

Tirtir(Delete) faylal badan adoo isticmaalaya PowerShell

Sida tirtirista faylal badan, amarku waa isku mid si meesha looga saaro wax ka badan hal fayl iyadoo la adeegsanayo Windows PowerShell . Tusaale ahaan, waxaad isticmaali kartaa amar sidan oo kale ah-

Remove-item C:\Users\user-name\Desktop\TWC, C:\Users\user-name\Downloads\TWC1

Amarkani wuxuu ka tirtirayaa galka TWC Desktop (TWC)-(Desktop) ka iyo galka TWC1 ee galka Soodejinta(Downloads) hal mar.

Macluumaadkaaga, haddii aad isticmaasho amarradan, faylashaada iyo faylalkaaga si joogto ah ayaa loo tirtiri doonaa. Si kale haddii loo dhigo, kama heli kartid qashinka dib loo warshadeeyo(Recycle Bin) .

Hubi walxaha ku jira galka

Haddii aadan furi karin gal, laakiin aad rabto inaad wax ka ogaato waxyaabaha ku saabsan, waxaad isticmaali kartaa amarkan-

Get-ChildItem folder-path

Haddii aad haysato gal ku yaal Desktop -kaaga oo magaciisu yahay TWC , waxaad u baahan tahay inaad geliso amarka soo socda si aad u muujiso dhammaan waxyaabaha-

Get-ChildItem C:\Users\user-name\Desktop\TWC

Sida caadiga ah, waxay muujinaysaa Habka(Mode) , LastWriteTime , Length , iyo Magaca(Name) . Waxaad ka heli kartaa magaca faylka halkan si aad u tirtirto shayga saxda ah.

Hubi(Check) wakhtiga wax ka beddelka ee u dambeeyay iyo wakhtiga abuurista

Haddii aad rabto inaad hubiso wakhtiga faylka la sameeyay ama wax laga beddelay, waxaad isticmaali kartaa amarkan-

Get-ChildItem C:\Users\user-name\Desktop\TWC | Select-Object FullName, LastWriteTime, CreationTime

Waxaad ka heli kartaa saddex tiir oo leh dhammaan magacyada faylka iyo faahfaahinta kale.

Xoog u tirtir shay

Haddii faylkaagu leeyahay qaar akhrin kaliya ama qarsoon oo aad rabto inaad ka saarto, ma isticmaali kartid amarka kor ku xusan, sababtoo ah waxay muujin doontaa qalad. Xaaladdaas, waa inaad isticmaashaa -force parameter. Tusaale ahaan, haddii ay jiraan faylal qarsoon ama akhrin keliya oo ku jira galka TWC ee lagu dhejiyay Desktop -ka , waa inaad gelisaa amarkan-

Remove-item C:\Users\user-name\Desktop\TWC -force

Isla amar ayaa loo isticmaali karaa in lagu tirtiro faylka akhrinta-keliya, sidoo kale. Si kastaba ha noqotee, waxaad heli doontaa fariin xaqiijin ah oo aad u baahan tahay inaad ku qorto Y oo riix batoonka Gelida.

Tirtir iyada oo aan la xaqiijin

Haddii aad isticmaasho amarka ugu horreeya ee maqaalkan, waxaa lagugu soo dhaweyn doonaa farriin xaqiijin ah. Si kastaba ha noqotee, haddii aadan rabin inaad hesho fariinta noocaas ah, waxaad isticmaali kartaa halbeeg la yiraahdo -recurse .

Tusaale ahaan,

Remove-item C:\Users\user-name\Desktop\TWC -recurse

Kadib markaad geliso amarkan, galkaaga ama faylkaaga si joogto ah ayaa loo tirtiri doonaa iyada oo aan wax caddayn ah la helin.

Ka saar nooca faylka qaarkood

Aynu ka soo qaadno inaad haysatid noocyo badan oo faylal ah sida TXT , PNG , DOCX , PDF , iwm. oo aad rabto inaad tirtirto dhammaan shayada marka laga reebo faylalka TXT . Xaaladdaas, waxaad isticmaali kartaa -exclude parameter. Amarku wuxuu u eg yahay sidan-

Remove-Item –path C:\Users\user-name\Desktop\TWC* -exclude *.txt

Waxaa laga yaabaa inaad horeba u qiyaastay – waxay ka saari doontaa dhammaan faylasha txt oo waxay tirtiri doontaa kuwa kale. Si kastaba ha ahaatee, waxay muujinaysaa fariinta xaqiijinta. Haddii aad rabto inaad si toos ah u tirtirto, waxaad isticmaali kartaa -recurse parameter sidaan hore u soo sheegnay.

Waxaan rajeynayaa in amarradan ay ku caawin doonaan.(I hope these commands will be helpful for you.)



About the author

Waxaan ahay injineer software leh in ka badan 10 sano oo waayo-aragnimo ah horumarinta iyo dayactirka Windows 11 ama 10 codsiyada. Waxaan sidoo kale khibrad u leeyahay la shaqeynta Google Docs iyo Microsoft Edge. Xirfadahayga meelahan ayaa iga dhigaya musharax aad u wanaagsan doorarka injineernimada software mustaqbalka.



Related posts