Monday, January 7, 2013

SCRIPT WINDOWS DISMOUNT UNMOUNT recovery partition / usb

@Echo Off echo LIST VOLUME > "%TEMP%\DISKPARTSCRIPT.TXT" DISKPART /S "%TEMP%\DISKPARTSCRIPT.TXT" > "%TEMP%\FOUNDVOLUMES.TXT" For /F "tokens=2" %%I in ('FindStr /C:"System Rese" "%TEMP%\FOUNDVOLUMES.TXT"') Do Call :PARSE %%I DEL /Q "%TEMP%\DISKPARTSCRIPT.TXT" DEL /Q "%TEMP%\FOUNDVOLUMES.TXT" GoTo :EOF :PARSE If "%1"=="" GoTo :EOF set FREEDRIVELETTER=NONE for %%p in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if not exist %%p:\nul set FREEDRIVELETTER=%%p if %FREEDRIVELETTER% == NONE goto :NOFREEDRIVES echo Assigning Volume %1 To %FREEDRIVELETTER%: echo SELECT VOLUME %1 > "%TEMP%\DISKPARTMOUNTSCRIPT.TXT" echo ASSIGN LETTER=%FREEDRIVELETTER% >> "%TEMP%\DISKPARTMOUNTSCRIPT.TXT" echo SELECT VOLUME %1 > "%TEMP%\DISKPARTUNMOUNTSCRIPT.TXT" echo REMOVE >> "%TEMP%\DISKPARTUNMOUNTSCRIPT.TXT" DISKPART /S "%TEMP%\DISKPARTMOUNTSCRIPT.TXT" > NUL DEL /Q "%TEMP%\DISKPARTMOUNTSCRIPT.TXT" echo Do all the stuff you need on the system recovery partition. Then hit a key to continue to unmount. PAUSE > NUL DISKPART /S "%TEMP%\DISKPARTUNMOUNTSCRIPT.TXT" > NUL echo Drive unmounted. Have a nice day. DEL /Q "%TEMP%\DISKPARTUNMOUNTSCRIPT.TXT" SHIFT GoTo :PARSE GOTO :EOF :NOFREEDRIVES echo No free drive letters available!



http://forums.mydigitallife.info/threads/6936-Useful-script-that-mounts-and-unmounts-the-system-recovery-drive

Post subject: batch scripts for turning off hard drives from windowsPosted: Mon Nov 30, 2009 12:05 am Joined: Mon Jan 07, 2008 3:51 pmPosts: 77Location: Edinburgh, ScotlandUsing HDDScan-s command line builder and mountvol, I figured out the following two commands to unmount a hard drive (it only works with additional drives, like D:\), and spins it down, then mount it back later. If I don't unmount it first, sooner or later there is always a windows program in the background which queries it, but unmounting takes care about that. Here is the code, if you are interested. spindown.bat Code:mountvol d:\ /d"HDDScan.exe" "\\?\ide#diskst31000528as____________________________cc44____#5&1c80af87&0&2.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}" -Zspinup.batCode:mountvol d:\ \\?\Volume{6708118c-cb14-11de-959d-806e6f6e6963}\For the HDDScan part you can use the built in command line builder, for the mountvol, you can type mountvol d:\ /L to get the code. Now my only problem is that using SpeenFan it triggers SMART values, which spins up the drive even if the partition is unmounted. I need to solve that, because except for that, this way if I ever buy a SSD I could just install OS to the SSD and only turn on those hard drives I need to use, meaning many TB's storage without any noise, when not needed.Top    whiic Post subject:Posted: Mon Nov 30, 2009 8:26 am Joined: Wed Sep 06, 2006 11:48 pmPosts: 575Location: FinlandNice short tutorial. "Now my only problem is that using SpeenFan it triggers SMART values, which spins up the drive even if the partition is unmounted. I need to solve that" That's the easy part. Just disable temperature monitoring of selected hard drives. Temperature monitoring of HDDs is performed by reading SMART data. HDD's internal SMART logics read temperature sensor continuosly, but the system can only read the temperature data by requesting all SMART data... and some of that is written on the platters, requiring HDD to spin up on temperature polling of SpeedFan. By default, SpeedFan polls all HDDs at 1 minute interval. Just click on "Configure", then "Temperatures", and then untick all HDDs you might occasionally want to spin down, and confirm all made changes by clicking "OK". Constant HDD temperature monitoring isn't required after initial monitoring of temperatures after installation of new drive to the system. Even then, I don't bother to check the temperatures unless I've made something out of the ordinary (sandwiching, enclosing, wrapping in sound-insulation (which unfortunately usually insulates heat as well), or with systems with ultra-low-airflow.

3 comments:

  1. Eject optical

    Dos_Probie said:08 Oct 2012 06:55

     = Another Eject DVD-RW for Context Menu =

    Adds "Eject DVD-RW Tray" text with Icon to your Desktop Context Menu, Works greatfor those Laptop optical drives that can be temperamental from time to time.It automatically scans correct dvd drive without any user interaction to add drive letter manually, tested and working on Win7 and Win8...=Easy 2 Step Install= 1. Copy/Paste Eject.cmd and Eject.vbs to System322. Run .reg fileNow right-click your desktop and click on the Eject DVD-RW icon.Code: [View]Windows Re

    'Eject DVD Tray For ALL Drive Letters 'Eject.vbs Set oWMP = CreateObject("WMPlayer.OCX.7" ) Set colCDROMs = oWMP.cdromCollection If colCDROMs.Count >= 1 then For i = 0 to colCDROMs.Count - 1 colCDROMs.Item(i).Eject Next ' cdrom End If rev. 10.12-Dos_Probie

    @echo off :: Eject.cmd :: EJECT FROM SCRIPT FILE echo 1 > %tmp%\dvdopen start "" eject.vbs cdrom open exit rev. 10.12-Dos_Probie

    Windows Registry Editor Version 5.00 ;Eject.reg ;Adds Eject DVD-RW Tray with Icon to Desktop Context Menu. [HKEY_CLASSES_ROOT\DesktopBackground\Shell\Eject DVD-RW Tray] "icon"="shell32.dll,-165" [HKEY_CLASSES_ROOT\DesktopBackground\Shell\Eject DVD-RW Tray\command] @="Eject.cmd" ;rev. 10.12-Dos_Probie

    ReplyDelete
  2. @Echo Off echo LIST VOLUME > "%TEMP%\DISKPARTSCRIPT.TXT" DISKPART /S "%TEMP%\DISKPARTSCRIPT.TXT" > "%TEMP%\FOUNDVOLUMES.TXT" For /F "tokens=2" %%I in ('FindStr /C:"System Rese" "%TEMP%\FOUNDVOLUMES.TXT"') Do Call :PARSE %%I DEL /Q "%TEMP%\DISKPARTSCRIPT.TXT" DEL /Q "%TEMP%\FOUNDVOLUMES.TXT" GoTo :EOF :PARSE If "%1"=="" GoTo :EOF set FREEDRIVELETTER=NONE for %%p in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if not exist %%p:\nul set FREEDRIVELETTER=%%p if %FREEDRIVELETTER% == NONE goto :NOFREEDRIVES echo Assigning Volume %1 To %FREEDRIVELETTER%: echo SELECT VOLUME %1 > "%TEMP%\DISKPARTMOUNTSCRIPT.TXT" echo ASSIGN LETTER=%FREEDRIVELETTER% >> "%TEMP%\DISKPARTMOUNTSCRIPT.TXT" echo SELECT VOLUME %1 > "%TEMP%\DISKPARTUNMOUNTSCRIPT.TXT" echo REMOVE >> "%TEMP%\DISKPARTUNMOUNTSCRIPT.TXT" DISKPART /S "%TEMP%\DISKPARTMOUNTSCRIPT.TXT" > NUL DEL /Q "%TEMP%\DISKPARTMOUNTSCRIPT.TXT" echo Do all the stuff you need on the system recovery partition. Then hit a key to continue to unmount. PAUSE > NUL DISKPART /S "%TEMP%\DISKPARTUNMOUNTSCRIPT.TXT" > NUL echo Drive unmounted. Have a nice day. DEL /Q "%TEMP%\DISKPARTUNMOUNTSCRIPT.TXT" SHIFT GoTo :PARSE GOTO :EOF :NOFREEDRIVES echo No free drive letters available!

    ReplyDelete
  3. Post subject: batch scripts for turning off hard drives from windowsPosted: Mon Nov 30, 2009 12:05 am Joined: Mon Jan 07, 2008 3:51 pmPosts: 77Location: Edinburgh, ScotlandUsing HDDScan-s command line builder and mountvol, I figured out the following two commands to unmount a hard drive (it only works with additional drives, like D:\), and spins it down, then mount it back later. If I don't unmount it first, sooner or later there is always a windows program in the background which queries it, but unmounting takes care about that. Here is the code, if you are interested. spindown.bat Code:mountvol d:\ /d"HDDScan.exe" "\\?\ide#diskst31000528as____________________________cc44____#5&1c80af87&0&2.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}" -Zspinup.batCode:mountvol d:\ \\?\Volume{6708118c-cb14-11de-959d-806e6f6e6963}\For the HDDScan part you can use the built in command line builder, for the mountvol, you can type mountvol d:\ /L to get the code. Now my only problem is that using SpeenFan it triggers SMART values, which spins up the drive even if the partition is unmounted. I need to solve that, because except for that, this way if I ever buy a SSD I could just install OS to the SSD and only turn on those hard drives I need to use, meaning many TB's storage without any noise, when not needed.Top    whiic Post subject:Posted: Mon Nov 30, 2009 8:26 am Joined: Wed Sep 06, 2006 11:48 pmPosts: 575Location: FinlandNice short tutorial. "Now my only problem is that using SpeenFan it triggers SMART values, which spins up the drive even if the partition is unmounted. I need to solve that" That's the easy part. Just disable temperature monitoring of selected hard drives. Temperature monitoring of HDDs is performed by reading SMART data. HDD's internal SMART logics read temperature sensor continuosly, but the system can only read the temperature data by requesting all SMART data... and some of that is written on the platters, requiring HDD to spin up on temperature polling of SpeedFan. By default, SpeedFan polls all HDDs at 1 minute interval. Just click on "Configure", then "Temperatures", and then untick all HDDs you might occasionally want to spin down, and confirm all made changes by clicking "OK". Constant HDD temperature monitoring isn't required after initial monitoring of temperatures after installation of new drive to the system. Even then, I don't bother to check the temperatures unless I've made something out of the ordinary (sandwiching, enclosing, wrapping in sound-insulation (which unfortunately usually insulates heat as well), or with systems with ultra-low-airflow.

    ReplyDelete