Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This should be it:</p> <pre><code>using System; using System.IO; using System.Diagnostics; using System.Text; using System.Runtime.InteropServices; using Microsoft.Win32; class Program { [DllImport("kernel32.dll", CharSet = CharSet.Auto)] public static extern int GetShortPathName( [MarshalAs(UnmanagedType.LPTStr)] string path, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder shortPath, int shortPathLength ); static void Main(string[] args) { string scriptDirLong = Directory.GetParent(Process.GetCurrentProcess().MainModule.FileName).FullName; StringBuilder scriptDir = new StringBuilder(255); GetShortPathName(scriptDirLong, scriptDir, 255); string logDir = @"C:\log\registry\"; string date = System.DateTime.Now.ToString("yyyyMMdd"); string time = System.DateTime.Now.ToString("HHmmss"); string ReadUsername = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\COM\Upload", "I", null); Console.WriteLine(scriptDir + "\r\n" + logDir + "\r\n" + date + "\r\n" + time); Console.ReadKey(); Process.Start("procmon.exe", "/LoadConfig '" + scriptDir.ToString() + "\\registrymonitoring.pmc' /Quiet /AcceptEula /BackingFile " + logDir + ReadUsername + "-" + date + "-" + time); } } </code></pre> <p>I don't have that registry key or procmon to hand so I'm relying on the <code>Console.WriteLine</code> to see it it's right. The only thing I couldn't figure out how to do was getting the short name, so I just imported the winapi function and used that (taken from <a href="http://csharparticles.blogspot.com/2005/07/long-and-short-file-name-conversion-in.html" rel="nofollow">here</a>).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload