Process.GetCurrentProcess() : Process « System.Diagnostics « C# / C Sharp by API






Process.GetCurrentProcess()

 
using System;
using System.Diagnostics;
using System.IO;
class TestPathApp {
    static void Main(string[] args) {
        Process p = Process.GetCurrentProcess();
        ProcessModule pm = p.MainModule;
        string s = pm.ModuleName;

        Console.WriteLine(Path.GetFullPath(s));
        Console.WriteLine(Path.GetFileName(s));
        Console.WriteLine(Path.GetFileNameWithoutExtension(s));
        Console.WriteLine(Path.GetDirectoryName(Directory.GetCurrentDirectory()));
        Console.WriteLine(Path.GetPathRoot(Directory.GetCurrentDirectory()));
        Console.WriteLine(Path.GetTempPath());
        Console.WriteLine(Path.GetTempFileName());
    }
}

   
  








Related examples in the same category

1.Process.CloseMainWindow
2.Process.Exited
3.Process.GetProcessById
4.Process.Kill()
5.Process.Modules
6.Process.PeakWorkingSet64
7.Process.PriorityClass
8.Process.PrivateMemorySize
9.Process.ProcessName
10.Process.StandardOutput.ReadToEnd()
11.Process.Start
12.Process.StartInfo.RedirectStandardOutput
13.Process.Threads
14.Process.TotalProcessorTime
15.Process.VirtualMemorySize
16.Process.WaitForExit
17.Process.WorkingSet