Skip to content

Commit 27b4b32

Browse files
committed
initial commit
0 parents  commit 27b4b32

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
*.csproj
35+
*.csproj.user
36+
*.ini
37+
*.config
38+
*.sln
39+
*.snk
40+
41+
bin/
42+
packages/
43+
Properties/
44+
obj/
45+
.vs/

OpenWithCmd.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using SharpShell;
2+
using SharpShell.Attributes;
3+
using SharpShell.SharpContextMenu;
4+
using System;
5+
using System.Diagnostics;
6+
using System.Runtime.InteropServices;
7+
using System.Windows.Forms;
8+
9+
namespace OpenWithCmdExt
10+
{
11+
[ComVisible(true)]
12+
[COMServerAssociation(AssociationType.DirectoryBackground)]
13+
public class OpenWithCMD : SharpContextMenu
14+
{
15+
protected override bool CanShowMenu()
16+
{
17+
return true;
18+
}
19+
20+
protected override ContextMenuStrip CreateMenu()
21+
{
22+
ContextMenuStrip menuStrip = new ContextMenuStrip();
23+
24+
ToolStripMenuItem menuItem = new ToolStripMenuItem() { Text = "Open in Command prompt" };
25+
menuItem.Click += OnClicked;
26+
27+
menuStrip.Items.Add(menuItem);
28+
return menuStrip;
29+
}
30+
31+
private void OnClicked(object sender, EventArgs e)
32+
{
33+
Process cmd = new Process();
34+
35+
cmd.StartInfo.FileName = "cmd.exe";
36+
cmd.StartInfo.WorkingDirectory = FolderPath;
37+
38+
cmd.Start();
39+
}
40+
}
41+
}

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
this windows shell extension adds an "open in Command prompt" entry to the context menu of a folder or desktop background, similar to the existing "open in Terminal" option. also you can choose either to open as admin or current user.
2+
3+
4+
the extension comes as .NET dll, so you'll have to install it using RegAsm.exe:
5+
* go to C:\Windows\Microsoft.NET\\**Framework**\\(version) on 32-bit
6+
or to C:\Windows\Microsoft.NET\\**Framework64**\\(version) on 64-bit
7+
* run in cmd:
8+
9+
```
10+
regasm OpenWithCmdExt.dll /codebase
11+
```
12+
or
13+
14+
```
15+
regasm OpenWithCmdExt.dll /c
16+
```

0 commit comments

Comments
 (0)