是否使用vbscript在所有子文件夹中运行另一个vbscript?

是否使用vbscript在所有子文件夹中运行另一个vbscript?,vbscript,Vbscript,我正在尝试在当前目录的所有子文件夹中运行vbscript。 到目前为止,我已经: CreateObject("Wscript.Shell").Run("""*\dirlistnew.vbs""") 但这不起作用。如果我删除*\,它将在当前目录中工作,但不会在子目录中工作。我知道我错过了一些简单的事情。已经搜索和尝试了几个小时,但没有结果。从我的代码片段库中找到了这个,请根据您的需要进行调整。 没有经过测试,过去几年我更喜欢Ruby 'call our sub with the desired

我正在尝试在当前目录的所有子文件夹中运行vbscript。 到目前为止,我已经:

CreateObject("Wscript.Shell").Run("""*\dirlistnew.vbs""")

但这不起作用。如果我删除
*\
,它将在当前目录中工作,但不会在子目录中工作。我知道我错过了一些简单的事情。已经搜索和尝试了几个小时,但没有结果。

从我的代码片段库中找到了这个,请根据您的需要进行调整。 没有经过测试,过去几年我更喜欢Ruby

'call our sub with the desired path as option
' this needs to be a Folder object, not a String
' FSO.GetFolder will return that object given a path as string
ShowSubfolders FSO.GetFolder(path)

Sub CreateHtml(path)
  ' put here the code from your other script (best)
  ' or do your call to execute the other script
  ' you probably need the path so you pass it as a parameter
End Sub

Sub ShowSubFolders(Folder)
' a Folder has the method SubFolders, 
' gives a collection of subfolders that can be enumerated
' with For Each construct
  For Each Subfolder in Folder.SubFolders
    ' print the subfolder so you can follow the progress
    Wscript.Echo Subfolder.Path
    ' and call the sub that creates the html file
    CreateHtml Subfolder.Path
    ' here the magic of recursion, the sub is calling itself with 
    ' as parameter the subfolder to process the subsubfolders etc
    ShowSubFolders Subfolder
  Next
End Sub

注意,在Ruby中只有一行
Dir[“{folder}/*”]。每个{f |放置f if File.directory?(f)}

搜索“vbscript子文件夹递归站点:stackoverflow.com”嗯。。。“已经搜索和尝试了几个小时,但没有结果。”真的,我在4分钟前搜索并发现了重复的内容,你搜索了什么?当你决定回答这样的问题时,你只会鼓励他们更多。这个问题充其量也很糟糕,很少或根本没有尝试自己解决这个问题,更不用说以前也有人回答过。是的,但你会像那样吓跑新用户,没有看到这是一个双重想法。注:他们要求的是VBScript解决方案,而不是Ruby。如果他们这么容易吓跑,那么这里就不是他们的地方。我犯了同样的错误,但我没有逃跑,而是阅读了巡演并进行了检查,我继续询问并进行了调整。我们不应该改变,因为有些人过于敏感,无法重新调整,意识到我们正在努力帮助他们。所有这些只是验证他们所做的是正确的,这是错误的信息。我想现在他明白了…,所以让我们结束讨论