My system: Windows 11 64 bit with all updates to date.
I have a VHD on my hard drive. If i go into Disk Management
i can click Action > Attach > Select File and i see a mapped drive.
I now turn to a cmd prompt and run the following:
diskpart
{Press enter} and type
select vdisk file="C:\Virtual Drives\MyVhd.vhdx"
this too does the same thing but using a cmd prompt.
I am attempting to attach this drive at startup (so will eventually create a Scheduled Task
) but if i execute the command in one row
diskpart select vdisk file="C:\Virtual Drives\MyVhd.vhdx"
under the directory c:\Windows\System32 or c:\Windows\System from a cmd prompt it doesnt map/attach the drive.
I looked at https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/diskpart but it doesnt clarify how i can move the command line to DiskPart
or how i can run it from the command line?
diskpart /s scriptname.txt
learn.microsoft.com/en-us/windows-server/administration/…