也许是好东西——Windows Script Host-3[获取硬盘分区信息]

window|硬盘

'************************************************
' File:    GetDriveX.vbs (WSH sample in VBScript)
' Author:  (c) G. Born
'
' Showing the properties of a drive by using
' FileSystemObject
'************************************************
Option Explicit

' Drive type constants
Const Unknown = 0
Const Removable = 1  ' Removable medium
Const Fixed = 2      ' Fixed medium (hard disk)
Const Remote = 3     ' Network drive
Const CDROM = 4      ' CD-ROM
Const RAMDisk = 5    ' RAM disk

Dim Text, Title, drive
Dim fso, oDrive                 ' Object variable

Dim drtype(6)
drtype(0) = " Unknown "
drtype(1) = " Removable "
drtype(2) = " Fixed "
drtype(3) = " Remote "
drtype(4) = " CDROM "
drtype(5) = " RAMDisk "

Text = "Drive" & vbCrLf & vbCrLf
Title = "WSH sample - by G. Born"

drive = ""
Do                      ' Query drive letter.
    drive = InputBox("Drive letter (e.g. A)", "Drive", "C")

    If drive = "" Then  ' Test for Cancel button.
        WScript.Quit
    End If

    drive = Left(drive, 1)  ' Extract drive letter.
    
    ' Valid drive name (between A and Z)?
    If Asc(UCase(drive)) < Asc("A") Or _
       Asc(UCase(drive)) > Asc("Z") Then
        MsgBox "Drive " & drive & " is illegal"
        drive = ""
    End If
Loop Until drive <> ""

' Create FileSystemObject object to access the file system.
Set fso = WScript.CreateObject("Scripting.FileSystemObject")

' Check whether drive exists.
If (Not fso.DriveExists(drive)) Then
    WScript.Echo "The drive " & drive & " doesn't exist"
    WScript.Quit
End If

Set oDrive = fso.GetDrive(drive)    ' Get Drive object.

If (oDrive.IsReady) Then
    Text = Text & UCase(drive) & " - " & oDrive.VolumeName & vbCrLf
    Text = Text & "Drive type: " & drtype(oDrive.DriveType) & vbCrLf
    Text = Text & "File system: " & oDrive.FileSystem & vbCrLf
    Text = Text + "Capacity: " & _
        FormatNumber(oDrive.TotalSize/(1024*1024), 0) & _
        " MB" & vbCrLf
    Text = Text & "Free: " & FormatNumber(oDrive.FreeSpace/1024, 0) _
           & " KB" & vbCrLf
Else
    Text = Text & "Drive not ready" & vbCrLf
End If

MsgBox Text, vbOKOnly + vbInformation, Title

'*** End

时间: 2024-10-28 17:46:38

也许是好东西——Windows Script Host-3[获取硬盘分区信息]的相关文章

也许是好东西——Windows Script Host-5[关机/For win9x]

window '************************************************' File:    RunExit.vbs (WSH sample in VBScript) ' Author:  (c) G. Born'' Using the Run method to call the Windows 95/98' ExitWindows API function'************************************************

也许是好东西——Windows Script Host-2[浏览文件夹]

window '************************************************' File:    Dialog.vbs (WSH sample in VBScript) ' Author:  (c) G. Born'' Using the shell dialog box to select a folder'************************************************Option Explicit ' Flags for

也许是好东西——Windows Script Host-4[获取当前目录]

window '*************************************************' File:   CurrentDir.vbs (WSH sample in VBScript) ' Autor:  (c) G. Born '' Retrieving the current directory'*************************************************Option Explicit WScript.Echo "Script

也许是好东西——Windows Script Host-7[Format]

window '-------------------好象在我机器上没成功----------------- '**************************************************' File:    Format.vbs (WSH sample in VBScript) ' Author:  (c) G. Born'' Invoking the Format dialog box for a floppy disk'***********************

也许是好东西——Windows Script Host-1[获取网络识别信息]

window|网络 //************************************************// File:    Network.js (WSH sample in JScript) // Author:  (c) G. Born//// Showing the user name, domain name, and // workgroup name//************************************************ var Tex

大话Windows Script Host编程

window|编程 1.引言 WSH的全称是Windows Script Host,是一种支持ActiveX(COM)的独立脚本语言.WSH脚本程序本来是为了替代DOS时代的批处理文件而产生的,后来由于WSH的应用很广泛,已经不只是局限于批处理的替代品了.从Windows98开始,操作系统就已经自带了WSH,因此在Windows98或以上的操作系统中,可以不安装任何软件就能直接使用WSH.Microsoft的主页上有最新版的WSH供下载,目前的版本是5.6,有用于Windows9X与Window

VC++如何将Windows Script Host窗口置顶

问题描述 VC++如何将Windows Script Host窗口置顶 vc++里执行cmd命令:slmgr /ato,会弹出激活系统成功与否的窗口,我想让弹出的这个窗口置顶,用GetForegroundWindow()获取最上端窗口,然后用setwindowpos置顶,但还是没有达到置顶的效果.哪位大侠知道如何弄? 解决方案 ::SetWindowPos(m_hWndTopHWND_TOPMOST0000SWP_NOMOVE|SWP_NOSIZE); 解决方案二: 同一个主程序里的两个子窗口都

Windows Script Host终止的解决方法_应用技巧

RG-SA安全客户端出现"由于Windows Script Host终止或崩溃,主机完整性检查失败"的问题.     答:当使用SA安全客户端时出现"由于Windows Script Host终止或崩溃,主机完整性检查失败",请使登陆GSN软件维护区域http://nic.hnu.cn/images/stories/soft/scripchs.rar下载scripchs.rar,进行安装修复.  

Windows Script Host之用vbs实现[浏览文件夹]功能_vbs

'************************************************ ' File:Dialog.vbs (WSH sample in VBScript)  ' Author:(c) G. Born ' ' Using the shell dialog box to select a folder '************************************************ Option Explicit ' Flags for the opt