Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
Hi,
I want to run the following command from vb.net code. When I put it in process.start(" ")
it returns syntax error. Please advise

SQL
E:\UnInstall\SQLServer\SQLServerExpress2008\SQLEXPR_x64_ENU.exe / SQ/SAPWD="testpwd123"/security=SQL/BROWSERSVCSTARTUPTYPE="Enabled"/TCPENABLED="1"/NPENABLED="0"/INDICATEPROGRESS="True"/INSTANCENAME="CBEInstance"/IACCEPTSQLSERVERLICENSETERMS="True"


Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 11-Jun-13 15:20pm    
There is no "DOS command" anymore. The command line you show in your question is not a "DOS command", not in any sense of this word. Solution 1 is correct, but I doubt it's a good idea to start this process from your application.
—SA

The process.start has a few arguments, you should put the path to the executable in one, then in the arguments argument, you add the other pieces, like:

C#
Process.Start(@"E:\UnInstall\SQLServer\SQLServerExpress2008\SQLEXPR_x64_ENU.exe", "SQ/SAPWD=\"testpwd123\"/security=SQL/BROWSERSVCSTARTUPTYPE=\"Enabled\"/TCPENABLED=\"1\"/NPENABLED=\"0\"/INDICATEPROGRESS=\"True\"/INSTANCENAME=\"CBEInstance\"/IACCEPTSQLSERVERLICENSETERMS=\"True\"");


MSDN Documentation on Process.Start[^]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 11-Jun-13 15:21pm    
Correct, my 5, only please see my comment to the question. It's not so good to give OP the implicit confirmation that the question is correct as formulated... :-)
—SA
Ron Beyer 11-Jun-13 16:48pm    
A lot of people use the term "DOS" to mean anything done by the command prompt, DOS hasn't been used as an OS base since Windows 3.2, Win-NT though XP included bootstrapper versions of it for backwards compatibility, but wasn't used as an OS. It wasn't officially discontinued until mid-2000.
Sergey Alexandrovich Kryukov 11-Jun-13 17:27pm    
Right. I don't remember the history of "DOS box" well, but I remember the expectations and relief from getting rid of so dangerous CPU real mode. Anyway, using wrong terms does not help people, especially those who are not just "a lot of people", but a kind of developers...
—SA
you can use shell function .
shell function can be used as following.

VB
dim mycommand as string=""
   mycommand="ipconfig"
   Shell(bk_cmd, AppWinStyle.MaximizedFocus, True)


For detail,

http://msdn.microsoft.com/en-us/library/xe736fyk%28v=vs.71%29.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900