在路径空间和paranthesis CALL [英] CALL with spaces and paranthesis in path

查看:323
本文介绍了在路径空间和paranthesis CALL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面给出的code是 vcvarsall.bat 文件用于摘录
设置的Visual C ++命令行环境变量。
由于错误(在code作为REM语句提及),环境变量未设置。

 :86如果存在%〜dp0bin回声%〜dp0bin存在REM上面一行给出了C:\\ Program Files文件(x86)的\\微软的Visual Studio 12.0 \\ VC \\ BIN存在作为输出。如果不存在%〜dp0bin \\ VCVARS32.BAT转到失踪所谓的%〜dp0bin \\ VCVARS32.BATREM上面一行给出了C:\\程序'不是内部或外部命令的输出。
转到:SetVisu​​alStudioVersion

由于环境变量没有设置我遇到了运行时错误,而建设项目NMAKE

我曾经使用过此<一个走了href=\"http://stackoverflow.com/questions/7883169/how-to-escape-variables-with-parentheses-inside-if-clause-in-a-batch-file\">SO问题这帖子但解决方法没有帮助。

任何人都可以提出一个解决方法调用呼叫与路径中的空格和括号?

编辑:

我已经把测试回声声明,其中被称为VCVARS32.BAT文件的开头。已经运行该语句的文件应该已经印在屏幕上的语句执行。而且我相信,程序流程是通过标记块:86 ,因为这是把有运行测试echo语句

编辑2:
下面从保罗和放大器的建议后,合作,改变了正常的设置命令扩展语法与报价。
在运行VCVARS32.BAT的执行停在下面几行:

  @if不是%WindowsSDK_ExecutablePath_x86%==(
    @setPATH =%WindowsSDK_ExecutablePath_x86%;%PATH%

中显示的错误是:

  \\微软在这个时候意外。


解决方案

从@Jeb的帮助后,我可以使用,以解决这个错误
下面调整的VCVARS32.BAT。

我添加

  @set PATHTEMP =%PATH%
@set PATH =%PATHTEMP:=%

  @if不是%WindowsSDK_ExecutablePath_x86%==(
    @setPATH =%WindowsSDK_ExecutablePath_x86%;%PATH%

基本上我刚刚从PATH变量剥离引号。

(感谢@jeb他的宝贵意见)。

The code given below is an excerpt from vcvarsall.bat file used to set the environment variables for Visual C++ Command Line. Due to the errors(mentioned in the code as REM statements), the environment variables are not set.

:x86

if exist "%~dp0bin" echo "%~dp0bin exists" 

REM The above line gives "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin exists" as output.

if not exist "%~dp0bin\vcvars32.bat" goto missing

call "%~dp0bin\vcvars32.bat"

REM The above line gives 'C:\Program' is not recognized as an internal or external command as output.
goto :SetVisualStudioVersion

Since the environment variables are not set I ran into runtime errors while building an nmake project.

I have gone through this SO question and this post but the workarounds didn't help.

Could anyone suggest a workaround for calling the call with spaces and parentheses in the path?

Edit:

I have placed a test echo statement in the beginning of the vcvars32.bat file which is being called. Had the file been run this statement should have been executed with the statement printed on the screen. Moreover I am sure that the program flow is through the block labelled :x86 because the test echo statements which are put there are run.

Edit 2 : After following the suggestions from Paul & Co, changed the normal set command to extended syntax that is with the quotes. On running the vcvars32.bat the execution stops at the below lines :

@if not "%WindowsSDK_ExecutablePath_x86%" == "" (
    @set "PATH=%WindowsSDK_ExecutablePath_x86%;%PATH%"
)

The error shown is :

\Microsoft was unexpected at this time.

解决方案

After the help from @Jeb, I am able to resolve this error using the below tweak in vcvars32.bat.

I added

@set PATHTEMP=%PATH%
@set PATH=%PATHTEMP:"=%

before

@if not "%WindowsSDK_ExecutablePath_x86%" == "" (
    @set "PATH=%WindowsSDK_ExecutablePath_x86%;%PATH%"
)

Basically I just stripped the quotes from the PATH variable.

(Indebted to @jeb for his valuable suggestion).

这篇关于在路径空间和paranthesis CALL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆