0
私は1つの場所(すべて同じフォルダ内)にPDFファイルを持っています。ファイル名から3つの有益な情報を取得する必要があります。バッチウィンドウ - 異なるフォルダにある多くのファイルの名前を変更するループを作成するにはどうすればよいですか?
そして、私はPDFから取り込んだこれらの情報で名前を変更する必要がある別の場所(フォルダごとに1枚の画像)に.jpgファイルを持っています。
私のスクリプトは、情報を見つけ出し、保存して名前を変更できますが、ディレクトリ内の最初のファイルに対してのみ機能し、停止します。 情報を取得するPDFファイルがなくなるか、名前を変更するための.jpgファイルがなくなるまで、ループを実行する必要があります。
誰かがこのスクリプトをループで実行できるように手伝ってもらえますか?
echo off
setLocal EnableDelayedExpansion
rem User input
SET /P datework= Please type the date you want to work (format yyyymmdd):
rem Folder where the PDFs are located - extract the useful information from file name
cd /D C:\Users\A\Desktop\A_tests\QC\PDF\%datework%\
for %%i in (*.pdf) do (
set RcvLn=%%i
set RcvLn=!RcvLn:~0,4!
set GunStn=%%i
set GunStn=!GunStn:~5,4!
set Node=%%i
set Node=!Node:~10,4!
)
rem Rename the pictures using the values stored on the variables
xcopy /Y "C:\Users\A\Desktop\A_tests\QC\UHD73\Node Deployment\%datework%\Node %Node%\*.jpg" "C:\Users\A\Desktop\A_tests\QC\UHD73\Node Deployment\%datework%\Node%Node%_RL%RcvLn%_GS%GunStn%.jpg"
ありがとうGerhard!そのような簡単な解決策..私はそれが私にそれを見るためには昨夜遅すぎたと思います。 :P :) –