Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

I want to run few DOS commands using my web service which developed in ASP.NET (C#/VB).

I have DLL Interop.ExecuteApp.dll its work fine with 32 bit machine, but my machine has 64bit OS, and its showing error.
System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {5846D149-4160-4BCC-A19A-507442F24B03} failed due to the following error: 80040154.

Thanks in advance.
Posted
Updated 29-Feb-12 21:17pm
v2
Comments
Sergey Alexandrovich Kryukov 1-Mar-12 3:29am    
Just a note: on all systems capable of running .NET, there is no such thing as "DOS command".
--SA
prateekfgiet 1-Mar-12 3:43am    
i am able to run .net on my system.
My Requierment is, want to run dos command using my webserives ..

your Interop.ExecuteApp.dllis not registered in 64 bit machine because of which it is giving error 0x80040154. So for registering Interop.ExecuteApp.dll ina 64 bit machine you have to create a 64 bit dll and then you can register it.
 
Share this answer
 
Comments
prateekfgiet 1-Mar-12 3:28am    
Thanks Chandrakantt,

i find that dll from net,how i go for 32 to 64 bit??

or is there any other way to run dos command using asp.net app.
Chandrakantt 1-Mar-12 3:35am    
I think selecting platform to any CPU can solve your registration issue.
hi,

i have solved problem myself
by using code ..

public void ExecuteCommandSync(object command)
{
try
{
// create the ProcessStartInfo using "cmd" as the program to be run, and "/c " as the parameters.
// Incidentally, /c tells cmd that we want it to execute the command that follows, and then exit.
System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
// The following commands are needed to redirect the standard output.
//This means that it will be redirected to the Process.StandardOutput StreamReader.
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
// Do not create the black window.
procStartInfo.CreateNoWindow = true;
// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();

// Get the output into a string
string result = proc.StandardOutput.ReadToEnd();

// Display the command output.
Console.WriteLine(result);
}
catch (Exception objException)
{
// Log the exception
}
}
 
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