Solved Making sfc /scannow .bat file

David Bailey

Banned
Messages
10,485
Location
Harrisonburg, Va.
The following images show how to make a batch file for sfc /scannow that opens with one or two clicks:

They are numbered in the order of reading them.

I numbered them because they never show up in the proper order when attached. :(


001.png003.png005.png007.png008.png
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
Thanks for sharing the info. However, a simple way to create a bat file is to right click on the desktop->New->Text Document and enter 2 statements on separate lines: sfc /scannow, pause then save it as RunSFC.bat or whatever you name it.

NOTE: you need to put a pause statement after sfc /scannow so that the user will have a chance to read the output message, otherwise the command windows just simply closes.
 

My Computer

System One

  • OS
    8.1x64PWMC Ubuntu14.04x64 MintMate17x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Brewed
    CPU
    I7 4970K OC'ed @4.7 GHz
    Motherboard
    MSI-Z97
    Memory
    16 GB G-Skill Trident X @2400MHZ
    Graphics Card(s)
    NVIDIA GeForce GTS 450
    Sound Card
    X-Fi Titanium Fatal1ty Professional Series
    Monitor(s) Displays
    Dual HP-W2408
    Screen Resolution
    1920X1200
    Hard Drives
    256 GB M2 sm951, (2) 500GB 850EVO, 5TB, 2 TB Seagate
    PSU
    Antec 850W
    Case
    Antec 1200
    Cooling
    Danger Den H20
    Keyboard
    Logitech
    Mouse
    Logitech Performance Mouse MX
    Internet Speed
    35/12mbps
    Browser
    Firefox
Thanks for the information on adding PAUSE. :)

Would that be:

sfc /scannow, pause

or

sfc /scannow
pause
 

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
It should be on separate lines:
sfc /scannow
pause

OR:
@ sfc /scannow
@ pause

OR:
@ sfc /scannow & pause

By adding '@' the command will not be echoed in the command windows.
adding & if you want multiple commands in one line
 
Last edited:

My Computer

System One

  • OS
    8.1x64PWMC Ubuntu14.04x64 MintMate17x64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home Brewed
    CPU
    I7 4970K OC'ed @4.7 GHz
    Motherboard
    MSI-Z97
    Memory
    16 GB G-Skill Trident X @2400MHZ
    Graphics Card(s)
    NVIDIA GeForce GTS 450
    Sound Card
    X-Fi Titanium Fatal1ty Professional Series
    Monitor(s) Displays
    Dual HP-W2408
    Screen Resolution
    1920X1200
    Hard Drives
    256 GB M2 sm951, (2) 500GB 850EVO, 5TB, 2 TB Seagate
    PSU
    Antec 850W
    Case
    Antec 1200
    Cooling
    Danger Den H20
    Keyboard
    Logitech
    Mouse
    Logitech Performance Mouse MX
    Internet Speed
    35/12mbps
    Browser
    Firefox

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
Learned new stuff

I added the PAUSE & it kept the window open.
It said to press any key to continue.
I pressed Space bar & the window closed. :)

Untitled.png

A note to Brink --- I studied the adding of images in proper order & figured it out.
Thanks for the help. :)

Also, I figured out making test posts without posting them.
I just Preview the test post & make changes as needed & when done close the window.
I don't clutter up the forum with tests.
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
Added new Lines to .bat code

Code:
sfc /scannow
PAUSE
Dism /Online /Cleanup-Image /RestoreHealth
PAUSE

Untitled.png

The DISM command actually fixes things SFC can't fix.
See picture:

Untitled (2).png

Before running it, SFC found un-fixable problems.


After running it, All problems were fixed. :)

See picture:

Untitled.png

If you run sfc /scannow as in the .bat file & see problems not fixed press any key & the DISM command will run & fix the problems. :)

Or to be more efficient you could add another sfc /scannow & pause:

Code:
sfc /scannow
PAUSE
Dism /Online /Cleanup-Image /RestoreHealth
PAUSE
sfc /scannow
PAUSE

If you wanted to run sfc /scannow again just to be sure things are fixed. :)
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
Hi, David. Like I wrote you > This is very handy. Thanks for the additions. :thumb:

Is it possible to omit the pause so as to start one right after the other?
 

My Computer

System One

  • OS
    8.1 Pro X64
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Acer T690
    CPU
    Intel Pentium D Dual Core
    Motherboard
    Acer/Intel E946GZ
    Memory
    2GB (max upgrade)
    Graphics Card(s)
    Intel Graphics Media Accelerator 3000 - PCI Express x16
    Sound Card
    Integrated RealTek ALC888 high-definition audio with 7.1 channel audio support
    Monitor(s) Displays
    Acer AL1917W A LCD
    Screen Resolution
    1440 X 900
    Hard Drives
    350 GB Seagate Barracuda 7200.10
    Thumb drives
    PSU
    Standard 250 watt
    Case
    Desktop 7.2" (183mm) W x 17.5" (445mm) L x 14.5"
    Cooling
    Dual case fans + CPU fan
    Keyboard
    Acer Windows PS/2
    Mouse
    Wireless Microsoft Arc
    Internet Speed
    54mbp/s
    Browser
    IE11
    Antivirus
    Defender
    Other Info
    Office Pro 2013 / Nokia Lumia 1520 Windows Phone 8.1DP GDR1
Hi, David. Like I wrote you > This is very handy. Thanks for the additions. :thumb:

Is it possible to omit the pause so as to start one right after the other?

Yes.

With no pause the next one starts automatically.

Leave a pause at the end so the window does not disappear. :)

Sorry for the late response. :(
 

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
Added new Lines to .bat code

Code:
sfc /scannow
PAUSE
Dism /Online /Cleanup-Image /RestoreHealth
PAUSE

View attachment 19490

The DISM command actually fixes things SFC can't fix.
See picture:

View attachment 19491

Before running it, SFC found un-fixable problems.


After running it, All problems were fixed. :)

See picture:

View attachment 19489

If you run sfc /scannow as in the .bat file & see problems not fixed press any key & the DISM command will run & fix the problems. :)

Or to be more efficient you could add another sfc /scannow & pause:

Code:
sfc /scannow
PAUSE
Dism /Online /Cleanup-Image /RestoreHealth
PAUSE
sfc /scannow
PAUSE

If you wanted to run sfc /scannow again just to be sure things are fixed. :)
How can you restart the system before it runs the dism command
 

My Computer

System One

  • OS
    Windows 10
    Computer type
    Laptop
I would like to have such a batch file in Windows 10; do you know if what works in Win8, can't work in Win10 ? If so what code modification is required ?
 

My Computer

System One

  • OS
    Win8.1
    Computer type
    Tablet
    System Manufacturer/Model
    ACER Iconia Tab 8 w
    CPU
    Intel Atom Z3735G Quad-core 1.33 GHz
    Memory
    1Gb
    Browser
    I.E.
I would like to have such a batch file in Windows 10; do you know if what works in Win8, can't work in Win10 ? If so what code modification is required ?
Yes, the same batch files will work in Win10 and Win11. Note that to use the SFC and DISM commands you need to run the batch file as an administrator. To make life simple I have put shortcuts to my batch files on the desktop, and have set their Advanced Properties to 'Run as administrator'.

1724947249064.png
 

My Computer

System One

  • OS
    8.1
    System Manufacturer/Model
    Hyper-V
It has (obviously) taken me time to get round to trying and replying. It worked so well right from the start that I can not imagine why I posted the question. But I CAN say that 'running it as administrator' makes ALL the difference.
 
Last edited:

My Computer

System One

  • OS
    Win8.1
    Computer type
    Tablet
    System Manufacturer/Model
    ACER Iconia Tab 8 w
    CPU
    Intel Atom Z3735G Quad-core 1.33 GHz
    Memory
    1Gb
    Browser
    I.E.
Back
Top