Batch file to include all subdirectories. Help  


  1. Posts : 1
    Windows 10
       #1

    Batch file to include all subdirectories. Help


    Trying to get batch file to include all subdirectories.


    echo **Have double apostrophe (" ") for file path that includes spaces**
    echo.
    echo.
    SET /p B=Enter the folder location (Then press ENTER):

    rem cd "%B%"
    pause
    for %%v in (%B%*.afd) DO (
    cmd /C ""C:\Program Files\AutoForm\AFplus\R8F\bin\AFCopy.exe" -check -jn "%%v""

    )

    pause
      My Computer


  2. Posts : 16,547
    Windows 10 Home x64 Version 22H2 Build 19045.3930
       #2

    Welcome to TenForums.

    I think I ought to suggest posting in
    SS64 cmd forum
    instead but since your question is straightforward, I'll help you here.


    If your intention is for the For command to cycle through a list of files in the folder & its subfolders then it is incorrect. It should be in the form
    Code:
    For /F "tokens=*" %%V in (' Dir "D:\Desktop\*.afd" /s /b ') do echo %%V
    so, for your case, you'd want
    Code:
    For /F "tokens=*" %%v in (' Dir "%B%\*.afd" /s /b ') DO (
     cmd /C ""C:\Program Files\AutoForm\AFplus\R8F\bin\AFCopy.exe" -check -jn "%%v"" 
     )
    - I have assumed that your %B% does not end with a backslash \. If it does then remove the backslash from my code.
    - I know nothing about your AFCopy and can only assume that you have tested that cmd /c syntax in a shortcut.

    Denis
    Last edited by Try3; 11 Mar 2021 at 01:11.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 06:49.
Find Us




Windows 10 Forums