最近对操作系统挺有兴趣的,实验了一下!准备找一个虚拟机,之前在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. 自解压的方式创建VC++程序的打包

    Walkthrough: Deploying a Visual C++ Application By Using the Visual C++ Redistributable Package Visu ...

  2. 如何在tomcat启动的时候运行一个Java类

    设置个Listener就好了,在web.xml中指定描述. web.xml其实就是tomcat启动的时候会读取的一个描述文件,比如访问服务器的时候首页等都可以在里面指定,有相应的tag.这里有解释:h ...

  3. 8.2.1.8 IS NULL Optimization NULL 优化:

    8.2.1.8 IS NULL Optimization NULL 优化: Oracle 对待null值: SQL> create table t100(id int,name char(10) ...

  4. BZOJ3315: [Usaco2013 Nov]Pogo-Cow

    3315: [Usaco2013 Nov]Pogo-Cow Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 143  Solved: 79[Submit] ...

  5. MSSQL 标准PROC 写法

    MSSQL 标准PROC 写法 ALTER PROC [dbo].[usp_ADM_InsertFlowSortInfo]@FlowSortName NVARCHAR(50),AS/*PAGE: 分类 ...

  6. nova-network

    nova network-create demo-net --bridge br100 --multi-host T --fixed-range-v4 192.168.3.0/26 192.168.3 ...

  7. Linux内核数据包的发送传输

    本文主要讲解了Linux内核数据包的传输流程,使用的内核的版本是2.6.32.27 为了方便理解,本文采用整体流程图加伪代码的方式从内核高层面上梳理了二层数据包发送传输的流程,希望可以对大家有所帮助. ...

  8. solr安装

    Windows solr(tomcat) 1.1. 安装步骤 1.1.1准备工作 1. 服务器:apache-tomcat-7.0.40压缩版,http://localhost:8080/安装是否成功 ...

  9. 【转】 基于TFTP协议的远程升级设计

    版权声明:本文为博主原创文章,未经博主允许不得转载.联系邮箱:zhzhchang@126.com 说明:由于CSDN博客编辑器对word格式近乎不支持,因此对表格使用了图片方式(最后一个表格未使用图片 ...

  10. 路径问题以及cookie详解

    1.路径问题: 注意 .代表执行程序的文件夹路径,在tomcat中也就是bin目录,所以要用this.getServletContext().getRealPath("/WEB-INF/cl ...