[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 pcl_test 于 2016-7-1 12:46 编辑

当然可以了,参考本段(摘自 3DMAX9全自动注册 http://bbs.dp168.com/thread-79026-1-1.html):
  1. FunctiOn NetWork(i)
  2. '接收参数:0:关闭“本地连接”   1:打开“本地连接”   2:自动(关闭则打开;打开则关闭)
  3. Const ssfCONTROLS = 3
  4. sConnectionName = "本地连接"
  5. Set shellApp = createobject("shell.application")
  6. Set oControlPanel = shellApp.Namespace(ssfCONTROLS)
  7. Set oNetConnections = nothing
  8. for each folderitem in oControlPanel.items
  9. If folderitem.name = "网络连接" Then Set oNetConnections = folderitem.getfolder: exit for
  10. next
  11. If oNetConnections is nothing Then msgbox "未找到网络连接文件夹":wscript.quit
  12. Set oLanConnectiOn = nothing
  13. for each folderitem in oNetConnections.items
  14. If lcase(folderitem.name) = lcase(sConnectionName) Then Set oLanConnectiOn = folderitem: exit for
  15. next
  16. If oLanConnectiOn is nothing Then msgbox "未找到 '" & sConnectionName & "' item":wscript.quit
  17. bEnabled = true
  18. Set oEnableVerb = nothing
  19. Set oDisableVerb = nothing
  20. s = "Verbs: " & vbcrlf
  21. for each verb in oLanConnection.verbs
  22. s = s & vbcrlf & verb.name
  23. If verb.name = "启用(&A)" Then Set oEnableVerb = verb:bEnabled = false
  24. If verb.name = "禁用(&B)" or verb.name = "停用(&B)" Then Set oDisableVerb = verb:End If
  25. next
  26. If bEnabled and (i=0 or i=2) Then
  27. oDisableVerb.DoIt
  28. Else
  29. If bEnabled=0 and i>0 Then oEnableVerb.DoIt
  30. End If
  31. wscript.sleep 400
  32. End Function
复制代码

TOP

本帖最后由 9zhmke 于 2016-7-3 12:03 编辑

XP当然是可以实现的,玩程序得调试,不调试那叫定制程序

TOP

返回列表