⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 生成Ghost批处理命令
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Ghost参数生成                  yyz985@yahoo.com.cn"
   ClientHeight    =   2625
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   5085
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   2625
   ScaleWidth      =   5085
   StartUpPosition =   3  '窗口缺省
   Begin MSComDlg.CommonDialog ComDlg 
      Left            =   4320
      Top             =   240
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CheckBox Check1 
      Caption         =   "还原后自动重启计算机"
      Height          =   255
      Left            =   2040
      TabIndex        =   12
      Top             =   2160
      Value           =   1  'Checked
      Width           =   2175
   End
   Begin VB.CheckBox Check 
      Caption         =   "有"
      Height          =   255
      Index           =   1
      Left            =   1320
      TabIndex        =   11
      Top             =   2160
      Value           =   1  'Checked
      Width           =   735
   End
   Begin VB.CheckBox Check 
      Caption         =   "有"
      Height          =   255
      Index           =   0
      Left            =   1320
      TabIndex        =   10
      Top             =   1920
      Width           =   615
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   240
      Style           =   2  'Dropdown List
      TabIndex        =   6
      Top             =   1440
      Width           =   1575
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   240
      TabIndex        =   5
      Top             =   840
      Width           =   3615
   End
   Begin VB.TextBox Text2 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2160
      TabIndex        =   4
      Text            =   "1"
      Top             =   240
      Width           =   495
   End
   Begin VB.TextBox Text1 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   390
      Left            =   720
      TabIndex        =   3
      Text            =   "1"
      Top             =   240
      Width           =   495
   End
   Begin VB.CommandButton Command2 
      Caption         =   "生成到D:\BeiFen;HuiFu"
      Height          =   495
      Left            =   3120
      TabIndex        =   1
      Top             =   1560
      Width           =   1815
   End
   Begin VB.CommandButton Command1 
      Caption         =   "浏览"
      Height          =   375
      Left            =   3960
      TabIndex        =   0
      Top             =   840
      Width           =   735
   End
   Begin VB.Label Label4 
      Caption         =   "个分区备份到:"
      Height          =   255
      Left            =   2640
      TabIndex        =   9
      Top             =   360
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "个硬盘的第"
      Height          =   255
      Left            =   1200
      TabIndex        =   8
      Top             =   360
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "确认:备份时           还原时"
      Height          =   375
      Left            =   240
      TabIndex        =   7
      Top             =   2000
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "将第"
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   360
      Width           =   495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
    ComDlg.Filter = "*.gho|*.gho|*.*|*.*"
    ComDlg.Flags = &H100000
    ComDlg.ShowSave
    Text3 = ComDlg.FileName
End Sub

Private Sub Command2_Click()
On Error GoTo NotExist
    Dim fso As Object, f As Object, sAppPath As String, outName As String, drv As String * 2, lFreeSpc As Integer
    Set fso = CreateObject("Scripting.FileSystemObject")
    outName = fso.GetParentFolderName(Text3)
    Set f = fso.GetFolder(outName)
    outName = f.shortpath & Mid(Text3, Len(f) + 1)
    Set f = fso.GetFolder(App.Path)
    sAppPath = f.shortpath
    drv = f.Drive
    Set f = fso.GetDrive(drv)
    lFreeSpc = f.FreeSpace / 1024 / 1024
    Dim Yasuo As String, isSure(1) As String, i As Integer
    If Combo1.ListIndex = 0 Then Yasuo = ""
    If Combo1.ListIndex = 1 Then Yasuo = " -z1"
    If Combo1.ListIndex = 2 Then Yasuo = " -z9"
    For i = 0 To 1
        If Check(i).Value = 1 Then isSure(i) = " -sure" Else isSure(i) = ""
    Next i
   Open "D:\BeiFen.bat" For Output As #1
        Print #1, sAppPath & "\Ghost.exe -clone,mode=pdump,src=" & Text1.Text & ":" & _
            Text2.Text & ",dst=" & outName & Yasuo & isSure(0)
    Close #1
    Open "D:\HuiFu.bat" For Output As #1
        Print #1, sAppPath & "\Ghost.exe -clone,mode=pload,src=" & outName & ",dst=" & Text1.Text & ":" & _
            Text2.Text & isSure(1) & " -rb"
    Close #1
    MsgBox drv & "盘可用空间:" & lFreeSpc & "MB" & vbCrLf & "到Dos下输入" & vbCrLf & "D:\Beifen即可备份" & vbCrLf & "D:\Huifu即可恢复"
    Exit Sub
NotExist:
    MsgBox "请确认输入的文件名正确"
End Sub

Private Sub Form_Load()
    Combo1.AddItem "不压缩"
    Combo1.AddItem "普通压缩"
    Combo1.AddItem "最大压缩"
    Combo1.ListIndex = 2

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -