I. Open [Control Panel] — [Management Tool] — [Task Planning Procedure]

Open the control panel and select Administrative Tools

Select the task scheduler

2. Set tasks

Open the task scheduler, create a task, and set the task name and execution permission.

Set the trigger

4. Set the virtual drive loading script

Virtual disk loading script

@echo off 
echo select vdisk file="C:\vhdx\D.vhdx" > "%tmp%/AutoMntVhd.txt"
echo attach vdisk >> "%tmp%/AutoMntVhd.txt"
diskpart /s "%tmp%/AutoMntVhd.txt"
del /f /q AutoMntVhd.txt
 
@echo off 
echo select vdisk file="C:\vhdx\U.vhdx" > "%tmp%/AutoMntVhd.txt"
echo attach vdisk >> "%tmp%/AutoMntVhd.txt"
diskpart /s "%tmp%/AutoMntVhd.txt"
del /f /q AutoMntVhd.txt
 
exit
Copy the code