简体   繁体   中英

How to take name from file with specific extension and use it as variable in batch script?

Can anyone tell me how to take name from specific file with specific extension (.pdf) and use it as variable? Thanks in advance...

for %%f in (*.pdf) do ( 
    set x=%%f
)
echo %x%

Assuming there's only one PDF in the current directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM