Hur rengör man datorn med CMD? Kör dessa kommandon här!
Hur Rengor Man Datorn Med Cmd Kor Dessa Kommandon Har
Hur rengör man datorn med CMD om du tycker att datorn går långsamt med litet diskutrymme? Du kommer till rätt ställe och du kan ta reda på hur du kör kommandon för rengöring av PC från det här inlägget på MiniTool webbplats för att frigöra diskutrymme och förbättra datorns prestanda.
Det är nödvändigt att rengöra datorn
Windows operativsystem är ett populärt system och du kan använda många funktioner på datorn som kör Windows. Men allt eftersom tiden går, körs många bakgrundsuppgifter för att ta upp många systemresurser, och temporära filer skapas för att ta upp diskutrymme även om dessa filer är små. Som ett resultat går datorn långsamt och lite diskutrymme visas.
I det här fallet måste du rengöra din dator regelbundet för att snabba upp maskinen och förbättra datorns prestanda. Diskrensning kan låta din dator fungera smidigt och eliminera vissa problem som gör att datorn kraschar.
Windows kommer med några rengöringsverktyg som diskrensning, defragmenteringsverktyg etc. Men några av er väljer att rengöra datorn med CMD (kommandotolk). Även om ett grafiskt gränssnitt är praktiskt för de flesta, kanske vissa av er föredrar att använda kommandotolken för att utföra många uppgifter eftersom det är mer effektivt, roligt och riktigt kraftfullt och ger prestandafördelar.
Om du inte vet hur man kör kommandon för att rengöra PC, följ den givna guiden för att rengöra dator inklusive radering av oönskade filer, temporära filer och förhämta filer, defragmentering av din hårddisk, radering av en disk och mer.
Hur man rengör datorn med CMD
I den här delen kommer vi att visa dig hur du använder olika kommandon för att rensa olika filer. Först måste du öppna kommandotolken med administratörsrättigheter.
Steg 1: I Windows 10/11, skriv cmd i sökrutan.
Steg 2: Klicka Kör som administratör från popup-fönstret för att öppna CMD-fönstret.
Utöver det här sättet kan du öppna kommandotolken i andra metoder och hänvisa till detta relaterade inlägg - Hur öppnar man kommandotolken (CMD) i Windows 11? (7 sätt) .
Utför sedan rengöringsoperationen via några rengöringskommandon i CMD.
Kör Cleanmgr för att rensa oönskade filer
Cleanmgr är ett automatiserat diskrensningsverktyg i Windows operativsystem. Den kan söka och analysera din hårddisk för att hitta filer som inte längre behövs och radera dem automatiskt för att frigöra diskutrymme på hårddisken.
Genom att konfigurera cleanmgr.exe med kommandoradsväxlar, kan temporära installationsfiler, internetfiler, nedladdade programfiler, gamla chkdsk-filer, papperskorgfiler och mer raderas. Du kan använda verktyget Schemalagda uppgifter för att schemalägga uppgiften att köras vid en viss tidpunkt.
Låt oss se hur du rengör datorn med CMD - Cleanmgr.
Steg 1: Öppna CMD med administratörsrättigheter.
Steg 2: Skriv Cleanmgr i CMD-fönstret och tryck Stiga på .
Steg 3: Ett litet fönster dyker upp och ber dig välja den enhet du vill rensa upp. Klicka sedan OK .
Steg 4: Markera objekten du vill ta bort och sedan tar det här verktyget bort dem för att frigöra diskutrymme.
Cleanmgr - kommandot för diskrensning, erbjuder flera parametrar dedikerade till specifika funktioner, och låt oss se exempel.
1. Cleanmgr /sageset
Det här kommandot för diskrensning hjälper till att direkt hoppa över valet av enhet och omdirigera dig till fönstret Diskrensningsinställningar för att välja de objekt som du vill att Diskrensning ska rensa automatiskt under dess schemalagda körtider.
2. Cleanmgr /sagerun
Det här kommandot väljer inte kategorin och hjälper till att automatisera diskrensningsprocessen.
3. Cleanmgr /lowdisk
Detta kommando är mycket användbart när hårddisken möter lågt diskutrymme. När du kör det här kommandot kommer alla kryssrutor för filkategorier att vara markerade som standard. Kommandoexemplet är som – cleanmgr /lowdisk/dc . Här hänvisar c till enhetsbeteckningen.
Kommandot - cleanmgr /verylowdisk/dc hjälper till att radera alla skräpfiler snabbt utan att användaren uppmanas.
För att veta mer information om den här rena chefen kan du hänvisa till vårt tidigare inlägg - Vad är Cleanmgr.exe & är det säkert och hur man använder det .
Kör CMD till Temp-filer
Windows kan skapa temporära filer för tillfälligt bruk och de kallas Temp. Under driften av ett program genereras dessa filer för säkerhetskopiering och lagrar information på kort tid. De är främst till för att lagra, överföra data och återställa förlorad data.
Temp-filer tar inte upp mycket diskutrymme och spelar en viktig roll för att ditt system ska fungera smidigt. Efter avslutade uppgifter kommer systemet automatiskt att ta bort dem från de tillfälliga mapparna. Det är bara säkert när temporära filer inte används av några appar. Annars kommer Windows att blockera dig från att ta bort dem med resultatet - misslyckade appuppgifter.
För temporära filer skapade av Windows operativsystem är lagringssökvägen %system%/windows/temp . Medan för de temporära filerna som skapats av användarna är sökvägen C:\Users\användarnamn\AppData\Local\Temp .
Om du vill visa temporära filer, kör det här kommandot - %SystemRoot%\explorer.exe %temp%\ . Detta kan öppna Temp-mappen i File Explorer. Tryck bara på Ctrl + A för att välja alla filer och ta bort dem. Eller kör kommandot - del %temp%\*.* /s /q för att radera dem. CMD-verktyget kan automatiskt hoppa över alla filer som för närvarande används men radera resten av filerna.
Defragmentera din hårddisk via CMD
När du talar om 'ren dator med CMD' finns det en sak du bör tänka på är diskdefragmenteringen. Även om fragmentering på hårddisken (endast för den traditionella hårddisken) är en naturlig företeelse, kan det leda till problem med datorns prestanda, till exempel kan åtkomst- och skrivhastigheten påverkas, vilket saktar ner systemet.
Defrag kan omorganisera fragmenterad data på hårddisken så att din dator kan komma åt filer från hårddisken. Du behöver inte defragmentera dina SSD-enheter eftersom detta kan förstöra dem eller minska deras livslängd. Defragmentera bara dina hårddiskar genom att följa clean-kommandot i CMD - defragmentera drivrutinsbokstav: .
Steg 1: Öppna kommandotolken som administratör.
Steg 2: Skriv defragmentera c: i CMD-fönstret och tryck Stiga på . Här byt ut c: med din enhetsbeteckning
Ta bort förhämtningsfiler med kommandotolken
När du först använder ett program kommer Windows operativsystem att skapa förhämtningsfiler som kan fungera som en cache senare. Det vill säga, förhämtningsfiler används för att lagra information om programvaruaktivitet, inklusive hur många gånger programvaran har körts, när appen kördes och tillhörande filer som används av programvaran.
Dessa förhämtningsfiler är textfiler med filtillägget .pf och de är mycket användbara för snabbare inläsning av program. Men de kan ta upp mycket diskutrymme. Och om du stöter på appbuggar eller laggar kan du välja att ta bort dessa filer. Att ta bort dem är ofarligt och Windows kommer att skapa förhämtningsfiler igen nästa gång du öppnar program på din dator.
Se hur du rengör datorn med CMD genom att ta bort förhämtningsfiler:
Steg 1: Öppna CMD med administratörsbehörigheter i Windows.
Steg 2: Skriv %SystemRoot%\explorer.exe C:\Windows\prefetch\ till kommandotolksfönstret och tryck på Stiga på för att kontrollera förhämtningsfilerna. Detta kan öppna mappen Prefetch i File Explorer.
Steg 3: Skriv del C:\Windows\prefetch\*.*/s/q och tryck Stiga på för att radera dessa förhämtningsfiler. Alternativt kan du ta bort mappen Prefetch direkt från Utforskaren i Windows.
Rensa cacheminne i Windows
Cachefiler kan dramatiskt förbättra prestanda, tillgänglighet och skalbarhet, och de kan ge möjligheten att leverera data snabbt och snabbare svarstider. Men om cachefiler går fel kan problem med datahämtning, fel eller till och med krascher inträffa. En vanlig lösning är att rensa cachefiler regelbundet.
Du kan välja att rensa DNS-cachen och Windows-butikscachen. Om något går fel under cache-rensningen kommer Windows-systemet att berätta för dig.
För att rensa DNS-cachen, kör kommandot - ipconfig/flushDNS i CMD-fönstret. För att rensa Windows Store-cache, kör det här kommandot - wsreset.exe .
DISM Windows Image Cleanup
Deployment Image Servicing and Management (DISM) är ett användbart kommandoverktyg som kan hjälpa till att serva och förbereda systemavbildningar. Du kan använda DISM för att hantera en Windows-avbildning (.wim) och virtuell hårddisk (.vhd). Den används för Windows återställningsmiljö (WinRE), Windows PE och Windows Setup. Via DISM-verktyget kan du fixa många systemfel inklusive uppdateringsfel, startfel och mer.
För att kontrollera om det finns någon korruption, kör DISM /online /Cleanup-Image /CheckHealth i CMD-fönstret.
För att skanna Windows-bilden, kör det här kommandot - DISM /Online /Cleanup-Image /ScanHealth .
För att fixa Windows-bilder, skriv DISM /Online /Cleanup-Image /RestoreHealth i CMD-fönstret och tryck Stiga på .
Rengör kommando i Diskpart
Förutom att rengöra datorn med CMD genom att ta bort oönskade filer, temporära filer och förhämtningsfiler, rensa cacheminnet, defragmentera din hårddisk och köra DISM, finns det en annan aspekt för att rengöra din PC och det är att använda Diskpart för att radera hela disken data.
Diskpart är ett kommandoradsdiskverktyg som ingår i Windows 2000 och senare Windows-operativsystem för att ersätta dess föregångare - fdisk. Det kan användas för att hantera dina diskar och partitioner, till exempel skapa partitioner, ta bort partitioner, radera hela diskdata, etc. För att veta mer information om detta verktyg, se vårt biblioteksdokument - Vad är DiskPart och hur man använder det? (Ultimativ guide och tips) .
Om du förbereder dig på att ge upp din hårddisk eller USB-flashenhet kan du välja att använda Diskpart för att radera all diskdata och låta enheten bli oallokerat utrymme.
När du använder Diskpart kan du välja ett felaktigt objekt. Som ett resultat går data förlorad och du kan inte återställa den. Så du kan inte vara för försiktig. Dessutom rekommenderar vi starkt att du skapar en säkerhetskopia för dina viktiga filer.
Säkerhetskopiera kritiska data före Cleanup Command Diskpart
För att säkerhetskopiera dina viktiga filer på hårddisken eller USB-minnet kan du välja att använda Windows inbyggda säkerhetskopieringsverktyg – Säkerhetskopiera och återställa (Windows 7). Gå bara till öppna Kontrollpanelen , se alla objekt efter Stora ikoner , och klicka Säkerhetskopiera och återställa (Windows 7) för att öppna det här verktyget. Klicka sedan Upprätta backup och starta en säkerhetskopiering av filer genom att följa instruktionerna på skärmen.
Om du inte vill använda det här verktyget utan leta efter en professionell och gratis programvara för säkerhetskopiering för säkerhetskopiering av filer är MiniTool ShadowMaker ett bra alternativ. Denna programvara stöder filer, mappar, diskar, partitioner och systemsäkerhetskopiering och återställning, filsynkronisering och diskkloning. Viktigt är att det fungerar även om datorn inte startar. Klicka bara på följande knapp för att få provversionen gratis i 30 dagar.
Steg 1: Dubbelklicka på .exe-filen och installera MiniTool ShadowMaker på din PC genom att följa guiderna på skärmen.
Steg 2: Öppna denna programvara och klicka Fortsätt rättegången att fortsätta.
Steg 3: För att säkerhetskopiera dina filer kan du gå till Säkerhetskopiering sida eller Synkronisera fliken, välj de objekt du vill säkerhetskopiera och lagringsvägen som en extern hårddisk eller USB-flashenhet.
Steg 4: Klicka Säkerhetskopiera nu eller Synkronisera nu för att utföra säkerhetskopieringsuppgiften.
Rengör hårddisken via Diskpart
Därefter är det dags att använda kommandot clean i CMD – Diskpart. Se hur du rengör datorn med CMD:
Steg 1: I CMD-fönstret skriver du diskdel och tryck Stiga på .
Steg 2: Skriv lista disk och tryck Stiga på .
Steg 3: Kör kommandot - välj disk n . N betyder disknumret. Om du ser att diskens status visas offline, skriv online disk och slå Stiga på .
Steg 4: För att torka hårddisken, kör rena eller städa allt .
Om du vill veta skillnaden mellan kommandot - rengör och rengör allt, kan du hitta detaljer från vårt tidigare inlägg - Diskpart Clean vs Clean All: Välj ett sätt att torka diskar .
Slutsats
Det är all information om hur man rengör datorn med CMD inklusive radering av oönskade filer, temporära filer och förhämtning av filer, defragmentering av din hårddisk, rengör cache, radering av en disk och kör DISM. Om du behöver, kör bara kommandon för rengöring av PC genom att följa den givna guiden. Hoppas du kan ha en smidig dator. Om du har andra idéer om rensningskommandon, låt oss veta i kommentarsdelen nedan. Tack.