最近对操作系统挺有兴趣的,实验了一下!准备找一个虚拟机,之前在xp上使用virtual pc感觉不错,准备在本机上装一下,但是发现居然不支持软盘了!

查阅了各种资料,终于找到了解决的办法。

1. 下载脚本 Scripts.zip 在如下地址:http://blogs.msdn.com/b/virtual_pc_guy/archive/2009/10/01/using-floppy-disks-with-windows-virtual-pc.aspx

  也可以自己生成两个脚本文件,代码如下

  FloppyDrive.vbs  

Option Explicit

' Define constants for floppy drive attachment types
CONST vmFloppyDrive_None =
CONST vmFloppyDrive_Image =
CONST vmFloppyDrive_HostDrive = Dim namedArguments, argumentError, vpc, vm, vmName, action, floppy, vmFloppyDrive ' Check that the script is running at the command line.
If UCase(Right(Wscript.FullName, )) = "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() & "Name of virtual machine to be started" & chr()
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 <> Then
WScript.Echo "Unable to connect to Virtual PC."
WScript.Quit
End if
On Error Goto ' Get virtual machine object
Set vm = vpc.FindVirtualMachine(vmName) ' Get the floppy drive
set vmFloppyDrive = vm.FloppyDrives.item() ' 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

  FloppyDrive.ps1

param([string]$vmName, [string]$action, [string]$floppy)

$argumentError = 

# Check for correct command-line arguments
If ($vmName -eq "")
{$argumentError = } If ($action -eq "")
{$argumentError = } If ($floppy -eq "")
{
if ((!([string]::Compare($action, "vfd", $True))) -or (!([string]::Compare($action, "physical", $True))))
{$argumentError = }
} # Display usage information if wrong arguments are provided
If ($argumentError -eq )
{
write-host "Missing command-line argument."
write-host "USage: FloppyDrive.ps1 -vmName `"Name of virtual machine`""
write-host " -action info - to display information about the current floppy configuration"
write-host " disconnect - to disconnect any attached floppy disk or floppy disk image"
write-host " vfd - to attach a virtual floppy disk image"
write-host " physical - to attach a physical floppy disk"
write-host
write-host " -floppy name - where name is either the full name and path for a virtual"
write-host " floppy disk or the letter of a physical disk to attach"
exit
} # Connect to Virtual PC
$vpc=new-object 朿om VirtualPC.Application 朣trict # Get virtual machine object
$vm = $vpc.FindVirtualMachine($vmName) # Get the floppy drive
$vmFloppyDrive = $vm.FloppyDrives.item() # Perform the specified action
switch ($action)
{ # Display floppy disk information
"info" {
write-host "Floppy disk information"
write-host "=======================" # Different information is needed for each attachment type
switch ($vmFloppyDrive.Attachment)
{
{
write-host "Floppy Attachment : No floppy disk attached"
write-host "Drive Number : " $vmFloppyDrive.DriveNumber}
{
write-host "Floppy Attachment : Floppy disk image attached"
write-host "Drive Number : " $vmFloppyDrive.DriveNumber
write-host "Image File : " $vmFloppyDrive.ImageFile }
{
write-host "Floppy Attachment : Physical floppy disk attached"
write-host "Drive Number : " $vmFloppyDrive.DriveNumber
write-host "Host Drive Letter : " $vmFloppyDrive.HostDriveLetter }
}
} # Disconnect the current floppy disk
"disconnect" { write-host "Disconnecting the floppy disk." # A different method is used to disconnect a floppy disk image than for a physical disk
switch ($vmFloppyDrive.Attachment)
{
{$vmFloppyDrive.ReleaseImage()}
{$vmFloppyDrive.ReleaseHostDrive()}
}
} # Attach a floppy disk image
"vfd" {
write-host "Attaching " $floppy " to the floppy drive."
$vmFloppyDrive.AttachImage($floppy)
} # Attach a physical floppy disk
"physical" {
write-host "Attaching physical disk " $floppy ": to the floppy drive."
$vmFloppyDrive.AttachHostDrive($floppy)
} # Catch invalid actions
default {write-host "Invalid action provided. Info, disconnect, vfd and physical are valid options."}
}

2. 将两个脚本文件放置在同一个目录下

3. 打开命令行,进入存放脚本文件的目录

4. 运行如下的命令:

  cscript FloppyDrive.vbs /vm:"myTestOS" /action:vfd /floppy:"C:\E\work\VirtualPC\helloos.vfd"

  红色字体部分分别是虚拟机的名字,虚拟软盘的文件(必须是vfd后缀,可以吧img文件改为vfd文件)

virtual pc中添加软盘支持的更多相关文章

  1. 在IntelliJ IDEA中添加框架支持时找不到Hibernate的解决办法

    问题描述 第一次在Add Frameworks support界面中添加hibernate支持的时候,异常中断,导致没有成功添加. 第二次进入Add Frameworks support窗口时,发现找 ...

  2. IIS8中添加WCF支持几种方法小结[图文]

    方法一 最近在做Silverlight,Windows Phone应用移植到Windows 8平台,在IIS8中测试一些传统WCF服务应用,发现IIS8不支持WCF服务svc请求,后来发现IIS8缺少 ...

  3. u-boot中添加mtdparts支持以及Linux的分区设置

    简介 作者:彭东林 邮箱:pengdonglin137@163.com u-boot版本:u-boot-2015.04 Linux版本:Linux-3.14 硬件平台:tq2440, 内存:64M   ...

  4. 在HEXO主题中添加数学公式支持

    在markdown中书写数学符号的方式参考Latex常用数学符号 Mathjax 安装 npm uninstall hexo-renderer-marked --save npm install he ...

  5. IIS配置svc(IIS8中添加WCF支持几种方法小结)

    方法一 最近在做Silverlight,Windows Phone应用移植到Windows 8平台,在IIS8中测试一些传统WCF服务应用,发现IIS8不支持WCF服务svc请求,后来发现IIS8缺少 ...

  6. 在virtual pc中搭建基于ubuntu 的git环境

    1. 在virtual pc 上安装 ubuntu http://www.hanselman.com/blog/InstallingUbuntu104LTSOnWindowsVirtualPCOnWi ...

  7. bouncycastle中添加HMAC-SM3支持

    一. 最近看完了PKCS#5中的内容,总结一下自己添加HMAC-SM3中遇到的问题和解决方法. 大概通读BC java源码以后,开始上手修改. 在SM3.java中添加如下代码: /** * SM3 ...

  8. cnblog中添加数学公式支持

    在博客中使用数学公式,是一件相对麻烦的事儿,大量的截图和插入图片不仅耗费极大的精力,而且影响写作体验. 虽然对于公式显示已经有多种解决办法,但大多数需要安装插件.而MathML这一雄心勃勃的网页数学语 ...

  9. 如何在Android Studio中添加RecyclerView-v7支持包

    1.打开SDK Manager,在Extras树下找到Android Support Library,下载好支持包.RecyclerView在v7-21版本就出来了.我这里不用更新了,说明是最新的,怎 ...

随机推荐

  1. hibernate3 无法查询中文问题

    在查询中文时  hql语句在生成的语句中把中文显示为乱码 则在hibernate配置文件中加入: <property name="hibernate.query.factory_cla ...

  2. android popupwindow低版本报空指针

    在项目中使用Popupwindow pop=new Popupwindow();在2.3版本报 异常信息: Exception: null 堆栈信息: android.widget.PopupWind ...

  3. ESSENTIAL ENGLISH SLANG

    airhead: stupid person. ace: excellent, great. Adam and Eve - Rhyming Slang for 'believe'. aggro - s ...

  4. BZOJ 1211 树的计数

    http://www.lydsy.com/JudgeOnline/problem.php?id=1211 思路:每一个prufer编码都代表了一棵树,而点的度数,代表了它在prufer编码中出现的次数 ...

  5. Usage、Usage Minimum和Usage Maximum项目详解

    (1)一个产生多个数据域(Report Count>1)的主项目之前有一个以上的[用途]时,每个[用途]与一个数据域依次对应,如果数据域个数(Report Count)超过[用途]的个数,则剩余 ...

  6. 不建议用wxWidgets,底层有过多的bug

    不建议用wxWidgets, 搞了wxWidgets 3年,不是所说的那么容易跨平台,很多bug,不稳定, 莫名其妙的崩溃找源代码修改编译真是费时费力. 开发速度真没有使用本地sdk开发高, 很难定制 ...

  7. 有意思的数学题:Trapping Rain Water

    LeetCode传送门 https://leetcode.com/problems/trapping-rain-water/ 目标:找出积木能容纳的水的“面积”,如图中黑色部分是积木,蓝色为可容纳水的 ...

  8. 【HDOJ】1224 Free DIY Tour

    DP. #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm ...

  9. vimrc 留备份

    set encoding=UTF-8 "encode with UTF-8"set backspace=2set nusyn onset ai!syntax enablesynta ...

  10. Struts 2零配置

    从struts2.1开始,struts2不再推荐使用Codebehind作为零配置插件,而是改为使用Convention插件来支持零配置,和Codebehind相比,Convention插件更彻底,该 ...