virtual pc中添加软盘支持
最近对操作系统挺有兴趣的,实验了一下!准备找一个虚拟机,之前在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中添加软盘支持的更多相关文章
- 在IntelliJ IDEA中添加框架支持时找不到Hibernate的解决办法
问题描述 第一次在Add Frameworks support界面中添加hibernate支持的时候,异常中断,导致没有成功添加. 第二次进入Add Frameworks support窗口时,发现找 ...
- IIS8中添加WCF支持几种方法小结[图文]
方法一 最近在做Silverlight,Windows Phone应用移植到Windows 8平台,在IIS8中测试一些传统WCF服务应用,发现IIS8不支持WCF服务svc请求,后来发现IIS8缺少 ...
- u-boot中添加mtdparts支持以及Linux的分区设置
简介 作者:彭东林 邮箱:pengdonglin137@163.com u-boot版本:u-boot-2015.04 Linux版本:Linux-3.14 硬件平台:tq2440, 内存:64M ...
- 在HEXO主题中添加数学公式支持
在markdown中书写数学符号的方式参考Latex常用数学符号 Mathjax 安装 npm uninstall hexo-renderer-marked --save npm install he ...
- IIS配置svc(IIS8中添加WCF支持几种方法小结)
方法一 最近在做Silverlight,Windows Phone应用移植到Windows 8平台,在IIS8中测试一些传统WCF服务应用,发现IIS8不支持WCF服务svc请求,后来发现IIS8缺少 ...
- 在virtual pc中搭建基于ubuntu 的git环境
1. 在virtual pc 上安装 ubuntu http://www.hanselman.com/blog/InstallingUbuntu104LTSOnWindowsVirtualPCOnWi ...
- bouncycastle中添加HMAC-SM3支持
一. 最近看完了PKCS#5中的内容,总结一下自己添加HMAC-SM3中遇到的问题和解决方法. 大概通读BC java源码以后,开始上手修改. 在SM3.java中添加如下代码: /** * SM3 ...
- cnblog中添加数学公式支持
在博客中使用数学公式,是一件相对麻烦的事儿,大量的截图和插入图片不仅耗费极大的精力,而且影响写作体验. 虽然对于公式显示已经有多种解决办法,但大多数需要安装插件.而MathML这一雄心勃勃的网页数学语 ...
- 如何在Android Studio中添加RecyclerView-v7支持包
1.打开SDK Manager,在Extras树下找到Android Support Library,下载好支持包.RecyclerView在v7-21版本就出来了.我这里不用更新了,说明是最新的,怎 ...
随机推荐
- Swift—扩展声明-备
声明扩展的语法格式如下: extension 类型名 { //添加新功能 } 声明扩展的关键字是extension,“类型名”是Swift中已有的类型,包括类.结构体和枚举,但是我们仍然可以扩展整型. ...
- Android 中如何使用动画
1:首先在res/anim/文件夹下建立动画xml文件. 2:在java代码中对UI控件使用动画. //加载动画 Animation myAnim=AnimationUtils.loadAnimati ...
- Qt自定义带游标的slider,在滑块正上方显示当前值(类似于进度条,用一个额外的QLabel冒充QSilder的一部分,然后move就行了)
首先自定义QSlider的子类MyCustomSlider,如下所示. mycustomslider.h #ifndef MYCUSTOMSLIDER_H #define MYCUSTOMSLIDER ...
- 模糊系统架构和简单实现--AForge.NET框架的使用(四)
原文:模糊系统架构和简单实现--AForge.NET框架的使用(四) 先说一下,为什么题目是简单实现,因为我实在没有弄出好的例子. 我原来用AForge.net做的项目中的模糊系统融入了神经网络和向量 ...
- ASCII、Unicode、GBK和UTF-8字符编码的区别联系[转]
http://dengo.org/archives/901 这是我看过的最好的一篇讲述编码的文章 很久很久以前,有一群人,他们决定用8个可以开合的晶体管来组合成不同的状态,以表示世界上的万物.他们看到 ...
- COJ 0036 数数happy有多少个?
数数happy有多少个? 难度级别:B: 运行时间限制:1000ms: 运行空间限制:51200KB: 代码长度限制:2000000B 试题描述 图图是个爱动脑子.观察能力很强的好学生.近期他正学英语 ...
- HDU_2026——将单词的首字母变大写
Problem Description 输入一个英文句子,将每个单词的第一个字母改成大写字母. Input 输入数据包含多个测试实例,每个测试实例是一个长度不超过100的英文句子,占一行. O ...
- ORA-00314,redolog 损坏,或丢失处理方法
alertsid.log报错信息: Fri Sep 27 15:18:39 2013 Started redo scan Fri Sep 27 15:18:39 2013 Errors in file ...
- IntelliJ IDEA创建web项目及异常问题解决
IDEA配置Tomcat: 1.下载Tomcat,本次使用的是apache-tomcat-6.0.43 2.IDEA配置Tomcat 在idea中的Settings(Ctrl+Alt+s)(或者点击图 ...
- 解决 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
"Accept-Encoding": "gzip, deflate", 这条信息代表本地可以接收压缩格式的数据,而服务器在处理时就将大文件压缩再发回客户端,IE ...