Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BeRo1985/9655e76159bf87b349628a9f64e26455 to your computer and use it in GitHub Desktop.
Save BeRo1985/9655e76159bf87b349628a9f64e26455 to your computer and use it in GitHub Desktop.
How to Automount VHD on windows 10

So here's a pretty neat thing, I use VHD's to organize the space on my computer. You can too!

  • Click Start

  • Type in the search bar "Disk par" =>

  • Click first result =>

  • In the program, click "Action" =>

  • Under action menu, click Create VHD =>

  • Make a new folder in your C: drive called VHD =>

  • now in "C:\VHD", add disk1.vhd

  • now finish setup =>

  • attach vhd

  • Now, in The same folder, create a new file "attach_vhd.txt"

  • in that file, place the following

select vdisk file="C:\VHD\coding.vhd"
attach vdisk
exit
  • save it

  • run the following command in PowerShell

schtasks /create /tn "automountvhd" /tr "diskpart.exe /s 'c:\VHD\attach_vhd.txt'" /sc ONLOGON /ru SYSTEM

and you're done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment