简体   繁体   中英

(Batch File) List files in a specific directory but only filenames?

Hi Im quite new to programing and Im trying to make a batch file list music in one of my folders but i only want to see the names. I always get something like this:

C:\\users\\sebastian\\appdata\\roaming\\zones\\music\\song1.mp3

this is what i used

for %%a in (%userprofile%\AppData\Roaming\Zones\Music\*.mp3) do echo %%a

is there any way i can get it to just say song1 or at least song1.mp3

Use the delimiters ( FOR /? ) :

for song1

for %%a in (%userprofile%\AppData\Roaming\Zones\Music\*.mp3) do echo %%~na

for song1.mp3

for %%a in (%userprofile%\AppData\Roaming\Zones\Music\*.mp3) do echo %%~nxa

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