I'm looking to create a batch file to auto shut down my machine after a certain amount of time. Just want to check if i have got the 1st part of the command right in notepad but i was not sure how i go about putting in a timer for example if my download has 2hrs left i would like to set the batch to run say 2hrs 30mins after running it.
@echo off
shutdown /s
Hope you can help many thanks
My Computer
OS
Windows 7 64bit
CPU
Phenom IIx4 955 Black Edition
Memory
4GB Kingston 1066mhz DDR2
Graphics Card(s)
Gigabyte 260GTX
Monitor(s) Displays
Samsung syncmaster 2033
Hard Drives
500GB Samsung ATA
500GB Segate ATA
PSU
Antec True blue 750W Modular
Case
Antec 1200
Cooling
Prolimatech Megahalems Performance CPU Cooler/2x Apache Fan
You need to add the /t xxx switch where xxx is the time delay in seconds. So for 2hrs 30mins, xxx would be 9000. This means that your code should read as follows:
Code:
@echo off
shutdown /s /t 9000
To cancel before the time elapses, use the following command: shutdown /a
4 x 4GB DDR3-1600 Corsair Vengeance CMZ8GX3M2A1600C9B (16GB)
Graphics Card(s)
MSI GeForce GTX770 Gaming OC 2GB
Sound Card
Realtek High Definition on board solution (ALC 898)
Monitor(s) Displays
ViewSonic VA1912w Widescreen (VGA)
Screen Resolution
1440x900
Hard Drives
OCZ Agility 3 SSD 120GB SATA III x2 (RAID 0)
Samsung HD501LJ 500GB SATA II x2
Hitachi HDS721010CLA332 1TB SATA II
Iomega 1.5TB Ext USB 2.0
WD 2.0TB Ext USB 3.0
Thanks for that mate really appreciate it, do i have to have the cancel command in the batch all the time or do i have to add it in if i decide i dont want the machine to shutdown then run the batch again?
thanks matey
My Computer
OS
Windows 7 64bit
CPU
Phenom IIx4 955 Black Edition
Memory
4GB Kingston 1066mhz DDR2
Graphics Card(s)
Gigabyte 260GTX
Monitor(s) Displays
Samsung syncmaster 2033
Hard Drives
500GB Samsung ATA
500GB Segate ATA
PSU
Antec True blue 750W Modular
Case
Antec 1200
Cooling
Prolimatech Megahalems Performance CPU Cooler/2x Apache Fan
Click on the Start Orb, and enter shutdown /a to cancel the pending shutdown. It does not belong in the batch file. Alternatively, you could create another batch file with shutdown /a in it and have that on the Desktop next to the one that starts the shutdown.
My Computer
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
4 x 4GB DDR3-1600 Corsair Vengeance CMZ8GX3M2A1600C9B (16GB)
Graphics Card(s)
MSI GeForce GTX770 Gaming OC 2GB
Sound Card
Realtek High Definition on board solution (ALC 898)
Monitor(s) Displays
ViewSonic VA1912w Widescreen (VGA)
Screen Resolution
1440x900
Hard Drives
OCZ Agility 3 SSD 120GB SATA III x2 (RAID 0)
Samsung HD501LJ 500GB SATA II x2
Hitachi HDS721010CLA332 1TB SATA II
Iomega 1.5TB Ext USB 2.0
WD 2.0TB Ext USB 3.0