Thursday, June 17, 2010

FOR at console(command prompt) and in batch used differently

“FOR” at console(command prompt) and in batch used differently

This error is being caused by the FOR command. Your command is correct when typed at the console, but when using this command in a batch file you need to precede your % variables with a double %.

 

To Create folder and grant permission to user to access this folder and his/her own folder:

 

Batch to create folder name from a name list:

 

@echo off

 

for /f %%i in (C:\temp\file.txt) do mkdir %%i

 

(Remark: if running in console/command prompt it should be “for /F %i in (C:\temp\file.txt) do mkdir %i”)

Print Friendly and PDF
Share/Bookmark

No comments:

Post a Comment