i need windows command line to find all files that end with .jpg.pdf and remove the .jpg part so it will be pure .pdf at the end, i have following line
for /R %DIR% %%i in (*.jpg.pdf) do set without=%i:~0,-8% & rename %%i "%%without.pdf"

It should remove last 8 characters and then rename file with .pdf extension for some reason it creates without variable with this content '~0,-8without'

any idea how to execute these two commands in one for loop? the '&' doesnt do the trick for some reason...


Recommended Answers

Hi Martin,
Shouldn't the & be &&?

Jump to Post

All 3 Replies

Hi Martin,
Shouldn't the & be &&?

I think the below command would work for this case

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.