Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5839713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:37:30+00:00 2026-05-22T11:37:30+00:00

I have a code in AutoIt that runs procmon.exe programmatically. Now I want to

  • 0

I have a code in AutoIt that runs procmon.exe programmatically. Now I want to translate the code into C# so that I can run it via Microsoft Visual Studios thus can anyone guide me to completing it ?

Code in AutoIt

{

Global $scriptDir = FileGetShortName(@ScriptDir)

Global $logDir = "C:\\log\\registry\\"

Global $date = @YEAR & @MON & @MDAY

Global $time = @HOUR & @MIN & @SEC

$ReadUsername = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\COM\Upload", "I")

Run("procmon.exe /LoadConfig " & $scriptDir 
    & "\\registrymonitoring.pmc /Quiet /AcceptEula /BackingFile "
    & $logDir & $ReadUsername & "-" & $date & "-" & $time, "", @SW_HIDE)

}

Any advice is translating it to C# ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:37:31+00:00Added an answer on May 22, 2026 at 11:37 am

    This should be it:

    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);
        }
    }
    

    I don’t have that registry key or procmon to hand so I’m relying on the Console.WriteLine 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 here).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that runs well on the simulator but as soon as I
All, Below is the code that I have written in AutoIT. $fileToWrite = FileOpen(C:\output.txt,
I have code that references a web service, and I'd like the address of
I have code that looks like the following, which works fine for displaying the
I want to have a web page that contains 3 parts: A header at
i have code that calls a broadcast receiver, in the receiver, i try to
I have code that's somewhat like this: ($i=0; $i < 100; $i++) { do
I have a PHP script that inserts data into a mysql database. The table
I have code that opens a dialog, validates, and posts a form when the
I have code that looks like this: <div id="header"> <ul class="tabs"> <li><a href="/user/view"><span class="tab">Profile</span></a></li>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.