Home > Back-end >  How to make multiple files using Powershell
How to make multiple files using Powershell

Time:12-06

How to change this command to make file name 001.js , 002.js , 003.js ... instead of 1.js , 2.js , 3.js ... ?

1..100 | foreach {New-Item -path "C:\Users\suuii\Desktop\A$_.js"

CodePudding user response:

One alternative:

1..100 | % { "{0:d3}" -f $_ } | % { ni "C:\Users\suuii\Desktop\A$_.js" }

Another:

1..100 | % tostring 000 | % { ni "C:\Users\suuii\Desktop\A$_.js" }
  • Related