Not quite as concise as bash, but it can be done.
@(97..(97+25)) + @(48..(48+9)) |
ForEach-Object { New-Item -Path "$([char]$_).txt" -WhatIf }
Another way...
@([int][char]'a'..[int][char]'z') + @([int][char]'0'..[int][char]'9') |
ForEach-Object { New-Item -Path "$([char]$_).txt" -WhatIf }
And one more...
function rng { @($([int][char]$args[0])..$([int][char]$args[1])) }
(rng 'a' 'z') + (rng '0' '9') |
ForEach-Object { New-Item -Path "$([char]$_).txt" -WhatIf }
If you are desperate to do this in a cmd.exe shell, this might work. When it looks like the correct commands are produced, delete or comment out the echo
line and remove the rem
from the next line.
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET "CLIST=abcdefghijklmnopqrstuvwxyz0123456789"
FOR /L %%i IN (0,1,35) DO (
CALL SET "S=%%CLIST:~%%i,1%%.txt"
echo TYPE NUL ^>"!S!"
rem TYPE NUL >"!S!"
)