联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
'''NetShare_Power.VBS by baomaboy '''支持参数 i 开启,u 关闭,如:"wscript.exe NetShare_Power.VBS i" Dim WshSHell On Error Resume Next Const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set WshShell = WScript.CreateObject("WScript.Shell") Set Args = WScript.Arguments Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Services\lanmanserver\Linkage","Route", arrValues For Each strValue In arrValues DuoString=DuoString&strValue Next NetShareState = InStr(DuoString,"{86522D76-E90D-4C8B-957E-FA3603378EA5}") if Args.Count=0 then intAnswer = MsgBox("【是】将开启“Microsoft 网络的文件和打印机共享”项,"&Chr(10)&Chr(10)&"【否】将关闭“Microsoft 网络的文件和打印机共享”项。", vbQuestion + vbYesNoCancel, "开/关Microsoft 网络的文件和打印机共享” - baomaboy") If intAnswer = vbYes and NetShareState = 0 Then Call Exc end if If intAnswer = vbNo and NetShareState <> 0 Then Call Exc end if elseif LCase(Args(0)) = "i" and NetShareState = 0 then Call Exc elseif LCase(Args(0)) = "u" and NetShareState <> 0 then Call Exc end if Sub Exc() WshSHell.Run "control.exe ncpa.cpl" WScript.Sleep 1000 WshSHell.SendKeys "{DOWN}{UP}" WScript.Sleep 1000 WshSHell.SendKeys "%FR" WScript.Sleep 1000 WshSHell.SendKeys "{DOWN}{ }" WScript.Sleep 1000 WshSHell.SendKeys "{TAB 5}{Enter}" WScript.Sleep 3000 WshSHell.SendKeys "%FC" End Sub Set WshSHell = Nothing WScript.Quit
Originally posted by eech at 2007-5-13 12:58: XPSP2运行后, 开始菜单闪一下 弹出搜索的窗口, http://photo1.bababian.com/upload/20070513/626501CAA3B8CA18275245B6A0D150A6.jpg 然后自动关闭这个窗口
Originally posted by ronin at 2007-5-13 14:47: 等待你的新版本哦
Originally posted by eech at 2007-5-13 15:46: 对了,baomaboy兄,你写的脚本是去掉这项的吧 http://photo1.bababian.com/upload/20070513/C345DEC54A6B2CE7ADF054EAA4D5DE47.jpg
Originally posted by ronin at 2007-5-13 16:39: baomaboy能不能改成勾选和取消勾选两个VBS?这样才方便批处理调用,在控制开通共享和关闭共享时候要分别调用才行
Originally posted by ronin at 2007-5-13 17:18: 我觉得用两个和参数调用都可以