Saved Bookmarks
| 1. |
Solve : Reading from a txt file - spaces? |
|
Answer» Hi, FOR /F %1 IN (\\vfile1\cfp\ICT_Only_Templates\All_Scripts\Schemes.txt) do MD "\\vfile1\cfp\Housing Management\Housing Schemes\"%1 You just need to specify delimiters as carraige returns. FOR /F "delims=" %1 IN (\\vfile1\cfp\ICT_Only_Templates\All_Scripts\Schemes.txt) do MD "\\vfile1\cfp\Housing Management\Housing Schemes\"%1 Check out this post for a more detailed explaination. Quote from: Raven19528 on October 25, 2011, 09:48:34 AM You just need to specify delimiters as carraige returns. Hi - thanks for that, I tried this code but it did exactly the same thing i.e. as soon as it encountered a space it went to the next line - any thoughts?Sorry should give some more info - I get the following error when running your code but the error says these folders already exist but the folder is empty before running the code. I have blanked out some of the code as it has my name: [regaining space - attachment deleted by admin]If you are using these commands from a batch script you need to double up on the % e.g. %%1 The directories being created MAY have spaces in the name so you must include the trailing %%1 inside the " like so: Code: [Select]FOR /F "delims=" %%1 IN (\\vfile1\cfp\ICT_Only_Templates\All_Scripts\Schemes.txt) do MD "\\vfile1\cfp\Housing Management\Housing Schemes\%%1" Quote from: Dusty on October 26, 2011, 03:00:44 AM If you are using these commands from a batch script you need to double up on the % e.g. %%1 Thanks - I'm just running this directly from a command prompt. When I run the above code I get the attached message?? [regaining space - attachment deleted by admin]OK, thanks for the clarification, now REVERT to single % Quote from: Dusty on October 26, 2011, 03:17:06 AM OK, thanks for the clarification, now revert to single % Whoohoo - that works great, big thanks for that and to everyone who HELPED me get there.Thanks for coming back to REPORT your success. Good luck. |
|