vkaul11
vkaul11

Reputation: 4214

how to get filename with complete path without file extension in windows batch mode

I wanted to get the filename with absolute path but without the file extension in windows, but I am not able to figure that out. For example if the file is in C:\current_home\test.jpg, I want the echo output to be C:\current_home\test (without .jpg). The command I use below %~nf gives me just 'test' without absolute path. Any help will be appreciated.

for /R %f in (*.jpg) do echo %~nf

Upvotes: 4

Views: 4506

Answers (1)

Magoo
Magoo

Reputation: 79983

~dpnf if you want the drive
~pnf if not

Upvotes: 4

Related Questions