例
これは最初の数のためX
にそれをします、私はあなたが開発して学ぶためにそれのいくつかを残します。:)
@echo off
setlocal EnableExtensions EnableDelayedExpansion
echo LeftXRight Gen
set /p "Left=Left = "
set /p "Right=Right = "
set /p "Start=Begin = "
set /p "End=End = "
>output.txt ( <nul set /p "=" )
for /L %%A in (%Start%, 1, %End%) do (
set "X=00%%A"
echo !Left!!X:~-3!!Right!>>output.txt
)
endlocal
出力
LeftXRight Gen
Left = http://user:password@website.com/members/sets/
Right = /somethingfixed.zip
Start = 1
End = 10
output.txt
http://user:password@website.com/members/sets/001/somethingfixed.zip
http://user:password@website.com/members/sets/002/somethingfixed.zip
http://user:password@website.com/members/sets/003/somethingfixed.zip
http://user:password@website.com/members/sets/004/somethingfixed.zip
http://user:password@website.com/members/sets/005/somethingfixed.zip
http://user:password@website.com/members/sets/006/somethingfixed.zip
http://user:password@website.com/members/sets/007/somethingfixed.zip
http://user:password@website.com/members/sets/008/somethingfixed.zip
http://user:password@website.com/members/sets/009/somethingfixed.zip
http://user:password@website.com/members/sets/010/somethingfixed.zip
アップデート
この完全な解決策を質問に追加しました。
@echo off
setlocal EnableExtensions EnableDelayedExpansion
echo LeftXMidXRight Gen
set /p "Left=Left = "
set /p "Middle=Middle = "
set /p "Right=Right = "
set /p "Start=Begin = "
set /p "End=End = "
>output.txt ( <nul set /p "=" )
for /L %%A in (%Start%, 1, %End%) do (
set "X=00%%A"
echo !Left!!X:~-3!!Middle!!X:~-3!!Right!>>output.txt
)
endlocal
例
LeftXMidXRight Gen
Left = http://user:password@website.com/members/sets/
Middle = /somethingfixed-
Right = .zip
Begin = 1
End = 150
output.txt
http://user:password@website.com/members/sets/001/somethingfixed-001.zip
http://user:password@website.com/members/sets/002/somethingfixed-002.zip
...
http://user:password@website.com/members/sets/150/somethingfixed-150.zip