轉貼自香港IT網
對於經常使用ipconfig這個指令的人,
是否覺得老是要在"命令提示字元"下手動輸入是一種麻煩?
以下方法可以將這個程式製作成對話方框,
只要用滑鼠點選就可輕鬆執行你指定的動作喔!
使用方法:用記事本開啟新檔,將以下內容複製上去,另存為*.hta檔後,直接點選就可以執行了
<html>
<head>
<title>The Windows XP IP Configuration Tool </title>
<HTA:APPLICATION
ID = "XApp"
APPLICATIONNAME = "The Windows XP IP Configuration Tool"
BORDER = "thick"
CAPTION = "yes"
ICON = "wxpipc.ico"
SHOWINTASKBAR = "yes"
SINGLEINSTANCE = "yes"
SYSMENU = "yes"
WINDOWSTATE = "normal"
SCROLL = "no"
SCROLLFLAT = "yes"
VERSION = "1.0"
INNERBORDER = "no"
SELECTION = "no"
MAXIMIZEBUTTON = "yes"
MINIMIZEBUTTON = "yes"
NAVIGABLE = "yes"
CONTEXTMENU = "yes"
BORDERSTYLE = "normal">
<OBJECT ID="WindowsShell"
CLASSID="clsid:13709620-C279-11CE-A49E-444553540000">
</Object>
<SCRIPT LANGUAGE="VBScript">
Dim WshShell, FileSystem, CommandLine, ipcswitch, Param
Dim RelAdap, RenAdap, ShoAdap, SetAdap
Set WshShell = CreateObject("WScript.Shell")
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Window.ResizeTo 600, 420
Window.MoveTo 5, 5
Sub ProcessOptions
Set MyForm = Document.dbx
Set RadioButtonDialog = MyForm.Elements("ipcswitch")
For Each RadioButton In RadioButtonDialog
If RadioButton.Checked = True Then
ipcswitch = RadioButton.Value
Exit For
End If
Next
Select Case ipcswitch
Case "/release " Param = MyForm.RelAdap.Value
Case "/renew " Param = MyForm.RenAdap.Value
Case "/showclassid " Param = MyForm.ShoAdap.Value
Case "/setclassid " Param = MyForm.SetAdap.Value
End Select
Call RunCommand
End Sub 'ProcessOptions
Sub RunCommand
CommandLine = "IPConfig " & ipcswitch & Param
Prompter = "This is the IPConfig command that you just configured:" & vbCrlf & vbCrlf &_
"Do you want to execute it?" & vbCrlf & vbCrlf &_
CommandLine
ExecuteIt = MsgBox(Prompter, 1, "The Windows XP IP Configuration Tool")
If ExecuteIt = 1 Then
WshShell.Run "Cmd.exe /t:9F /k " & CommandLine, 1, True
End If
End Sub 'RunCommand
Sub ..
訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容