Visual Studio Command Prompt gives “\Common was unexpected at this time”

前端 未结 4 1538
轻奢々
轻奢々 2020-12-20 11:55

I need to run MSBuild from the command line using the Visual Studio Command Prompt (2010). It used to work fine. Now when I open the window I get the following error message

相关标签:
4条回答
  • 2020-12-20 12:02

    I had quotation marks (") in the PATH variable that caused this, after I removed them it started working.

    0 讨论(0)
  • 2020-12-20 12:05

    My problem was that inside of an if block the rval of a variable assignment (%PATH% in my case) contained a parentheses, for example:

    set var=foo ) got ya
    
    if 1 == 2 (
        set var2=%var%
    )
    

    Displays "got was unexpected at this time."

    I found the answer here: Batch file variable with spaces and parentheses. Which is to use the extended syntax of set. For example:

    set "var2=%var%"
    

    This does not add quotes and does not affect the result stored in %var2%.

    0 讨论(0)
  • 2020-12-20 12:14

    See this thread.

    My guess is your PATH got modified recently and now contains some folder path with quotation marks inside.

    HTH

    0 讨论(0)
  • 2020-12-20 12:16

    Also, the semicolon symbol (";") at the environment variables list can cause the same behavior on Win 10.

    0 讨论(0)
提交回复
热议问题