Thursday, June 23, 2011

Batch File to Create Virtual Disk Drive

Here is the small batch file that lets you create virtual disk drive. This drive doesn't really exist on your computer, it's something like a shortcut to the certain folder on your computer's HDD. The script will look like this:
net use X: \\komp\updat pass /user:user /persistent:yes >Nul 2<&1
set dir=T:\home
set od=X:\
del /Q /F %dir%\*.*
PING 1.1.1.1 -n 1 -w 2000 2>NUL | FIND "TTL=" >NUL
copy /Y %od%\*.* %dir%
As far as you can see, first of all we check for existence of a virtual drive with the physical letter. If this drive doesn't exist, we create it. Finally we copy some files on it.

No comments:

Post a Comment

Translate