Tag Info

New answers tagged


Assuming source.txt is formatted as follows: myfolder\mynewdir1 myfolder\mynewdir2 myfolder2\subdir\mynewdir3 Batch: @echo off setlocal set folders=C:\source.txt for /f %%d in ("%folders%") do ( md %%d ) Powershell: $folders=@(Get-Content 'C:\source.txt') ForEach ($folder in $folders) { New-Item -ItemType directory -Path C:\$folder ...


Even that command will list the content. If you can wait do it, else boot in the repair console and do a RD / RMDIR on the folder and do a mkdir after. Too bad you cant do it while windows is loaded


@dbenham is right on. I'll throw out an alternative. I find the delayed expansion a bit ugly and confusing for longer subroutines, so I'll tend to have a lone call as the "body" of a for loop. Inside the call variable expansion happens "normally". Observe: @echo off setlocal set start=1 set end=500 set interval=100 for /L %%g in (%start%, %interval%, ...


This is a classic delayed expansion issue. Type help set or set /? from the command prompt for a discussion about delayed expansion (a bit past half way down the full help). Normal expansion using %var% occurs when the line is parsed. The problem is your entire FOR loop block is parsed in one pass. So you are seeing a constant value that existed before the ...

Top 50 recent answers are included