Could a batch file wipe out a Windows install?

Foebane

New member
Local time
10:17 AM
Messages
20
Yesterday I had a collection of batch files which worked, but I wanted to refine them and make them more robust by using variables like %~1. The batch files involved totally removing old folders and subfolders in a specified path and replacing them with ZIP files from a backup.

Well, I converted them fine and they ran with variables provided from a secondary batch file.

HOWEVER, at one point I thought I'd run the original file, and next thing I know I'm getting a lot of unusual filenames from what seems like a system folder and "ACCESS DENIED" all over them, and I realised it was going to try to wipe out my system folders instead, all because the variables were blank.

I stopped the batch file and discovered that apps in "Program Files" had been deleted, but Windows was still operating. I didn't reset, but ran System Restore instead to a Restore Point that had been made just yesterday morning, and whilst it restored fine (I hope) it took a long time to initialise.

As of now everything seems to work again, but my "PerfLogs" file in the C:\ root is gone, and I only hope it's not important. And yes, I immediately put in conditional commands in the batch file to exit if there were no variables, so no more problems there.

But what could've happened otherwise? Can an installation of Windows be crippled or even wiped out by an errant batch file?
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
A batch file can run any CMD so it can destroy the system the only thing stopping it is permission on system folders
 

My Computer My Computer

Computer type
PC/Desktop
OS
win 8 32 bit
Windows don't allow to modify or delete files that are in use, so most system files will be intact, but it doesn't mean that a severe damage can be avoided.
I'll suggest to run System File check
sfc /scannow
 

My Computers My Computers

System One System Two

  • Computer type
    PC/Desktop
    Computer Manufacturer/Model Number
    custom build
    OS
    Windows 7 HP 64
    CPU
    i5 6600K - 800MHz to 4200MHz
    Motherboard
    GA-Z170-HD3P
    Memory
    4+4G GSkill DDR4 3000
    Graphics Card(s)
    IG - Intel 530
    Monitor(s) Displays
    Samsung 226BW
    Screen Resolution
    1680x1050
    Hard Drives
    (1) -1 SM951 – 128GB M.2 AHCI PCIe SSD drive for Windows 7 and Lubuntu
    (2) -1 WD SATA 3 - 1T for Data
    (3) -1 WD SATA 3 - 1T for backup
    PSU
    Thermaltake 450W TR2 gold
    Keyboard
    Old and good Chicony mechanical keyboard
    Mouse
    Logitech mX performance - 9 buttons (had to disable some)
    Internet Speed
    500Mb/s
    Browser
    Firefox 64
    Other Info
    TinyWall firewall
  • Computer type
    Laptop
    System Manufacturer/Model Number
    Asus Q550LF
    OS
    Windows 7 Pro
    CPU
    i7-4500U 800MHz to 3.0GHz
    Motherboard
    Asus Q550LF
    Memory
    (4+4)G DDR3 1600
    Graphics Card(s)
    IG intel 4400 + NVIDIA GeForce GT 745M
    Sound Card
    Realtek
    Monitor(s) Displays
    LG Display LP156WF4-SPH1
    Screen Resolution
    1920 x 1080
    Hard Drives
    BX500 120G SSD for Windows and programs +
    1T HDD for data
    Internet Speed
    500 Mb/s
    Browser
    Firefox
    Other Info
    TinyWall firewall
Going forward, be like me, make full images of OS and Data partitions onto external media just before experimenting :)
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Antec desktop; Acer Aspire laptops
OS
Windows 7 Professional 64-bit
CPU
Desktop i5; Acers i5 & i7
Memory
desktop 16GB; 1 Acer 8GB & 1 Acer 16GB
Hard Drives
1TB split into 2 equal partitions [OS and data] usable by RJS
Internet Speed
AT&T DSL
Browser
FF, GChrome, msIE
Other Info
Windows 7 Firewall, Emsisoft AM/AV, MSE [scan-only], SpywareBlaster, Ruiware/BillP combine
IF "%~1"=="" EXIT /B
IF "%~2"=="" EXIT /B
DEL /F /S /Q "%~1\%~2\*.*"
RD /S /Q "%~1\%~2"
MD "%~1\%~2"
ATTRIB +A "%~1\%~2"
"C:\Program Files\7-Zip\7z.exe" X "%~1\ZIP\%~2\*.zip" -O"%~1\%~2"

This is the batch file responsible, with the protection added. I wouldn't advise running this without the IF statements. What sort of damage could this file do?
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
Back
Top