New
#1
how can i spin down HDD or put drive offline / online using .bat file?
Hiya, sorry if this has been discussed before, but i didn't find anything specific and nothing that would help.
can someone please tell me how i can make a batch file that either spins down my HDD permanently (until i manually spin it up again) or simply put disk to offliine mode?
i know i can do that via disk management, but that's too long. i need a simple batch file i can click on to quickly put drive offline / online.
i did some research and some say use cmd and diskpart, one answer i found is:
but this doesn't work for shit. i dont know which dark hole some people pull this info from. if i put this into batch file, it just makes an empty file on my desktop and nothing else. and yes, obvously i replaced "x" with the disk number that i want to put online/offlineCommand line to set online disk:
DISKPART > list disk
select disk x
offline disk
another post says use powershell script and put this in script:
typically this doesn't work either."select disk 2", "offline disk" | diskpart
and to put it back online:
"select disk 2", "online disk" | diskpart
i also found someone saying:
but i have no idea how he can use this as a script. or he means literally without using a script? because topic was about USING A SCRIPT and not doing it manually, so i think he's confused as what was asked.So, without creating any temporary script files you can call diskpart like this:
PS C:\> $command = @'
>> select disk 0
>> offline disk
>> '@
>>
PS C:\> $command | diskpart
DISKPART>
Disk 0 is now the selected disk.
DISKPART>
DiskPart successfully offlined the selected disk.
DISKPART> PS C:\>
anyway sorry for the long post, i just wanted to bring some examples. i know 100% its possible to do it via batch file, because i had it, but on some reason i deleted the batch files and i can't find them anywhere. i had 2 batch files, one to spin down HDD and other to spin it back up. if i remember right, it was not using diskpart, it literally spun down the drive without putting it offline, i was able to see the drive in windows, but it wasn't responding and i could hear the drive spin down.
i might have been using some 3rd party cmd line tool, but it was years ago and i can't remember. so can someone please refresh my memory or provide any other way to achieve this?
i'm just so tired of windows randomly spinning up my drives while i'm not using them, it really gets on my nerves. i have 5x4tb HDDs and windows keeps touching them when i'm not using them. like the other day i was playing a multiplayer game and all the sudden windows starts spinning up all the drives, i could hear them go one after another and it caused my game to freeze for a good 5 seconds, because of whatever windows was doing! this has really made me angry and i'm losing my patience.
i hope someone can help me out. thanks in advance.