6:17 PM 9/1/2011@is2120
1. 不出现cmd窗口,运行程序
Set objShell = CreateObject("Wscript.Shell")
strCommand = "win32pad d:\mydoc\log\note.log"Set objExec = objShell.Exec(strCommand)
2. 删除默认共享
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\"& strComputer&"\root\cimv2")
Set colShares = objWMIService.ExecQuery _
("Select * from Win32_Share")
For Each objShare in colShares
If InStr(Right(objShare.Name,1),"$")Then
WScript.Echo "Deleting "& objShare.Name
objShare.Delete
End If
Next
3. runas
Set objSh = CreateObject("Shell.Application")
strCommand = "notepad.exe"
objSh.ShellExecute strCommand,"","","runas",1
4. 关闭显示器
Set objSh = CreateObject("Shell.Application")
strCommand = "nircmd.exe monitor off"
objSh.ShellExecute strCommand,"","","runas",1
Set objShell = CreateObject("Wscript.Shell")
strCommand = "nircmd.exe monitor off"Set objExec = objShell.Exec(strCommand)
本文介绍了几种在Windows环境下进行批量操作的方法,包括隐藏CMD窗口运行程序、删除默认共享、使用runas命令提升权限运行程序以及关闭显示器等。这些技巧对于系统管理员来说非常实用。
319

被折叠的 条评论
为什么被折叠?



