Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: batch file to run vbscript in all subfolders  (Read 3096 times)

0 Members and 1 Guest are viewing this topic.

tlm2408

    Topic Starter


    Newbie

    • Experience: Familiar
    • OS: Windows 8
    batch file to run vbscript in all subfolders
    « on: January 24, 2017, 04:21:07 AM »
    Hello,

    I have been trying for days to create a batch file that will run a vbscript (dirlist.vbs) in every subdirectory and sub subdirectory of the parent directory. Is this even possible. I have found some examples that come close to what I am looking for through searching, but I can't make sense of them.

    Any help would be greatly appreciated.


    Never mind I got it worked out. For anyone looking for this:

    Code: [Select]

    @echo off
    call :treeProcess
    goto :eof

    :treeProcess
    rem Do whatever you want here over the files of this subdir, for example:
    for %%f in (*.vbs) do cscript %%f
    for /D %%d in (*) do (
        cd %%d
        call :treeProcess
        cd ..
    )
    exit /b

    « Last Edit: January 24, 2017, 05:17:01 AM by tlm2408 »

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: batch file to run vbscript in all subfolders
    « Reply #1 on: January 24, 2017, 06:33:38 AM »
    Well your code is still not setup correctly.

    If all your vbscript does is iterate a directory listing you can easily do that a couple of ways with native batch script.