世界第一等-----无须安装WSH而执行VBS

发表于:2007-05-25来源:作者:点击数: 标签:界第一等-----无须WSH
世界第一等-----无须安装WSH而执行 VB S 作者:李均宇 2002.12.23 EMAIL:E271828@163.NET 为了用代码创建快捷方式,可以用API,不过这实在太繁了.有无一种更方便的方式呢?我在浏览WIN98的系统文件夹时,在C:\ WINDOWS \SAMPLE下找到了SHORTCUT.VBS,这个文件果然
                         世界第一等-----无须安装WSH而执行VBS
 
                                   作者:李均宇  2002.12.23  EMAIL:E271828@163.NET
 

     为了用代码创建快捷方式,可以用API,不过这实在太繁了.有无一种更方便的方式呢?我在浏览WIN98的系统文件夹时,在C:\WINDOWS\SAMPLE下找到了SHORTCUT.VBS,这个文件果然实现了这个功能.但是这个VBS要先装上WSH才能运行,而且更怪的事是若果再装上超级解霸2000,那么会把VBS文件和WSH的关联丢失,造成VBS无法运行.如果在程序中想运行VBS,就成了不那么顺利的事了.我查找了接近一百张光碟,结果发现介绍WSH的资料少之又少.
     为此我用了我以前自已开发的"影子目录及其浏览器"来辅助了.我先在未装WSH之前用"影子目录及其浏览器"来生成一个A文件,然后装上WSH,再用"影子目录及其浏览器"来生成一个B文件,然后比较这两个文件的不同,发现了多出几个分布在不同文件夹下的如下几个文件:Cscript.exe,Scrrun.dll,Wscript.exe,Wsh.inf,Wshext.dll,Wshom.ocx,Wshtcp.vxd
我把它们COPY到同一个"D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\"文件夹下.为此我又作了一个REG.BAT如下:@echo off
c:\windows\system\regsvr32.exe  /s  D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\Wshom.ocx
c:\windows\system\regsvr32.exe  /s  D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\Wshext.dll
c:\windows\system\regsvr32.exe  /s  D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\Wshtcp.vxd
c:\windows\system\regsvr32.exe  /s  D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\Scrrun.dll
    在装WSH之前和之后我都生成一个REG文件,分别是NO_WSH.REG和YES_WSH.REG,于是我又用了一个我以前自已开发的"注册表分析器"来辅助了.我把前后两次的REG分别输入"注册表分析器",发现多出下面这些注册表项,于是我把它作成一个WIN98OK.REG文件如下:
REGEDIT4
 
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup\OptionalComponents\WSH]
"Installed"="1"
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
"{60254CA5-953B-11CF-8C96-00AA00B8708C}"="Windows Scripting Host 的外壳扩展"
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Scripting Host\Settings]
"DisplayLogo"="1"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{EE09B103-97E0-11CF-978F-00A02463E06F}\InprocServer32]
@="C:\\WINDOWS\\SYSTEM\\scrrun.dll"
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{EE09B103-97E0-11CF-978F-00A02463E06F}\Implemented Categories\{7DD95801-9882-11CF-9FA9-00AA006C42C4}]
@=""
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{0D43FE01-F093-11CF-8940-00A0C9054228}]
@="Filesystem object"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{0D43FE01-F093-11CF-8940-00A0C9054228}\InprocServer32]
@="C:\\WINDOWS\\SYSTEM\\scrrun.dll"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}]
@="Windows Scripting Host 的外壳对象"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}\InProcServer32]
@="C:\\WINDOWS\\SYSTEM\\wshom.ocx"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}]
@="Windows Scripting Host 网络对象"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}\InProcServer32]
@="C:\\WINDOWS\\SYSTEM\\wshom.ocx"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{60254CA5-953B-11CF-8C96-00AA00B8708C}]
@="Windows Scripting Host 的外壳扩展"
[HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID\{60254CA5-953B-11CF-8C96-00AA00B8708C}\InProcServer32]
@="C:\\WINDOWS\\SYSTEM\\wshext.dll"
[HKEY_LOCAL_MACHINE\Software\CLASSES\TypeLib\{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}\1.0]
@="Microsoft Windows Scripting Host 对象型号 (V1.0)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\TypeLib\{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}\1.0\0\win32]
@="C:\\WINDOWS\\SYSTEM\\wshom.ocx"
[HKEY_LOCAL_MACHINE\Software\CLASSES\TypeLib\{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}\1.0\HELPDIR]
@="C:\\WINDOWS\\HELP"
[HKEY_LOCAL_MACHINE\Software\CLASSES\TypeLib\{420B2830-E718-11CF-893D-00A0C9054228}\1.0\0\win32]
@="C:\\WINDOWS\\SYSTEM\\scrrun.dll"
[HKEY_LOCAL_MACHINE\Software\CLASSES\TypeLib\{420B2830-E718-11CF-893D-00A0C9054228}\1.0\HELPDIR]
@="C:\\WINDOWS\\SYSTEM"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WScript.Shell]
@="Windows Scripting Host 的外壳对象"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WScript.Shell.1]
@="Windows Scripting Host 的外壳对象"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WScript.Shell.1\CurVer]
@="WScript.Shell.1"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WScript.Network]
@="Windows Scripting Host 网络对象"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WScript.Network.1]
@="Windows Scripting Host 网络对象"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WScript.Network.1\CurVer]
@="WScript.Network.1"
[HKEY_LOCAL_MACHINE\Software\CLASSES\Scripting.FileSystemObject]
@="Scripting.FileSystemObject"
[HKEY_LOCAL_MACHINE\Software\CLASSES\.js]
@="JSFile"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile]
@="JScript 脚本文件"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\DefaultIcon]
@="C:\\WINDOWS\\WScript.exe,3"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\ScriptEngine]
@="JScript"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\Shell\Open]
@="打开(&O)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\Shell\Open\Command]
@="C:\\WINDOWS\\WScript.exe \"%1\" %*"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\Shell\Open2]
@="以 MS-DOS 提示打开(&W)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\Shell\Open2\Command]
@="C:\\WINDOWS\\COMMAND\\CScript.exe \"%1\" %*"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\Shell\Edit]
@="编辑(&E)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\Shell\Edit\Command]
@="C:\\WINDOWS\\Notepad.exe %1"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\Shell\Print]
@="打印(&P)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\Shell\Print\Command]
@="C:\\WINDOWS\\Notepad.exe /p %1"
[HKEY_LOCAL_MACHINE\Software\CLASSES\jsfile\ShellEx\PropertySheetHandlers\WSHProps]
@="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
[HKEY_LOCAL_MACHINE\Software\CLASSES\.vbs]
@="VBSFile"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile]
@="VBScript 脚本文件"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\shell\open]
@="打开(&O)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\shell\open\command]
@="C:\\WINDOWS\\WScript.exe \"%1\" %*"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\shell\Open2]
@="以 MS-DOS 提示打开(&W)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\shell\Open2\Command]
@="C:\\WINDOWS\\COMMAND\\CScript.exe \"%1\" %*"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\shell\Edit]
@="编辑(&E)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\shell\Edit\Command]
@="C:\\WINDOWS\\Notepad.exe %1"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\shell\Print]
@="打印(&P)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\shell\Print\Command]
@="C:\\WINDOWS\\Notepad.exe /p %1"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\DefaultIcon]
@="C:\\WINDOWS\\WScript.exe,2"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\ScriptEngine]
@="VBScript"
[HKEY_LOCAL_MACHINE\Software\CLASSES\vbsfile\ShellEx\PropertySheetHandlers\WSHProps]
@="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
[HKEY_LOCAL_MACHINE\Software\CLASSES\.WSH]
@="WSHFile"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WSHFile]
@="Windows Scripting Host 设置文件"
"IsShortcut"="Yes"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WSHFile\DefaultIcon]
@="C:\\WINDOWS\\WScript.exe,1"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WSHFile\Shell\Open]
@="打开(&O)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WSHFile\Shell\Open\Command]
@="C:\\WINDOWS\\WScript.exe \"%1\" %*"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WSHFile\Shell\Open2]
@="以 MS-DOS 提示打开(&W)"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WSHFile\Shell\Open2\Command]
@="C:\\WINDOWS\\COMMAND\\CScript.exe \"%1\" %*"
[HKEY_LOCAL_MACHINE\Software\CLASSES\WSHFile\ShellEx\PropertySheetHandlers\WSHProps]
@="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\9]
  00,00,00,00,00,00,c8,46,00,00,00,00,00,00,b6,28,f7,bf,07,00,00,00,00,77,7e,\
"ViewView2"=hex:1c,00,00,00,04,00,00,00,00,00,09,00,00,00,30,00,00,00,00,00,01,\
[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\StreamMRU]
"MRUListEx"=hex:09,00,00,00,5d,00,00,00,0a,00,00,00,86,00,00,00,4e,00,00,00,10,\
  00,00,00,64,00,00,00,b3,00,00,00,67,00,00,00,c2,00,00,00,b1,00,00,00,60,00,\
  00,00,12,00,00,00,2f,00,00,00,4d,00,00,00,22,00,00,00,5c,00,00,00,83,00,00,\
  00,37,00,00,00,7d,00,00,00,6c,00,00,00,62,00,00,00,5b,00,00,00,7f,00,00,00,\
  25,00,00,00,73,00,00,00,a5,00,00,00,b0,00,00,00,3f,00,00,00,79,00,00,00,50,\
  00,00,00,b2,00,00,00,53,00,00,00,5a,00,00,00,57,00,00,00,58,00,00,00,61,00,\
  00,00,c1,00,00,00,47,00,00,00,51,00,00,00,40,00,00,00,28,00,00,00,21,00,00,\
  00,26,00,00,00,43,00,00,00,0f,00,00,00,23,00,00,00,24,00,00,00,00,00,00,00,\
  44,00,00,00,88,00,00,00,97,00,00,00,30,00,00,00,13,00,00,00,0c,00,00,00,27,\
  00,00,00,4b,00,00,00,9c,00,00,00,1e,00,00,00,2a,00,00,00,07,00,00,00,b9,00,\
  00,00,46,00,00,00,31,00,00,00,a4,00,00,00,33,00,00,00,35,00,00,00,29,00,00,\
  00,48,00,00,00,38,00,00,00,3a,00,00,00,3d,00,00,00,49,00,00,00,2e,00,00,00,\
  b6,00,00,00,3c,00,00,00,78,00,00,00,2b,00,00,00,59,00,00,00,3b,00,00,00,ba,\
  00,00,00,2c,00,00,00,9b,00,00,00,5e,00,00,00,6b,00,00,00,6a,00,00,00,69,00,\
  00,00,68,00,00,00,93,00,00,00,20,00,00,00,98,00,00,00,15,00,00,00,1c,00,00,\
  00,bb,00,00,00,16,00,00,00,4c,00,00,00,39,00,00,00,02,00,00,00,41,00,00,00,\
  0b,00,00,00,5f,00,00,00,0d,00,00,00,04,00,00,00,01,00,00,00,c0,00,00,00,c7,\
  00,00,00,c5,00,00,00,ae,00,00,00,1f,00,00,00,03,00,00,00,b4,00,00,00,3e,00,\
  00,00,b7,00,00,00,be,00,00,00,c3,00,00,00,bc,00,00,00,b5,00,00,00,b8,00,00,\
  00,a9,00,00,00,55,00,00,00,36,00,00,00,11,00,00,00,54,00,00,00,66,00,00,00,\
  ac,00,00,00,9e,00,00,00,bf,00,00,00,81,00,00,00,87,00,00,00,9d,00,00,00,32,\
  00,00,00,c4,00,00,00,8a,00,00,00,17,00,00,00,52,00,00,00,ab,00,00,00,45,00,\
  00,00,34,00,00,00,7e,00,00,00,ad,00,00,00,a2,00,00,00,af,00,00,00,76,00,00,\
  00,6f,00,00,00,a6,00,00,00,7c,00,00,00,a7,00,00,00,aa,00,00,00,7b,00,00,00,\
  8e,00,00,00,a8,00,00,00,8b,00,00,00,8c,00,00,00,9f,00,00,00,a3,00,00,00,a1,\
  00,00,00,a0,00,00,00,91,00,00,00,8d,00,00,00,71,00,00,00,08,00,00,00,14,00,\
[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs]
"MRUList"="jdmgnkecabolihf"
"j"=hex:79,65,73,5f,57,53,48,2e,72,65,67,00,1f,00,30,00,00,00,00,00,00,00,00,\
  00,00,00,79,65,73,5f,57,53,48,2e,72,65,67,2e,6c,6e,6b,00,00,00,00
    为了测试是否正确,我把C:\WINDOWS\SAMPLE\SHORTCUT.VBS复制到D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\,然后作一个TEST.BAT:
@echo off
start  regedit /s   D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\win98Ok.reg
start  D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\REG.BAT
start D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\cscript.exe   D:\重装系统省时省电省钱!!!\开始菜单和发送到\WSH\shortcut.vbs
   我先删除WSH,使VBS不再双击能打开,然后我双击TEST.BAT,结果真的能运行VBS!这令我大喜.我查了约一百张光碟而未果现被我用自已的作品能解决了.以后可以在程序中用代码隋意调用,真爽呀.一瞬间,我感觉到自已就象中了六合彩一样,即兴听一首<<世界第一等>>的歌也许最好了.

原文转自:http://www.ltesting.net