热度 16
2015-4-9 10:20
4370 次阅读|
0 个评论
WIN7 x64位的VIRTUAL PC虚拟机增加软驱功能、好用的虚拟软驱软件 wxleasyland@sina.com 2015.4.8 一、方法 WIN7 x64的WINDOWS VIRTUAL PC虚拟机,如果不使用XP MODE那个虚拟机,而是自己创建一个虚拟机,则是全空的系统,而且不支持软驱软盘。以前的XP系统中的虚拟机,可支持软驱,很好用。 微软MSDN给出了增加软驱的办法: http://blogs.msdn.com/b/virtual_pc_guy/archive/2009/10/01/using-floppy-disks-with-windows-virtual-pc.aspx 中文可参考: http://bbs.winos.cn/thread-79742-1-1.html 即windows virtual PC没有提供使用软驱的用户界面,需要用脚本*.vbs来解决。物理软驱、软盘镜像文件*.vfd都可以使用。 二、把程序FloppyDrive.vbs贴如下: Option Explicit ' Define constants for floppy drive attachment types CONST vmFloppyDrive_None = 0 CONST vmFloppyDrive_Image = 1 CONST vmFloppyDrive_HostDrive = 2 Dim namedArguments, argumentError, vpc, vm, vmName, action, floppy, vmFloppyDrive ' Check that the script is running at the command line. If UCase(Right(Wscript.FullName, 11)) = "WSCRIPT.EXE" Then WScript.Echo "This script must be run under CScript." WScript.Quit End If ' Get the virtual machine name / floppy commands from the command-line arguments Set namedArguments = WScript.Arguments.Named argumentError = false If namedArguments.Exists("vm") Then vmName = namedArguments.Item("vm") Else argumentError = true End If If namedArguments.Exists("action") Then action = namedArguments.Item("action") Else argumentError = true End If If namedArguments.Exists("floppy") Then floppy = namedArguments.Item("floppy") Else If (not ((action = "info") or (action = "disconnect"))) Then argumentError = true End If End If ' Display usage information if wrong arguments are provided if argumentError then WScript.Echo "Missing command-line argument" WScript.Echo WScript.Echo "Usage: FloppyDrive.vbs /vm:" chr(34) "Name of virtual machine to be started" chr(34) WScript.Echo WScript.Echo "/action:info - to display information about the current floppy configuration" WScript.Echo " disconnect - to disconnect any attached floppy disk or floppy disk image" WScript.Echo " vfd - to attach a virtual floppy disk image" WScript.Echo " physical - to attach a physical floppy disk" WScript.Echo WScript.Echo "/floppy:name - where name is either the full name and path for a virtual" WScript.Echo " floppy disk or the letter of a physical disk to attach" WScript.Echo WScript.Quit end if ' Attempt to connect to Virtual PC On Error Resume Next Set vpc = CreateObject("VirtualPC.Application") If Err.Number 0 Then WScript.Echo "Unable to connect to Virtual PC." WScript.Quit End if On Error Goto 0 ' Get virtual machine object Set vm = vpc.FindVirtualMachine(vmName) ' Get the floppy drive set vmFloppyDrive = vm.FloppyDrives.item(1) ' Perform the specified action Select Case action ' Display floppy disk information case "info" wscript.echo "Floppy disk information" wscript.echo "=======================" ' Different information is needed for each attachment type select case vmFloppyDrive.Attachment case vmFloppyDrive_None wscript.echo "Floppy Attachment : No floppy disk attached" wscript.echo "Drive Number : " vmFloppyDrive.DriveNumber case vmFloppyDrive_Image wscript.echo "Floppy Attachment : Floppy disk image attached" wscript.echo "Drive Number : " vmFloppyDrive.DriveNumber wscript.echo "Image File : " vmFloppyDrive.ImageFile case vmFloppyDrive_HostDrive wscript.echo "Floppy Attachment : Physical floppy disk attached" wscript.echo "Drive Number : " vmFloppyDrive.DriveNumber wscript.echo "Host Drive Letter : " vmFloppyDrive.HostDriveLetter end select ' Disconnect the current floppy disk case "disconnect" wscript.echo "Disconnecting the floppy disk." ' A different method is used to disconnect a floppy disk image than for a physical disk select case vmFloppyDrive.Attachment case vmFloppyDrive_Image vmFloppyDrive.ReleaseImage case vmFloppyDrive_HostDrive vmFloppyDrive.ReleaseHostDrive end select ' Attach a floppy disk image case "vfd" wscript.echo "Attaching " floppy " to the floppy drive." vmFloppyDrive.AttachImage(floppy) ' Attach a physical floppy disk case "physical" wscript.echo "Attaching physical disk " floppy ": to the floppy drive." vmFloppyDrive.AttachHostDrive(floppy) ' Catch invalid actions case else wscript.echo "Invalid action provided. Info, disconnect, vfd and physical are valid options." end select wscript.echo 三、使用说明 打开“Windows Virtual PC”,在目录中“创建虚拟机”建立一个新的虚拟机,名称比如“DOS”。 在CMD下,运行: 1. 查看当前虚拟机的软驱支持情况: cscript FloppyDrive.vbs /vm:"dos" /action:info 注:"dos"为虚拟机名称 2. 加载软驱,镜像方式:cscript FloppyDrive.vbs /vm:"dos" /action:vfd /floppy:"e:\98dos.vfd" e:\98dos.vfd表示vfd文件的路径。镜像*.vfd可以用winimage创建。 *.img文件不能用,载入失败!! 加载软驱后,虚拟机配置中仍看不到软驱的UI界面。 虚拟机启动后,对软驱的写操作,会记录到这个vfd文件中。 3. 物理软驱没有试。用虚拟软驱,OK,可以。 按物理软驱方式加载:cscript FloppyDrive.vbs /vm:"dos" /action:physical /floppy:a a表示A:,即加载A盘。 4. 卸载虚拟机的软驱:cscript FloppyDrive.vbs /vm:"dos" /action:disconnect 四、批处理 以上可建立一些批处理bat文件,来方便使用: 比如:vfd.bat文件 cscript FloppyDrive.vbs /vm:%1 /action:vfd /floppy:%2 使用时:vfd "dos" "e:\98dos.vfd" 即可 其它: info.bat cscript FloppyDrive.vbs /vm:%1 /action:info physical.bat cscript FloppyDrive.vbs /vm:%1 /action:physical /floppy:%2 disconnect.bat cscript FloppyDrive.vbs /vm:%1 /action:disconnect 五、WIN7 x64位的虚拟软驱软盘的软件 WIN7 x64位下,虚拟软驱可以用ImDisk,免费的,很好用。虚拟机可以很好支持。 http://www.ltr-data.se/opencode.html/#ImDisk 另外也试过VFD软件,但是64位版的驱动未签名,并且使用后,WIN7中有软驱出现,但虚拟机不支持,找不到那个软驱。