我需要在批处理脚本中提示输入三个变量:
set /p artist=Artist:
set /p album=Album:
set /p title=Title:
但是,变量%~1
等于<Artist> - <Album> - <Title>
有没有办法让这个变量爆炸并获取零件?
答案 0 :(得分:0)
我能够弄清楚这一点,如果有其他有用的信息,我会为其他人发布。
REM Remove extension and full path
SET file=%~1
SET file=%file:.mp3=%
For %%A in ("%file%") do (SET file=%%~nxA)
REM : Get artist, album, and title from filename
REM : Only one character deliminator can be used, so replace " - " to "*" first
SET ftemp=%file: - =*%
for /f "tokens=1,2,3,4 delims=*" %%a in ("%ftemp%") do set artist=%%a&set title=%%b&set key=%%c&set ref=%%d