p100sch icon

Untitled

p100sch | PRO | 08/18/26 05:58:40 AM UTC | 1 ⭐ | 2960 👁️ | Never ⏰ | []
PowerShell |

750 B

|

Source Code

|

1 👍

/

0 👎

$types = @(
    [PSCustomObject]@{ prefix = ''; name = '' },
    [PSCustomObject]@{ prefix = ''; name = '' })
 
Write-Host "Select type:"
for ($i = 0; $i -lt $types.Count; $i++) {
    Write-Host "    [$($i + 1)] $($types[$i].name)"
}
[int]$choice = Read-Host "  "
if ($choice -lt 1 -or $choice -gt $types.Count) {
    Write-Host "Invalid choice. Exiting."
    exit
}
 
$type = $types[$choice - 1]
 
[int]$startNum = Read-Host "Enter start number"
[int]$endNum = Read-Host "Enter end number"
 
for ($i = $startNum; $i -le $endNum; $i++) {
    $formattedNum = "{0:D3}" -f $i
    $fileName = "$($type.prefix)$formattedNum$($type.name)"
    Write-Host "Creating file: $fileName"
    New-Item -Path . -Name $fileName -ItemType File -Force | Out-Null
}
 

Comments