Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to write a batch script that will rename folders that are defined in a list.txt file.

FOR /F %%a IN (C:\SCRIPTS\list.txt) DO RENAME "%%a" "%%a_delete" && EVENTCREATE /T INFORMATION /L APPLICATION /SO BLERG /ID 200 /D "MOVE %%a to %%a_old

In my list.txt file, I have the full paths defined.

C:\FolderA\Folder1
C:\FolderA\Folder9
C:\FolderB\Folder8
C:\RECYCLER\S-1-5-yn8o2-0p\6n2x-0p\n\Folder99

When I run the batch file, I get an error "THE SYNTAX OF THE COMMAND IS INCORRECT."

Funny thing is, this tested fine on an in-house server (both are Windows Server 2003 R2 Standard x64 SP2)

share|improve this question
1  
Are you sure the batch files are identical on both servers? No missing spaces or extra newlines? –  Nifle May 14 '13 at 19:23
    
I have no insight apart from my previous comment. But all my fellow sysadmins working with windows tell me that learning PowerShell is well worth it. –  Nifle May 14 '13 at 19:27
    
You're missing an ending quote on the Description argument (/D) for EventCreate, but I'm guessing that's a paste error. ;) –  techie007 May 14 '13 at 19:39
add comment

1 Answer

up vote 1 down vote accepted

try this:

FOR /F "usebackqdelims=" %%a IN ("C:\SCRIPTS\list.txt") DO RENAME "%%~a" "%%~nxa_delete"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.