p100sch

Untitled

Aug 18th, 2026
2,348
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 0.75 KB | Source Code | 1 0
  1. $types = @(
  2.     [PSCustomObject]@{ prefix = ''; name = '' },
  3.     [PSCustomObject]@{ prefix = ''; name = '' })
  4.  
  5. Write-Host "Select type:"
  6. for ($i = 0; $i -lt $types.Count; $i++) {
  7.     Write-Host "    [$($i + 1)] $($types[$i].name)"
  8. }
  9. [int]$choice = Read-Host "  "
  10. if ($choice -lt 1 -or $choice -gt $types.Count) {
  11.     Write-Host "Invalid choice. Exiting."
  12.     exit
  13. }
  14.  
  15. $type = $types[$choice - 1]
  16.  
  17. [int]$startNum = Read-Host "Enter start number"
  18. [int]$endNum = Read-Host "Enter end number"
  19.  
  20. for ($i = $startNum; $i -le $endNum; $i++) {
  21.     $formattedNum = "{0:D3}" -f $i
  22.     $fileName = "$($type.prefix)$formattedNum$($type.name)"
  23.     Write-Host "Creating file: $fileName"
  24.     New-Item -Path . -Name $fileName -ItemType File -Force | Out-Null
  25. }
  26.  
Advertisement