バッチ ファイルで .exe プログラムの複数のインスタンスを開くことができません

バッチ ファイルで .exe プログラムの複数のインスタンスを開くことができません

次のコード行があります:

@echo off

rem set the path to the Spek executable
set spek=C:\Program Files (x86)\Spek\spek.exe

rem set the path to the audio files
set audio_path=P:\Muzyka\complete\Album

rem loop through all audio files in the specified directory
for %%a in (%audio_path%\*.mp3) do (

  rem open the audio file in a new Spek window
  start "" %spek% "%%a"
)

そして、そのフォルダ内の 2 つの曲を開きたいのですが、なぜ機能しないのでしょうか?

答え1

spekパスにスペースが含まれているため、変数の値を二重引用符で区切る必要があります。

 set spek="C:\Program Files (x86)\Spek\spek.exe"

変更後に .bat ファイルをテストしたところ、動作しました。

関連情報