如何在通过批处理文件运行exe之前设置路径变量

时间:2014-06-05 12:26:55

标签: batch-file

@echo off
SET INCLUDE_PATH=%INCLUDE_PATH%;%3
SET LIBRARY_PATH=%LIBRARY_PATH%;%4
:: Setting dll path which is taken as 5th argument
SET PATH=%PATH%;%5  
%1 %2 /p:Configuration=%6 /p:Platform=%7 /p:PlatformToolset=%8
:: Some exe path (taken as 9th parameter) to run which needs a path of dll which i am setting at above marked line
%9   

idealy我期待什么

  1. 首先将环境变量设置为路径
  2. 执行exe
  3. 发生了什么

    1. 执行exe而不将变量设置为PATH
    2. 在执行
    3. 之前未找到应将路径设置为PATH的dll的错误

      请帮我解决这个问题...

1 个答案:

答案 0 :(得分:0)

如果你的PATH包含一些空格字符,你应该替换:
SET PATH =%PATH%; ...通过SET PATH =!PATH!; ...