windows - What Would I Call This?

07
2014-07
  • Elizabeth Frazier

    When I'm working on a web development project or tutorial, I generally open the same applications, just with different files. I wrote a batch file for my current project, so I can open these with one click. I think I eventually want to give it an interface and write it in a way that I can use this with any project. My question is: would this be considered a workflow application? If not, what would I call this type of application. I'm new to shell scripting/batch files so I don't know how the definitions/classifications work.

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    Windows CMD command to run a command inside every subdirectory?
  • jlacroix82

    I have a batch script I wrote called "joiner.bat." It needs to run inside each of 730 sub-directories of a folder. The joiner.bat file has already been copied into each of the sub-folders, it just needs to run in each. I tried this, but it doesn't work:

    for %f in (*) do joiner.bat %f

    I tried that command outside of a batch file just on the command prompt but it did nothing. I need the command to go into a folder, run the command, go back to the previous folder, into the next, run the command, and so on.


  • Related Answers
  • uSlackr

    This should do it:

    for /d %%a in (*) do (
        cd %%a 
        call joiner.bat
    )
    

    create this as a batch file in the top directory.

    I modified your bach file from the comments. You may need more parens and DelayedExpansion requires the use of ! instead of %. Try this

    setlocal enabledelayedexpansion
    for /d %%a in (*) do ( 
        cd %%a 
        copy /b *.xml newfile.xml 
        @echo off 
        SET "CDIR=%~dp0" 
        SET "CDIR=!CDIR:~0,-1!" 
        FOR %%i IN ("!CDIR!") DO (
            SET "PARENTFOLDERNAME=%%~nxi" 
            move newfile.xml "C:\users\lacroixja01\desktop\test\%PARENTFOLDERNAME%.xml" 
            )
    )