『第
5 楼』:
论坛的vbs脚本并不多,不过如果都看过一遍的话,楼主的问题也就不再是问题.
arrArgs = Array("无","IE","所有程序","控制面板","打印机和传真", _
"我的文档","收藏夹","启动","最近打开的文档","发送到", _
"回收站","开始菜单","暂缺","我的音乐","我的视频", _
"暂缺","桌面","我的电脑","网上邻居","NetHood", _
"字体","Templates","AllUser开始菜单","AllUser所有程序",_
"AllUser启动","AllUser桌面","MY_AppData","PrintHood", _
"MY_AppData2","暂缺","暂缺","AllUser收藏夹","IE缓存", _
"Cookies","历史记录","AllUserAppData","Windows","System32", _
"程序","我的图片","当前用户根目录","公共组件","暂缺",_
"暂缺","暂缺","AllUserTemplates","共享文档", _
"AllUserManagement","管理工具","网络连接","暂缺","暂缺", _
"暂缺","AllUserMusic","AllUserPictures","AllUserVideos", _
"桌面主题","Resources2","none","CD_Burning")
For i = 1 To UBound(arrArgs)
If arrArgs(i) = "当前用户根目录" Then intNumber = i
Next
str = "Set objShell = CreateObject(" & Chr(34) & _
"Shell.Application" & Chr(34) & ")" & vbLf & _
"Set objFolder = objShell.Namespace(" & intNumber & ")" & vbLf &_
"Set objFolderItem = objFolder.Self" & vbLf & _
"strDir = objFolderItem.Path"
Execute str
Wscript.Echo "获得★" & strDir & "★的代码:" & vblf & vblf & str
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "about:blank"
objIE.document.parentwindow.clipboardData.SetData "text", str
objIE.Quit
WScript.Echo "代码已被复制到剪贴板!"
Set objIE = Nothing 参考链接:[原创]SendTo+批处理实用小工具--加强版发送到
在vbs中,利用Wscript.Shell也可以得到部分系统目录,不过由于其内容太少,俺很少用它:
WScript.Echo CreateObject("Wscript.Shell").SpecialFolders("Desktop") 它可以获得的目录有:
Quote: | AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup |
|
另外,关于获得环境变量,你可以尝试用WMI来实现:
For Each x In GetObject("winmgmts:\\.\root\cimv2:Win32_Environment").Instances_
WScript.Echo x.Name & ":" & vbTab & x.VariableValue
Next Templates
|