Skip to content

Instantly share code, notes, and snippets.

@dylanmei
Created September 13, 2013 19:02
Show Gist options
  • Select an option

  • Save dylanmei/6554700 to your computer and use it in GitHub Desktop.

Select an option

Save dylanmei/6554700 to your computer and use it in GitHub Desktop.
Windows Notepad replacement, in this case, sublime
1. Create an executable
using System.Collections.Generic;
using System.Diagnostics;
namespace Sublime_ifeo
{
class Program
{
static void Main(string[] args)
{
Process.Start(@"C:\Program Files\Sublime Text 2\sublime_text.exe",
string.Concat("\"", string.Join(" ", CleanArguments(args)), "\""));
}
static string[] CleanArguments(string[] args)
{
var list = new List<string>();
for (var i = 0; i < args.Length; i++)
{
if (args[i] == "-z") i++;
else list.Add(args[i]);
}
return list.ToArray();
}
}
}
2. Create Regkey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe
3. Assign REG_SZ Key Debugger = "C:\src\Spikes\Sublime-ifeo\bin\Debug\Sublime-ifeo.exe" -z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment