Forum posts for Defrag.exe

Process.Start in WindowsSystem32 folder

Trying to launch a file located in System32 as administrator but it keeps telling me it doesn't exist.

Error: System can't find specified file
Build Target Platform is: x86.
Current OS: Windows 8.1 x64. I'd rather not have 2 different .exes for a 32 and 64 bit os.

p.StartInfo.Verb = 'runas';
p.StartInfo.FileName =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System),'Defrag.exe');
//above points to c:windowssystem32defrag.exe
p.StartInfo.Arguments = @'c: /A';
p.Start();
p.WaitForExit();


I have also tried the following with no luck

p.StartInfo.FileName =
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), 'sysnative', 'Defrag.exe');


Update

Switched the app from x86 to Any CPU corrected the issue

View complete forum thread with replies

Other posts related to Defrag.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

Can't call defrag from perl script on Windows 2008
C# run defrag.exe remotely
Real Time CMD Output on Windows Defrag.exe
Exitcode 6 using PsExec in Windows Service
Schedule using “at” CMD in LOOP
Process.Start in WindowsSystem32 folder
Batch File Creating Text File With Date
what the best and simplest way to find out whether a volume need defrag?
How do I create a batch script that creates a task for a specific user in the Active Directory?
C# How to Get Output from CMD (Command = “Defrag c: /U”) Before Proccess Ends.

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.