none
Invalid Command Line. Unknown Switch : useenv

    Question

  • Hi there!

    I have been trying to load a c# solution through a cmd file, which loads some env vars and tries to run devenv.exe with the switch \useenv.

    Unfortunately, this, for some reason, wouldn't work ! The error message I get is Invalid Command Line. Unknown Switch : useenv . I have tried every possible solution found online ! but no luck !

    I was just wondering what the origin of the problem could be! since, I know that the switch /useenv does exist !is it the version od the devenv.exe/ .com ?

    Many thanks.

    Mehdi

    Friday, December 27, 2013 9:35 AM

Answers

  • Maybe you could search it in your computer:

    If you still couldn't get it, maybe you could re-install it in your side, please install the VS2010 SP1 for VS2010.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 07, 2014 3:16 AM

All replies

  • Can you post the line from the bat file?

    jdweng

    Friday, December 27, 2013 11:03 AM
  • Hi

    That's what I have got ! it used to work though !

    START devenv.exe /useenv Server.sln

    thanks

    Friday, December 27, 2013 11:09 AM
  • The bat file can't find START or doesn't have full path to the executable.  Another reason you could be have problems if somebody renamed a folder and put a space into the folder name.  Single quotes may solve the issue.

    Try removing Start and then put single quotes into the file like below. 

    'c:\full path \devenv.exe' '/useenv Server.sln'


    jdweng

    Friday, December 27, 2013 12:27 PM
  • Hi Joel,

    I have tried that, but no luck !it still says that the /useenv switch is invalid ! is it related to the devenv version ?! because when the error is thrown it shows a list of the possible switches which does not include /useenv

    Many thanks.

    Mehdi

    Monday, December 30, 2013 8:40 AM
  • Is the error message coming from windows or from you application?  Put a break point in you program at Main() and see if it gets to the break point.

    jdweng

    Monday, December 30, 2013 9:47 AM
  • The error message seems to be thrown by Visual Studio as a non valid switch ! The project does not even load actually ! and even if it loaded, if wouldn't run properly since it requires some environment variables !

    PS: When the error is thrown, the dialog box displays a set of the switches that can be used with devenv.exe and /useenv isn't there !

    thanks

    Monday, December 30, 2013 10:22 AM
  • The problem is occurring in you application.  The single quote character I recommend adding to the bat file is being seen by the program so in your program you need to remove the character.

    I would recommend temporarily adding in you application some debug code using Console.WriteLine() that displays the command line that the program is getting to make it easier to debug.  Then hard coding the command line that gets displayed into your VS application using a string.  Once you have the string in your code you can then open VS and debug the code.  After you get it working then remove the debug code and try again with the bat file.


    jdweng

    Monday, December 30, 2013 10:33 AM
  • I think that since “devenv/?” command does not list the /useenv option, and you also get an error when you try to use /useenv, then this means that the option is not supported by your Visual Studio. Which version are you using? Is it the “Express” version?

    Maybe you should consider some alternatives.

    Monday, December 30, 2013 3:40 PM
  • @Joel: Unfortunately mate ! no luck.

    Monday, December 30, 2013 3:44 PM
  • @Viorel:

    I am usign VS2010 Premium !

    Monday, December 30, 2013 3:45 PM
  • From the above messages, it works in case of “START devenv.exe /useenv Server.sln” command line. In which circumstances it does not work?

    Monday, December 30, 2013 4:10 PM
  • Well ! I have a .cmd file that calls another cmd that loads some Env Vars. Then I have START devenv.exe /useenv Server.sln to open the project !

    It just wouldn't work. Any idea ?

    Thanks

    Monday, December 30, 2013 4:15 PM
  • Can you prepare and show here two short CMD files that reproduces the problem on your machine?

    Monday, December 30, 2013 4:30 PM
  • This is the the script that tries to load the project. It loads the Env Vars fine but not the project.

    @Echo OFF

    Call SetAllEnvVars.cmd

    start devenv.exe /useenv project.sln

    Thanks.

    Monday, December 30, 2013 4:33 PM
  • Hi SkyCaptain13,

    If you open the VS cross tools (maybe you could run it as the admin), and then run “Devenv.exe /useenv”, whether your VS IDE opened? I could run it in my VS2010 Ultimate version like the following screen shot.

    Reference:

    http://msdn.microsoft.com/en-us/library/ms241275.aspx

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 31, 2013 10:01 AM
  • Hi Jack ! Thanks for your reply ! I cant really find Visual Studio Cross tools command on my machine ! I've only got the VS Command Prompt ! Any idea where they are located ?
    Tuesday, December 31, 2013 10:42 AM
  • Hi SkyCaptain13,

    If you open VS Command Prompt, could you open the VS if you run “Devenv.exe /useenv”? I could also get it like the following screen shot.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, January 02, 2014 5:34 AM
  • Hi Jack,

    Thanks for your reply ! for some strange reason I can't find the vs command prompt ! I didn't do the installation myself so I'm not too sure what has been installed ! do you think it is worth re-installing vs 2010 ?

    Cheers

    Monday, January 06, 2014 9:35 AM
  • Maybe you could search it in your computer:

    If you still couldn't get it, maybe you could re-install it in your side, please install the VS2010 SP1 for VS2010.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 07, 2014 3:16 AM
  • Hi Jack !

    I will try to re install vs2010 sp1 today and try these suggestions then get back ! Many thanks 


    SkyCaptain

    Wednesday, January 08, 2014 8:52 AM