- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章vbsTree VBS脚本模拟tree命令由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
复制代码 代码如下
'-------------vbsTree.vbs------------------------ '描述:用vbs输出一个文件夹的目录结构。 '------------------------------------------------ Const Unit4Size = "字节KBMBGB" Const OutFile = "OutTree.txt" Dim theApp,SelPath,TreePath,TreeStr Set theApp = CreateObject("Shell.Application") Set SelPath = theApp.BrowseForFolder(0,"请选择需要列出子项目的路径",0) If SelPath Is Nothing Then WScript.Quit TreePath = SelPath.items.Item.Path Set SelPathPath = Nothing Set theApp = Nothing Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") TreeStr = TreePath & FormatSize(objFSO.GetFolder(TreePath).Size) & vbCrLf Tree TreePath,"" Set objFile = objFSO.CreateTextFile(OutFile,True) objFile.Write TreeStr objFile.Close Set objFile = Nothing Set objFSO = Nothing MsgBox "查看当前目录下的OutTree.txt",vbInformation,"完成 - vbsTree" Sub Tree(Path,SFSpace) Dim i,TempStr,FlSpace FlSpace = SFSpace & " " Set CrntFolder = objFSO.GetFolder(Path) i = 0:TempStr = "├─" For Each ConFile In CrntFolder.Files i = i + 1 If i = CrntFolder.Files.Count And CrntFolder.SubFolders.Count = 0 Then TempStr = "└─" TreeStr = TreeStr & FlSpace & Tempstr & ConFile.name & FormatSize(ConFile.size) & vbCrLf Next i = 0:TempStr = "├─" For Each SubFolder In CrntFolder.SubFolders i = i + 1 If i = CrntFolder.SubFolders.Count Then TempStr = "└─" SFSpace = FlSpace & " " Else SFSpace = FlSpace & "│" End If TreeStr = TreeStr & FlSpace & TempStr & SubFolder.name & FormatSize(SubFolder.size) & vbCrLf Tree SubFolder,(SFSpace) Next End Sub Function FormatSize(SZ) Dim i Do While SZ > 1024 i = i + 1 SZ = SZ \ 1024 Loop FormatSize = " (" & SZ & Mid(Unit4Size,1 + 2 * i,2) & ")" End Function 。
文件夹浏览部分优化后的代码 。
复制代码 代码如下
'-------------vbsTree.vbs------------------------ '描述:用vbs输出一个文件夹的目录结构。 '------------------------------------------------ Const Unit4Size = "字节KBMBGB" Const OutFile = "OutTree.txt" Dim TreePath,TreeStr,WS Set WS = WScript.CreateObject("WScript.Shell") TreePath = BFF("请选择需要列出子项目的路径",&H0001 + &H0008 + &H0010,"") Set WS = Nothing If Len(TreePath) = 0 Then WScript.Quit If Len(TreePath) <= 3 Then MsgBox "无法处理根目录!",64,"提示":WScript.Quit Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") TreeStr = TreePath & FormatSize(objFSO.GetFolder(TreePath).Size) & vbCrLf Tree TreePath,"" Set objFile = objFSO.CreateTextFile(OutFile,True) objFile.Write TreeStr objFile.Close Set objFile = Nothing Set objFSO = Nothing MsgBox "查看当前目录下的OutTree.txt",vbInformation,"完成 - vbsTree" Sub Tree(Path,SFSpace) Dim i,TempStr,FlSpace FlSpace = SFSpace & " " Set CrntFolder = objFSO.GetFolder(Path) i = 0:TempStr = "├─" For Each ConFile In CrntFolder.Files i = i + 1 If i = CrntFolder.Files.Count And CrntFolder.SubFolders.Count = 0 Then TempStr = "└─" TreeStr = TreeStr & FlSpace & Tempstr & ConFile.name & FormatSize(ConFile.size) & vbCrLf Next i = 0:TempStr = "├─" For Each SubFolder In CrntFolder.SubFolders i = i + 1 If i = CrntFolder.SubFolders.Count Then TempStr = "└─" SFSpace = FlSpace & " " Else SFSpace = FlSpace & "│" End If TreeStr = TreeStr & FlSpace & TempStr & SubFolder.name & FormatSize(SubFolder.size) & vbCrLf Tree SubFolder,(SFSpace) Next End Sub Function FormatSize(SZ) Dim i Do While SZ > 1024 i = i + 1 SZ = SZ \ 1024 Loop FormatSize = " (" & SZ & Mid(Unit4Size,1 + 2 * i,2) & ")" End Function Function BFF(title, flag, dir) On Error Resume Next Dim oShell, oItem, oStr Set oShell = WScript.CreateObject("Shell.Application") Set oItem = oShell.BrowseForFolder(&H0, title, flag, dir) oStr = oItem.Title If Err <> 0 Then Set oShell = Nothing Set oItem = Nothing Exit Function End If If InStr(oStr, ":") Then BFF = mid(oStr,InStr(oStr, ":")-1, 2) Else Select Case oStr Case "桌面" BFF = WS.SpecialFolders("Desktop") Case "我的文档" BFF = WS.SpecialFolders("MyDocuments") Case "我的电脑" MsgBox "无效目录!",64,"提示":WScript.Quit Case "网上邻居" MsgBox "无效目录!",64,"提示":WScript.Quit Case Else BFF = oItem.ParentFolder.ParseName(oItem.Title).Path End Select End If Set oShell = Nothing Set oItem = Nothing If Right(BFF,1)<> "\" Then BFF = BFF & "\" End If On Error GoTo 0 End Function 。
最后此篇关于vbsTree VBS脚本模拟tree命令的文章就讲到这里了,如果你想了解更多关于vbsTree VBS脚本模拟tree命令的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 9 年前。 Improve this
我有一系列 SQL 命令,我想在大约 40 个不同的表上运行。必须有一种方法可以在不编写 40 条不同命令的情况下执行此操作... 我在 SQL Server 中运行它。所有表都有不同的名称,我要操作
我习惯在 PHP 中使用命令“mysql_insert_id()”来返回插入到我的数据库中的最后一行的 id。 在 C# 中的 SQLite 中是否有等效的命令? 谢谢! -阿德娜 最佳答案 选择 l
试图找出一种方法来回填 ds 分区 Hive 表的分区。 我知道如何从 CLI 运行 Hive 命令,例如 $HIVE_HOME/bin/hive -e 'select a.col from tab1
我有 .bat 文件。看起来像下一个 ....many commands1 ftp -i -s:copy.txt ...many commands2 copy.txt 包含下一个命令 open ...
基本上我想输入 show 并检查是否有 show 命令或别名已定义并触发它,如果未定义则触发 git show 。 例如 rm 应该执行 rm 但 checkout 应该执行 git checkout
我公司的主数据库是 iSeries 机器,我已经非常习惯使用 DB2 命令和结构。我现在正在尝试做一个小项目,更新一个包含超过 300 万条记录的表。我想出一种比较和“清理”数据的更快方法是使用 My
我想在带有 Node 的终端中制作一个简单的按钮板,并“blessed”用于连接或运行不同的命令。 ----------------------------------------------- _
我们有一个 selenium IDE 脚本,正在转换为 python webdriver。以下命令未转换: [openWindow | http://mywebsite.com/index.php |
我正在学习这个关于从 GIT HUB 下载和安装 Web 文件的在线教程。我进入主题:启动我们的静态网站,系统提示我输入命令以下载和安装 Web 文件。但是,当我输入命令 yarn install 时
我在 shell 脚本中使用 elif 命令时遇到问题,就像在 fortran 中一样。 我有 100 家公司的员工名单。我想屏蔽那些员工少于 500 人的公司。我的脚本是 rm -f categor
我有一些 Linux 命令可以生成 token 。我在 Linux 机器上使用操作系统库形式的 Python 自动化了这些命令。它工作正常。 但是,当我在 Windows 中尝试相同的代码时,它没有返
本文分享自华为云社区《Git你有可能不知道交互式暂存》,作者:龙哥手记。 本节中的几个交互式 Git 命令可以帮助你将文件的特定部分组合成提交。 当你在修改了大量文件后,希望这些改动能拆分为若干提交而
我想知道如何使用 IN 比较语法来做到这一点。 当前的 SQL 查询是: select * from employee where (employeeName = 'AJAY' and month(e
我在这个位置安装了 Hadoop /usr/local/hadoop$ 现在我想列出 dfs 中的文件。我使用的命令是: hduser@ubuntu:/usr/local/hadoop$ bin/ha
是否有一个单一的 docker 命令可用于清除所有内容?如果正在运行,请停止所有容器、删除所有图像、删除所有卷...等。 最佳答案 我认为没有一个命令可以做到这一点。您首先需要停止所有容器使用 $ d
我基本上是在 clojure/nrepl 模式中寻找与 C-u C-x C-e 或 C-c C-p 等效的 Scheme。 我想要一个 C-x C-e 将输出打印到缓冲区,而不是仅仅在 repl 中。
我可以在 vim 中使用 pudb(一个 ncurses Python 调试器),因为,例如,:!python %在实际的终端窗口中运行。我更喜欢使用 gvim,但 gvim 运行 :!python
我正在尝试编写一个 FFMPEG 命令: 取为 输入 一个视频 input.mp4 和一个图像 pic.jpg 作为 输出 将 input.mp4 拆分为 20 秒的视频,按顺序重命名;对于每个分割视
我想转储视频每帧的比特率。我正在尝试使用 -vstats 获取此信息命令。当我运行此命令时 - ffmpeg -i input.mp4 -vstats 它显示至少应该定义一个文件。 如果有人能建议我任
我是一名优秀的程序员,十分优秀!