Announcement

Collapse
No announcement yet.

For /F command only opens .TXT file

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • For /F command only opens .TXT file

    Hello all,

    Posting in here because this is a scripting question, but also posted in the AD forum due to it's relation to AD (dsmove command). Please forgive the double posts

    I'm devising some dsquery / dsmove commands , just experimenting around.

    I'm experimenting with using for /f command to parse each line of .txt file. The .txt file contains the DN of the objects I want to move.

    However, all that happens is the .TXT file opens. It sits there, then I close it, and the command completes, but nothing's been moved in AD

    Here's my command

    for /f "Tokens=* delims=" %a in ('%userprofile%\desktop\8months.txt') do ('dsmove "%a" -newparent "OU=8months,OU=oldcomp,DC=office,DC=local"')

  • #2
    Re: For /F command only opens .TXT file

    Sorry, but the forum rules do not allow double posts, so I have deleted the one in AD.

    Perhaps you could post the firstfew lines of the text file to help us see how to debug this one?
    (Feel free to substitute dummy data as long as the format remains the same)
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: For /F command only opens .TXT file

      Originally posted by TOMJLAEL View Post
      Here's my command
      Code:
      for /f "Tokens=* delims=" %a in ('%userprofile%\desktop\8months.txt') do ('dsmove "%a" -newparent "OU=8months,OU=oldcomp,DC=office,DC=local"')
      The single-quote signs you added in your command line should be removed.

      example:
      Code:
      For /F "usebackq Tokens=*" %a in ("%userprofile%\desktop\8months.txt") do @dsmove "%a" -newparent "OU=8months,OU=oldcomp,DC=office,DC=local"
      /Rems

      This posting is provided "AS IS" with no warranties, and confers no rights.

      __________________

      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts

      Comment

      Working...
      X