“VM6辅助启动.bat”生成器.hta

该工具为VMware6的辅助启动批处理生成器,可通过GUI设置路径并生成用于控制VMware6启动与关闭的批处理文件。支持直接输入路径及创建桌面快捷方式。

“VM6辅助启动.bat”是一个在需要使用VMware6时打开所有功能,不需要时关闭所有功能(包括其进程)的,帮助人民群众节省系统资源的批处理。
“VM6辅助启动.bat”生成器.hta 是“VM6辅助启动.bat”的GUI生成工具。

Update@20080329:新增“可以直接在文框输入路径”。

< html >
< head >
< title > “VM6辅助启动.bat”生成器 </ title >
< ! -- Author:t0nsha < LiaoDunxia@Gmail.com > ,Update@ 20080329 -->
< style >
body{
background
- color:#cccccc;
font
- size:16px;
}
</ style >

< HTA:APPLICATION
ID
= " “VM6辅助启动.bat”生成器 "
APPLICATIONNAME
= " “VM6辅助启动.bat”生成器 "
SCROLL
= " no "
SINGLEINSTANCE
= " yes "
WINDOWSTATE
= " normal "
ShowInTaskBar
= " yes "
MaximizeButton
= " no "
MinimizeButton
= " no "
SCROLL
= " no "
NAVIGABLE
= " yes "
BORDER
= " thin "
ICON
= " %SystemRoot%/system32/mobsync.exe "
>
</ head >

< SCRIPTLanguage = " VBScript " >

window.resizeTo
640 , 480
ileft
= (window.screen.width - 640 ) / 2
itop
= (window.screen.height - 480 ) / 2
window.moveToileft,itop

On Error Resume Next
Dim strBat()
nLines
= 51
ReDim strBat(nLines)
strBat(
0 ) = " @echooff "
strBat(
1 ) = " color17 "
strBat(
2 ) = " titleVM6辅助启动.bat "
strBat(
3 ) = " remAuthor:t0nsha<LiaoDunxia@Gmail.com>,Update@20080329 "
strBat(
4 ) = " modeconcols=66lines=8 "
strBat(
5 ) = " :menu "
strBat(
6 ) = " cls&setop= " & Chr ( 34 ) & Chr ( 34 )
strBat(
7 ) = " set/pop=输入1回车启动VM,2停止,q退出此脚本(注意:使用时请先将此脚本置于VMware.exe所在的目录;停止会终止VMware.exe进程,请先保存好数据): "
strBat(
8 ) = " if%op%==1( "
strBat(
9 ) = " gotostart "
strBat(
10 ) = " )elseif%op%==2( "
strBat(
11 ) = " gotostop "
strBat(
12 ) = " )elseif " & Chr ( 34 ) & " %op% " & Chr ( 34 ) & " == " & Chr ( 34 ) & " q " & Chr ( 34 ) & " ( "
strBat(
13 ) = " exit "
strBat(
14 ) = " )else( "
strBat(
15 ) = " gotomenu "
strBat(
16 ) = " ) "
strBat(
17 ) = " :start "
strBat(
18 ) = " setstarttype=auto "
strBat(
19 ) = " setstartnow=Start "
strBat(
20 ) = " setstartVMnetAdapter=Enable "
strBat(
21 ) = " gotoExec "
strBat(
22 ) = " :stop "
strBat(
23 ) = " setstarttype=demand "
strBat(
24 ) = " setstartnow=Stop "
strBat(
25 ) = " setstartVMnetAdapter=Disable "
strBat(
26 ) = " gotoExec "
strBat(
27 ) = " :Exec "
strBat(
28 ) = " echo(1/3)%startnow%ingservices... "
strBat(
29 ) = " (scconfigufad-ws60start=demand "
strBat(
30 ) = " netstop " & "" & Chr ( 34 ) & " VMwareAgentService " & Chr ( 34 )
strBat(
31 ) = " scconfigVMAuthdServicestart=%starttype% "
strBat(
32 ) = " net%startnow% " & Chr ( 34 ) & " VMwareAuthorizationService " & Chr ( 34 )
strBat(
33 ) = " scconfigVMnetDHCPstart=%starttype% "
strBat(
34 ) = " net%startnow% " & Chr ( 34 ) & " VMwareDHCPService " & Chr ( 34 )
strBat(
35 ) = " scconfig " & Chr ( 34 ) & " VMwareNATService " & Chr ( 34 ) & " start=%starttype% "
strBat(
36 ) = " net%startnow% " & Chr ( 34 ) & " VMwareNATService " & Chr ( 34 )
strBat(
37 ) = " scconfigvmount2start=%starttype% "
strBat(
38 ) = " net%startnow% " & Chr ( 34 ) & " VMwareVirtualMountManagerExtended " & Chr ( 34 )
strBat(
39 ) = " )>nul2>nul "
strBat(
40 ) = " echo(2/3)%startVMnetAdapter%ingVMnetAdapters... "
strBat(
41 ) = " devcon%startVMnetAdapter%*VMnetAdapter*>nul2>nul "
strBat(
42 ) = " if " & Chr ( 34 ) & " %startnow% " & Chr ( 34 ) & " == " & Chr ( 34 ) & " Start " & Chr ( 34 ) & " ( "
strBat(
43 ) = " echo^(3/3^)StartingProcesses... "
strBat(
44 ) = " starthqtray.exe&startvmware.exe "
strBat(
45 ) = " )else( "
strBat(
46 ) = " echo^(3/3^)KillingProcesses... "
strBat(
47 ) = " TASKKILL/F/IMhqtray.exe>nul2>nul "
strBat(
48 ) = " TASKKILL/F/FI " & Chr ( 34 ) & " IMAGENAMEeqvm* " & Chr ( 34 ) & " >nul2>nul "
strBat(
49 ) = " ) "
strBat(
50 ) = " echo:)DONEANDQUIT!&ping127.1>nul "

Function SplitVMPath
' Cutout"vmware.exe"fromtheVMPath
for i = 1 to Len (T_VMPATH.value)
j
= right (T_VMPATH.value,i)
if mid (j, 1 , 1 ) = " / " then
j
= mid (T_VMPATH.value, 1 , Len (T_VMPATH.value) - i + 1 )
SplitVMPath
= j
exit Function
end if
next
SplitVMPath
= T_VMPATH.value
EndFunction

Function IsVMwareDotExe
' SearchFor"vmware.exe"
Set objFSO = CreateObject ( " Scripting.FileSystemObject " )
If SplitVMPath = T_VMPATH.value Then
IsVMwareDotExe
= False
Exit Function
Else
Set f = objFSO.GetFolder(SplitVMPath)
End If
Set fc = f.Files
For Each f1infc
If " vmware.exe " = f1.name Then
IsVMwareDotExe
= True
Exit Function
End If
Next
IsVMwareDotExe
= False
EndFunction

Function VMPathFind
' DisplaysomethingdependonVMPath
If T_VMPATH.value = "" Then
S_VM.InnerHTML
= " <center><fontcolor=#ff0000>vmware.exe未找到!</font><center> "
TA_STRBAT.value
= ""
VMPathFind
= False
ElseIf Not IsVMwareDotExe Then
S_VM.InnerHTML
= " <center><fontcolor=#0000ff>想骗我? " & SplitVMPath & " 目录下哪有vmware.exe!</font><center> "
TA_STRBAT.value
= ""
VMPathFind
= False
Else
S_VM.InnerHTML
= " <center><fontcolor=#00ff00>vmware.exe已找到!</font><center> "
temp
= strBat( 0 )
For i = 1 to nLines
temp
= temp & vbCrLf & strBat(i)
Next
TA_STRBAT.value
= temp
VMPathFind
= True
End If
EndFunction

Sub GetVMPath
' GettheVMPathbybrowse
Set objDialog = CreateObject ( " UserAccounts.CommonDialog " )
objDialog.Filter
= " vmware.exe|vmware.exe " ' 设定显示的文件格式
set WshShell = CreateObject ( " WScript.Shell " )
strPrograms
= WshShell.SpecialFolders( " Programs " )
objDialog.InitialDir
= strPrograms & " /VMware/VMwareWorkstation/ " ' 设定打开时初始的目录
intResult = objDialog.Showopen ' 执行打开命令
T_VMPATH.value = objDialog.FileName ' 返回选中的文件路径
If Not VMPathFind Then Exit Sub
EndSub

Sub WriteToBat
' WritearrayofstrBatto"VM6辅助启动.bat"
If Not VMPathFind Then Exit Sub
Set objFSO = CreateObject ( " Scripting.FileSystemObject " )
Set objFile = objFSO.CreateTextFile( " VM6辅助启动.bat " , true )
For i = 0 to nLines - 1
objFile.WriteLine(strBat(i))
Next
objFile.Close
Set objFSO = Nothing
If C_SHORTCUT.checked Then
' setWshShell=WScript.CreateObject("WScript.Shell")ERR
set WshShell = CreateObject ( " WScript.Shell " )
strDesktop
= WshShell.SpecialFolders( " Desktop " )
set oShellLink = WshShell.CreateShortcut(strDesktop & " /VM6辅助启动.lnk " )
oShellLink.TargetPath
= SplitVMPath & " VM6辅助启动.bat "
oShellLink.WindowStyle
= 1
oShellLink.Hotkey
= " CTRL+SHIFT+V "
oShellLink.IconLocation
= T_VMPATH.value
oShellLink.Description
= " 欢迎访问我的博客:http://blog.youkuaiyun.com/t0nsha/ "
oShellLink.WorkingDirectory
= SplitVMPath
oShellLink.Save
End If
S_VM.InnerHTML
= " <center><fontcolor=#00ff00>“VM6辅助启动.bat”已生成,谢谢使用!</font><center> "
EndSub

</ SCRIPT >

< bodyOnLoad = " VMPathFind " >
< h5align = " center " > “VM6辅助启动.bat”生成器 </ h5 >
定位vmware.exe:
< inputtype = " text " name = " T_VMPATH " size = " 52 " OnChange = " VMPathFind " >
< inputtype = " button " value = " 浏览(B) " onclick = " GetVMPath " accesskey = B >
< br />
< textareaname = " TA_STRBAT " rows = " 18 " cols = " 80 " ></ textarea >
< br />
< inputtype = " checkbox " name = " C_SHORTCUT " value = " 1 " checkedaccesskey = D > 添加桌面快捷方式(D)
< inputtype = " button " value = " 生成“VM6辅助启动.bat”(C) " onClick = " WriteToBat " accesskey = C >
< inputtype = " button " value = " 退出(Alt+Q) " onClick = " self.close() " accesskey = Q >
< spanid = S_VM >< center ></ center ></ span >
< palign = " center " >& copy; < ahref = " http://blog.youkuaiyun.com/t0nsha/ " target = " blank " > t0nsha </ ahref >
</ p >
</ body >
</ html >

图:

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值