0

I am having the below command working in cmd in windows 7 to create 40 thousand files on the go, but not executing while I try to write it as a batch file. I copy pasted the same cmd as a file 40k.bat along with other commands.

For /L %i in (1,1,40000) do fsutil createnew 40kfile%i.txt 1048 

Please let me know why fsutil not working when I execute it as batch file. Or please point me to any other alternative which is as fast as fsutil.

debiansse
  • 680
  • 1
  • 7
  • 10

2 Answers2

0

Replace %i with %%i everywhere, when you execute it in a batch file.

foxidrive
  • 40,353
  • 10
  • 53
  • 68
0

Your code should be more like this:

For /L %%i in (1,1,40000) do fsutil createnew 40kfile%%i.txt 1048

You need double %. Take a look at this http://www.robvanderwoude.com/escapechars.php it should show you about the %%

I also fould some infomation here What is the difference between % and %% in a cmd file? You may find this useful.

Community
  • 1
  • 1
09stephenb
  • 9,358
  • 15
  • 53
  • 91