Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
1 つのフォルダーに実行可能ファイルVSTO.exe とtry.batファイルがあります。Batファイルのフォルダーパスを取得し、そのパスをVSTO.exe.
VSTO.exe
try.bat
にこのスクリプトがありますtry.bat。
"%~fp0\VSTO.exe" /q
しかし、それはパスを作成します: " G:\test\try.bat\VSTO.exe"。パスを取得したい"G:\test\VSTO.exe"
G:\test\try.bat\VSTO.exe"
"G:\test\VSTO.exe"
誰かが私にそれを行う方法を教えてもらえますか?
"%~dp0\VSTO.exe" /q
正確な答えです。
CMDでファイルパスからフォルダーパスを取得する方法
これで試してください
SET CURDIR=%CD% "%CURDIR%\VSTO.EXE" /q
%CD% 疑似変数は、現在の作業ディレクトリに展開されます。 SET /? と入力します。他の疑似変数を見る(最後のページ)