행위

"PowerShell 일괄 파일 다운로드 스크립트"의 두 판 사이의 차이

라이언의 꿀팁백과

(새 문서: # Define the range of ID numbers $startNumber = 1 $endNumber = 1112 # Loop through the range of ID numbers for ($id = $startNumber; $id -le $endNumber; $id++) { # Format the ID number to have leading zeros $formattedId = $id.ToString("D5") $url = "https://www.example.com?filePath=" + $formattedId $outputName = $formattedId + ".jpg_" # Execute the external command with the formatted ID as a parameter Invoke-WebRequest -Uri $url -OutFile $outputName })
 
1번째 줄: 1번째 줄:
<syntaxhighlight lang="powershell" line="1" start="1">
# Define the range of ID numbers
# Define the range of ID numbers
$startNumber = 1
$startNumber = 1
7번째 줄: 8번째 줄:
     # Format the ID number to have leading zeros
     # Format the ID number to have leading zeros
     $formattedId = $id.ToString("D5")
     $formattedId = $id.ToString("D5")
     $url = "https://www.example.com?filePath=" + $formattedId
     $url = "https://neokiis.ksure.or.kr/ImageServlet?filePath=" + $formattedId
     $outputName = $formattedId + ".jpg_"
     $outputName = $formattedId + ".jpg_"


13번째 줄: 14번째 줄:
     Invoke-WebRequest -Uri $url -OutFile $outputName
     Invoke-WebRequest -Uri $url -OutFile $outputName
}
}
</syntaxhighlight>

2024년 1월 26일 (금) 14:29 판

# Define the range of ID numbers
$startNumber = 1
$endNumber = 1112

# Loop through the range of ID numbers
for ($id = $startNumber; $id -le $endNumber; $id++) {
    # Format the ID number to have leading zeros
    $formattedId = $id.ToString("D5")
    $url = "https://neokiis.ksure.or.kr/ImageServlet?filePath=" + $formattedId
    $outputName = $formattedId + ".jpg_"

    # Execute the external command with the formatted ID as a parameter
    Invoke-WebRequest -Uri $url -OutFile $outputName
}