-
-
Save libraplanet/1468551 to your computer and use it in GitHub Desktop.
rexe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SETLOCAL | |
@SET PATH=C:\Windows\Microsoft.NET\Framework\v2.0.50727;%PATH% | |
@CALL cmd /k | |
@ENDLOCAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@call .\clean.bat | |
@call .\compile.bat | |
@call .\run.bat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
del rexe.exe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
csc /out:rexe.exe Program.cs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Collections.Generic; | |
class Program | |
{ | |
class NotProcessArgumentException : Exception {} | |
class PathMix | |
{ | |
string path; | |
public PathMix(string path) | |
{ | |
this.path = path; | |
} | |
public string OriginalPath | |
{ | |
get | |
{ | |
return path; | |
} | |
} | |
public string FullPath | |
{ | |
get | |
{ | |
return new Uri(path).LocalPath; | |
} | |
} | |
} | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("------------------------------------------"); | |
Console.WriteLine(" application : rexe"); | |
Console.WriteLine(" auther : takumi"); | |
Console.WriteLine(" date : 11/12/13"); | |
Console.WriteLine("------------------------------------------"); | |
try | |
{ | |
PathMix path; | |
List<Process> list = new List<Process>(); | |
//args | |
{ | |
Console.WriteLine("[args]"); | |
if(args.Length > 0) | |
{ | |
path = new PathMix(args[0]); | |
Console.WriteLine("path = " + path.FullPath + "(" + path.OriginalPath + ")"); | |
} | |
else | |
{ | |
throw new NotProcessArgumentException(); | |
} | |
Console.WriteLine(" "); | |
} | |
{ | |
Console.WriteLine("[process]"); | |
//serch | |
{ | |
foreach(Process p in Process.GetProcesses()) | |
{ | |
try | |
{ | |
if(new PathMix(p.MainModule.FileName).FullPath == path.FullPath) | |
{ | |
Console.WriteLine("fined id("+ p.Id +")"); | |
list.Add(p); | |
} | |
} | |
catch | |
{ | |
} | |
} | |
} | |
//kill | |
{ | |
foreach(Process p in list) | |
{ | |
int id = p.Id; | |
p.Kill(); | |
Console.WriteLine("killed id("+ id +")"); | |
} | |
} | |
//start | |
{ | |
Process p = new Process(); | |
p.StartInfo.FileName = path.FullPath; | |
p.Start(); | |
Console.WriteLine("started id("+ p.Id +")"); | |
} | |
} | |
} | |
catch(NotProcessArgumentException) | |
{ | |
Console.WriteLine("No Argument..."); | |
Console.WriteLine(""); | |
Console.WriteLine("[help]"); | |
Console.WriteLine("Usage: rexe [exepath]"); | |
Console.WriteLine(""); | |
Console.WriteLine("[exepath] : target execute file path."); | |
} | |
catch(Exception e) | |
{ | |
Console.WriteLine(""); | |
Console.WriteLine(e.ToString()); | |
} | |
finally | |
{ | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rexe "C:\Program Files\Panasonic\WheelPad\WheelPad.exe" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment