Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

'for' command doesn't work in a batch file

  • 02-04-2012 8:56pm
    #1
    Registered Users, Registered Users 2 Posts: 5,103 ✭✭✭


    Hi

    I have a windows command which works from the command prompt

    for /r C:\Temp\test1 %i in (*.txt) do @move "%i" "C:\Temp\test2"

    It moves all the .txt files in C:\Temp\test1 (and subfolders) into C:\Temp\test2

    But when I put the file into a batch file it doesnt work

    any ideas?

    thanks
    m


Comments

  • Registered Users, Registered Users 2 Posts: 22,584 ✭✭✭✭Steve


    Try this:
    To use the FOR command in a batch program, specify %%variable instead of %variable. Variable names are case sensitive, so %i is different
    from %I.

    source.


  • Registered Users, Registered Users 2 Posts: 5,103 ✭✭✭mathie


    Steve wrote: »
    Try this:


    source.

    You sir are a legend!
    thanks


Advertisement