Search code examples
c#batch-filesolutiondevenv

devenv treating path from variable substituted with space as 2 parameters when run from batch file to build a C# solution


set "var=%cd%"
devenv "%var%"\example.sln /rebuild

here if we have solution example.sln at a path like and

c:\test\path withSpace\example.sln

and we assume that we run the batch file for the path

c:\test\path withSpace

I am getting the error:

The following files were specified on the command line:

c:\test\path withSpace

\example.sln


Solution

  • To solve this I changed:

    devenv "%var%"\example.sln /rebuild
    

    to

    devenv "%var%\example.sln" /rebuild
    

    Note the location of closing double quote