How to prevent suspend during the execution of bat file?

Hello x9zero and welcome to the forums :party:

Windows defrags automatically, so I don't know why you're doing it in a batch file, but I'll help you out anyway. The easiest way would be to turn up the standby and hibernate timeout:

POWERCFG -Change -hibernate-timeout-ac 10080
POWERCFG -Change -standby-timeout-ac 10080
POWERCFG -Change -hibernate-timeout-dc 10080
POWERCFG -Change -standby-timeout-dc 10080


That will change the timeout for them to one week - hopefully your defrag can finish before then!

I don't know the default values to change them back to at the end, but I'll let you know when I find them :)

Tom
 

My Computer

System One

  • Manufacturer/Model
    Build #1
    CPU
    Intel Core i7 3770K @4.4GHz
    Motherboard
    ASUS P8Z77-V PRO
    Memory
    Corsair Vengeance 2x4GB DDR3 1600MHz Low Profile (White)
    Graphics Card(s)
    Gigabyte Radeon HD 7850 (2GB GDDR5)
    Sound Card
    Integrated on motherboard
    Monitor(s) Displays
    23" LG LCD/LED IPS
    Screen Resolution
    1920*1080
    Hard Drives
    Samsung EVO 128GB SSD
    Seagate Barracuda 2TB 7200rpm
    2x500GB Seagate FreeAgent 5400rpm
    PSU
    Corsair TX650W V2 (80+ Bronze)
    Case
    NZXT Phantom 410
    Cooling
    Corsair H100 Water Cooler, 1x140mm and 1x120mm stock fans
    Keyboard
    Microsoft Desktop 2000 Wireless Keyboard
    Mouse
    Microsoft Desktop 2000 Wireless Mouse
    Internet Speed
    95 Mb/s Download 70 Mb/s Upload
Back
Top