尝试使用VBScript创建多个文件夹 [英] Trying to create multiple folders with VBScript

查看:104
本文介绍了尝试使用VBScript创建多个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一组空文件夹,从10开始,到180.这是我要使用的脚本,但它只创建10,而没有其他内容.

I need to create A set of empty folders, starting at 10, going to 180. This is the script I'm trying to use, but it just creates 10, and nothing else.

Option Explicit
Dim objFSO, objFolder, strDirectory, i
strDirectory = "\path\to\main\folder"

Set objFSO = CreateObject("Scripting.FileSystemObject")
i = 180
While i < 180
    Set objFolder = objFSO.CreateFolder(strDirectory & i)
    i = i+1
    WScript.Quit
Wend

我是VBScript的新手,所以也许问题很明显,但是我看不到.我也尝试过使用For循环,但这似乎根本不起作用.

I'm pretty new to VBScript, so maybe the problem is obvious, but I just don't see it. I also tried using a For loop, but that didn't seem to work at all.

在此先感谢任何阅读此书的人.

Thanks in advance to anyone who reads this.

推荐答案

我对您的脚本进行了如下修改:

I have modified your script as follows:

Option Explicit 
Dim objFSO, objFolder, strDirectory, i 
strDirectory = "C:\Temp\Test\folder" 

Set objFSO = CreateObject("Scripting.FileSystemObject") 
i = 10  '' <===== CHANGED!
While i < 180 
    Set objFolder = objFSO.CreateFolder(strDirectory & i) 
    i = i+1 
    ''WScript.Quit '' <===== COMMENTED OUT!
Wend 

使用此脚本,我设法创建了180个文件夹.

With this script, I managed to create 180 folders.

这篇关于尝试使用VBScript创建多个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆