Classic Shell
http://www.classicshell.net/forum/

Open cmd window here / Cmd as admin / Open as admin buttons
http://www.classicshell.net/forum/viewtopic.php?f=8&t=6482
Page 1 of 1

Author:  Gaurav [ Fri Aug 05, 2016 9:12 am ]
Post subject:  Open cmd window here / Cmd as admin / Open as admin buttons  Topic is solved

Here is a way to add buttons to the Classic Explorer toolbar to add some useful functionality:

Open command prompt at currently open or currently selected folder:

1. Open Classic Explorer Settings
2. Make sure "Show all settings" is checked at the top and go to Toolbar Buttons tab.
3. Scroll down in the right column and add "Custom" item to left column by drag and drop from right column to left column.
4. Double click 'Custom' in left column.
5. Type this in the "Command:" field:

cmd /k pushd "%2"

6. For Tip or Label type anything you want. For example,

Open command prompt here

7. Pick an icon.
8. Click OK everywhere to save settings. Close and reopen the Explorer window.

This is how the button works:
- When a folder is selected in left/navigation/folder pane, command prompt will open there
- When a folder is selected in the right pane (files pane), command prompt will open there
- For a network path e.g. \\Windows-PC\Share1\Folder 1, it will work if the folder is selected in the right pane of Explorer
- If you have a mapped drive letter to a network share, it will work as well for navigation (left) pane and files (right) pane

Open command prompt as administrator at currently open or currently selected folder:


1. Download NirCmd, a free useful, trusted tool from here: http://www.nirsoft.net/utils/nircmd.html and copy it to your C:\Windows directory. If you are using 32-bit Windows, download 32-bit Nircmd. If 64-bit Windows, then 64-bit Nircmd.

2. Open Windows Explorer and go to C:\Program Files\Classic Shell. Create a folder called Commands.

3. Start Notepad as administrator and copy-paste this text into Notepad:
Code:
@echo off
If Defined selecteddir goto AdminCmdPrompt2 else goto AdminCmdPrompt1

:AdminCmdPrompt1
pushd %currentdir%
goto end

:AdminCmdPrompt2
pushd %selecteddir%
goto end

:End
CLS



4. Save this file as "AdminCmdPrompt.bat" in C:\Program Files\Classic Shell\Commands.
5. Open Classic Explorer Settings
6. Make sure "Show all settings" is checked at the top and go to Toolbar Buttons tab.
7. Scroll down in the right column and add "Custom" item to left column by drag and drop from right column to left column.
8. Double click 'Custom' in left column.
9. Type this in the "Command:" field:

nircmd elevate cmd /e:on /k pushd "%1" & set %selecteddir%="%2" & set %currentdir%="%1" & "%ProgramFiles%\Classic Shell\Commands\AdminCmdPrompt.bat"

10. For Tip or Label type anything you want. For example,

Open command prompt here as administrator

11. Pick an icon.
12. Click OK everywhere to save settings. Close and reopen the Explorer window.

This is how the button works:
- When a folder is selected in left/navigation/folder pane, command prompt will open there
- When a folder is selected in the right pane (files pane), command prompt will open there
- For a network path e.g. \\Windows-PC\Share1\Folder 1, it will work similarly!
- If you have a mapped drive letter to a network share, it will work similarly!

Open (any file) as administrator / Run program as administrator:


This is very useful too. For example, there might be some file in a UAC protected location which you need to modify as admin. Or run a program from Explorer as admin without context menu.

1. Download NirCmd, a free useful, trusted tool from here: http://www.nirsoft.net/utils/nircmd.html and copy it to your C:\Windows directory. If you are using 32-bit Windows, download 32-bit Nircmd. If 64-bit Windows, then 64-bit Nircmd.

2. Open Classic Explorer Settings
3. Make sure "Show all settings" is checked at the top and go to Toolbar Buttons tab.
4. Scroll down in the right column and add "Custom" item to left column by drag and drop from right column to left column.
5. Double click 'Custom' in left column.
6. Type this in the "Command:" field:

nircmd elevate "%2"
7. For Tip or Label type anything you want. For example,

Open as administrator

8. Pick an icon.
9. Click OK everywhere to save settings. Close and reopen the Explorer window.

Any item (file or folder) which you select in the right pane of Explorer can be opened as administrator. Even documents, pictures, music, videos and other file types will open with the default associated program as administrator.

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/