I am trying to create multiple empty files to my project from the command prompt(Windows) and I always used the touch command. but what can I use if I want to create more files in the same line.
Thanks a lot!
I am trying to create multiple empty files to my project from the command prompt(Windows) and I always used the touch command. but what can I use if I want to create more files in the same line.
Thanks a lot!
You can use the FOR
command like this:
FOR %N IN (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) DO (echo null > C:\temp\%N.txt)
This will create 26 empty .txt files with one line.
If you want to clean up the files created, use this:
FOR %N IN (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) DO (del C:\temp\%N.txt)
A FOR
loop will allow you to make as many files as you want. The following command creates ten (10) files.
FOR /L %A IN(1,1,10) DO (TYPE>"%TEMP%\%~A.txt" NUL)
If this is used in a .bat file script, be sure to double the %
character on the variable.
FOR /L %%A IN(1,1,10) DO (TYPE>"%TEMP%\%%~A.txt" NUL)