最近对操作系统挺有兴趣的,实验了一下!准备找一个虚拟机,之前在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. 利用FbinstTool+大白菜u盘工具,制作多系统启动U盘【转】

    一般制作多系统启动盘的教程都会要用到rub4dos+grubinst+ultraiso+msgdiyerl等等工具,一大串的工具列表让人望而生畏.其实大白菜里已经对这些工具做了非常好的封装,利用大白菜 ...

  2. MSP430 中断优先级

    MSP430的中断优先级.打开关闭.中断嵌套 优先级顺序从高到低为:    PORT2_VECTOR (1 * 2u) /* 0xFFE2 Port 2 */    PORT1_VECTOR (4 * ...

  3. java IO和NIO的场景选择

    就使用上来说,传统的面向流的IO更简单,而面向缓冲(块)的NIO更复杂,因为可调整空间大,接口的概念性也更加低层(原生)些. 下面说说使用场景: IO的场景: 1.文件可能很多,但是size并不是那么 ...

  4. 深入理解C#第二版笔记

    基础知识 委托 如果代码想要执行操作,但不知道操作细节,一般可以使用委托.例如:Thread类之所以知道要在一个新线程里运行什么,唯一的原因就是在启动新线程时,向它提供了一个ThreadStart委托 ...

  5. UVA 195 Anagram

    题意:求输入字符串的所有组合,按字典序输出! 解法:使用枚举(枚举前先找出最字符串的最小字典序)枚举时加上枚举生成条件! #include <iostream> #include < ...

  6. Hadoop分布式文件系统HDFS详解

    Hadoop分布式文件系统即Hadoop Distributed FileSystem.        当数据集的大小超过一台独立的物理计算机的存储能力时,就有必要对它进行分区(Partition)并 ...

  7. JavaScript 随机数函数

    Math.random()*(m-n)+n random函数语法 Math.random();   random函数返回值 返回0和1之间的伪随机数,可能为0,但总是小于1,[0,1) 返回10-20 ...

  8. uva 10626 - Buying Coke(记忆化搜索)

    题目链接:10626 - Buying Coke 题目大意:给出要买可乐的数量, 以及1元,5元和10元硬币的数量, 每瓶可乐8元,每次照钱会按照最少硬币的方式找回, 问如何投币可使得投入的硬币数最少 ...

  9. 学习 Netty 3.x

    study link: http://netty.io/3.6/guide/#architecture 应用场景: Chat server that requires persistent conne ...

  10. android ViewFlipper的使用

    有个android.widget.ViewAnimator类继承至FrameLayout,ViewAnimator类的作用是为FrameLayout里面的View切换提供动画效果.该类有如下几个和动画 ...