Try setting "UseShellExecute" of the ProcessStartInfo object to true.
On Mar 16, 7:18 pm, P Square <[email protected]> wrote: > I'm trying to run defrag.exe inside a vb.net console app and it's > giving me an error "The system cannot find the file specified" it used > to work so i don't get the problem. Here's my code > > Dim oApp As New ProcessStartInfo > > oApp.FileName = "c:\windows\system32\defrag.exe" > oApp.Arguments = "/C" > oApp.CreateNoWindow = True > > Dim oProcess As Process = Process.Start(oApp) > > I even tried using shell command and no luck but if I enter defrag in > command prompt it works? It looks like the console app doesn't see c: > \windows\system32\defrag.exe > > Please Help !!!
