Attach Virtual Hard Disk Automatically At Windows Startup

10. August 2010 18:03

Windows  Comments

Windows 7 gives you the power to create Virtual Hard Disk (VHD). If you don't know how to create a VHD in Windows 7 then you seriously need to learn how to unleash Windows 7 power. You can see the links in the end which will let you create a new VHD on your Windows 7 machine and there are some other recommended links.

I assume that you know or you have created a new VHD and attached or mount on your Windows 7 machine. But this is one time fun.....Once you reboot or logoff the attached VHD is gone. Now you need to follow all those steps again to attach the VHD, not this time but every time you logoff or restart. To get relief from this pain perform the following steps.

Open notepad and add the below command to the file:

Select vdisk file=”D:\SourceSafe.vhd”
Attach vdisk

Now save the file with the name of your choice with “.s” as its extension. Open notepad again and add the following line of code to get your VHD attached at system startup and save this file with file extension as ".bat"

DISKPART –s  "Path of the <.s file> created in the above step"

The path name should be the fully qualified name of the “.s” file. Just in case you face any problem I have attached the files I am using to mount my SourceSafe VHD at system startup. Place the ".bat" in the startup folder and thats it. Next time you logoff or restart you VHD gets attached automatically.

Download: (313.00 bytes)

 Related Links:

 No Rating