In Explorer sequence Shift+F10 -> open command window here
opens cmd in current directory.
Is there any way to do the same via shortcuts to launch cmd with administration rights?
In Explorer sequence Shift+F10 -> open command window here
opens cmd in current directory.
Is there any way to do the same via shortcuts to launch cmd with administration rights?
Complete shortcuts are listed here Link to the answer
It will set to the desired folder path
d:
, and then use the cd
command –
Lallygag I added the commands to the Explorer context menu in the registry for the background, folders, and files.
I know that you wanted a keyboard shortcut. I am hoping that you can use and adapt the commands and use the existing Windows shortcut system that allows you to set keyboard shortcuts.
Here is a link to an article that has the commands and a link to a ZIP with a REG file:
Adding to the Windows registry:
For the folder context-menu: (right-clicking on a folder in an explorer window)
powershell -WindowStyle Hidden "start cmd \"/k cd /d %1\" -v runAs"
For the background context-menu: (right-clicking on the background of an explorer window):
powershell -WindowStyle Hidden "start cmd \"/k cd /d %V\" -v runAs"
For the file context-menu: (right-clicking on a file in an Explorer window):
powershell -WindowStyle Hidden "start cmd \"/k cd /d %w\" -v runAs"
Here is a link to an article about the shell variables:
EDIT:
I added keyboard shortcuts using Shift+F10, Shift+Context menu key, or Shift-Right click, and then a given letter for the desired option, which you can modify in the registry. I put all of the files onto GitHub at the link below.
https://github.com/DKCTC/windows-terminal-admin-shortcuts-registry
cmd /c start /min "" powershell -WindowStyle Hidden "start cmd \"/k cd /d %1\" -v runAs"
You don't see the powershell window flash by using a minimized cmd to start the ps. –
Gaggle You can use powershell as well. It will be easy.
- Go to your file location
- PRESS Alt + F + S + A or Alt + f + s + a
I also needed the same so as to initiate my angular development test easier. However without running Command prompt as an administrator 'ng serve' won't work.
Had been using Git Bash for a while. Git Bash website
So I chose Gitbash to initiate the same, from the root folder of the app. [Right Clicked inside the root folder and Chose Git Bash Here]
and ran the command 'ng serve'. The build was compiled and I was able to access the port[4200].
If youre looking for a lazy solution which does not get you into powershell, you can use this nice script to run a batch file as admin. The only thing you have to do is add cmd.exe at the end. Place this batch file inside the folder you want and run it.
you can try to paste following command into .reg file and run:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\AdminOpenCmd]
@="Open CMD here admin"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\AdminOpenCmd\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""
This command could open a cmd window and change current path as admin, but this will flashed powershell window in start.
In the current folder, you can hold Alt and type F, S, A to bring up the File menu then open powerShell administrative . Alternatively, from the top menu of the current folder, you can click on "File" hover your mouse over "Open Windows powerShell," and then open an administrative PowerShell window. However, you cannot open an administrative Command Prompt (cmd) window in Windows 10 using this method.
If you require an administrative Command Prompt(cmd) instead of PowerShell, simply type "cmd" into the opened PowerShell window. This will transform the PowerShell window into an administrative Command Prompt.
You can run a script in PowerShell something like below you can just have the syntax checked and can try implementing below sample
powershell changepath.sh <path>
changepath.sh
CD $args[0]
chmod rwxrwxrwx user ...
You can open the PowerShell by holding ALT and typing S->M->A. Then in the PS type cmd to move to cmd.
© 2022 - 2024 — McMap. All rights reserved.