Assigning a shortcut to open cmd here - windows

Microsoft's powertoy is relatively well known. But it requires you to open a cmd one level above, from where you'd usually like. So I found this nice app, CmdOpenInstall (let's make the man some traffic :-) - it enables you to open cmd in the current directory.
Is there a way to assign a keyboard shortcut to the command (which appears on right click menu) ? How ?
p.s. I know this is maybe not a strict programing subject, but I still think it has more chances of being answered here then on SF.

If you find the context menu entry in the registry (I think it would be in HKEY_CLASSES_ROOT\Folder\shell somewhere), you can prefix the character you want as hotkey in that menu with a & to force it as keyboard accelerator.
But apart from that you can't (at least not without addditional tools I don't know any of) make direct keyboard shortcuts to functions in a context menu. But I think something like Menu key and another letter comes close enough in everyday use.

Here are the registry keys I use to easily open command windows. Here 'C' is the shortcut key.
To use, save to a .reg file and merge into your registry.
Windows Registry Editor Version 5.00
;Right click on folder and open up command window
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd1]
#="Open &Command Prompt Here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd1\command]
#="cmd.exe /k pushd \"%L\""
;Right click on any file and open up command window
[HKEY_CLASSES_ROOT\*\shell\cmd1]
#="Open &Command Prompt Here"
[HKEY_CLASSES_ROOT\*\shell\cmd1\command]
#="cmd.exe %1"

Related

Copy Paste in Bash on Ubuntu on Windows

How to execute a copy paste operation from Windows 10 to the Bash on Ubuntu on Windows environment?
I tried the following:
ctrl + shift + v
right click to paste
Any suggestions?
Update 2019/04/16: It seems copy/paste is now officially supported in Windows build >= 17643. Take a look at Rich Turner's answer. This can be enabled through the same settings menu described below by clicking the checkbox next to "Use Ctrl+Shift+C/V as Copy/Paste".
Another solution would be to enable "QuickEdit Mode" and then you can paste by right-clicking in the terminal.
To enable QuickEdit Mode, right-click on the toolbar (or simply click on the icon in the upper left corner), select Properties, and in the Options tab, click the checkbox next to QuickEdit Mode.
With this mode enabled, you can also copy text in the terminal by clicking and dragging. Once a selection is made, you can press Enter or right-click to copy.
To get right-click to paste to work:
Right-click on the title bar > Properties
Options tab > Edit options > enable QuickEdit Mode
At long last, we're excited to announce that we FINALLY implemented copy and paste support for Linux/WSL instances in Windows Console via CTRL + SHIFT + [C|V]!
You can enable/disable this feature in case you find a keyboard collision with a command-line app, but this should start working when you install and run any Win10 builds >= 17643. Select "Properties" from the menu to access the following dialog box.
Thanks for your patience while we re-engineered Console's internals to allow this feature to work :)
You can use AutoHotkey (third party application), the command below is good with plain alphanumeric text, however some other characters like =^"%#! are mistyped in console like bash or cmd. (In any non-console window this command works fine with all characters.)
^+v::SendRaw %clipboard%
Right-click the title bar, select context menu Edit -> Paste (until they fix the control key shortcuts)
As others have said, there is now an option for Ctrl+Shf+Vfor paste in Windows 10 Insider build #17643.
Unfortunately this isn't in my muscle memory and as a user of TTY terminals I'd like to use Shf+Ins as I do on all the Linux boxes I connect to.
This is possible on Windows 10 if you install ConEmu which wraps the terminal in a new GUI and allows Shf+Ins for paste. It also allows you to tweak the behaviour in the Properties.
The Console looks like this:
Copy options:
Paste options:
Shf+Ins works out of the box. I can't remember if you need to configure bash as one of the shells it uses but if you do, here is the task properties to add it:
Also allows tabbed Consoles (including different types, cmd.exe, powershell etc). I've been using this since early Windows 7 and in those days it made the command line on Windows usable!
Like it has been written before:
Right Click on Bash on Ubuntu on Windows Icon if you have it on a Task Bar Shortcut Icon
Click on Properties
Select Options Tab on the Properties Window
Check the QuickEditMode option
Click Apply
Now you are able to open a new Bash Terminal and just use Right-Click to paste
In order to be able to copy from Terminal, Just use CTRL+M and this will enable you to select and copy selected Text.
For pasting into Vim in the terminal (bash on ubuntu on windows):
export DISPLAY=localhost:0.0
Not sure how to copy from Vim though :-(
Alternate solution over here, my windows home version Windows Subsystem Linux terminal doesn't have the property to use Shift+Ctrl (C|V)
Use an actual linux terminal]1
Install an X-server in Windows (like X-Ming)
sudo apt install <your_favorite_terminal>
export DISPLAY=:0
fire your terminal app, I tested with xfce4-terminal and gnome-terminal
windows #ubuntu #development
For just copying (possibly long) texts to the Windows clipboard, I have found that just piping the output to clip.exe (including the .exe file extension) works fine for me. So:
$ echo "Hello World" | clip.exe
lets me paste Hello World using Ctrl-V anywhere else.
Now that I have posted this, I notice that related question Pipe from clipboard in linux subsytem for windows includes this and a command solution for pasting from the Windows clipboard as well.
you might have bash but it is still a windows window manager. Highlite some text in the bash terminal window. Right click on the title bar, select "Edit", select "Copy", Now Right Click again on the Title bar, select "Edit" , Select "Paste", Done. You should be able to Highlite text, hit "Enter" then Control V but this seems to be broken
For autohotkey users, a full answer is:
#IfWinActive ahk_class ConsoleWindowClass
^+v::SendInput %clipboard%
Which checks that you're in a console (windows or ubuntu) before pasting from the windows clipboard.
That turned out to be pretty simple. I've got it occasionally. To paste a text you simply need to right mouse button click anywhere in terminal window.

How can i add a Right Click option/options on any specific directory of window

I am creating a directory synch application in java programming application. Now i want to add share option when user right click with in a specific directory, and want to open an dynamic url on clicking that new option. Can anyone help me to find any good solution. Can anyone provide me Registry Script For this task.
An msdn resource on Extending Shortcut Menus will be good for you.
Anyway, I'd like to introduce my own "minimal" example. This opens a gnuplot's wgnuplot terminal at the right-clicked directory after choosing "Open gnuplot here" shortcut.
You can add keys into HKEY_CLASSES_ROOT\Directory\shell. I added HKEY_CLASSES_ROOT\Directory\shell\gnuplot with string (name: (Default)) Open gnuplot here, provided an icon string with the program's icon path, a LegacyEnable empty string and a command key that windows have to execute when clicking. You can reach the right clicked directory name with %V (You can find out more special variables on this Q&A thread at SU). Here's the code that creates the structure:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\gnuplot]
#="Open gnuplot here"
"Icon"="\"C:\\Windows\\icons\\wgnuplot.ico\""
"LegacyEnable"=""
[HKEY_CLASSES_ROOT\Directory\shell\gnuplot\command]
#="\"C:\\Users\\Cron\\Documents\\egyetem\\gnuplot\\bin\\pgnuplot.exe\" -e \"cd '%V'\" -persist"

Assign VBS Script to a Keyboard Shortcut

I have a very basic VBS script that I plan on using frequently on my Windows 7 machine. Is there any way I can bind it to a keyboard shortcut so I don't have to navigate to it through Explorer obnoxiously.
I realize this question does not directly pertain to programming, or even scripting for that matter, but I could not find a straight answer online or through my own experimentation. I'm sure that there is a simple solution somewhere...
Thank you for taking the time to read, and hopefully respond to my inquiry.
Evin Ugur.
Windows does have built-in support for shell shortcut keys, where a keypress is used to invoke an *.lnk file that launches your VBScript (using either cscript or wscript).
Create a shortcut file, have it invoke your VBScript file directly or run cscript or wscript with the appropriate arguments, then save it and open its Properties sheet and set a keystroke in the "Shortcut key" field (I suggest something like Ctrl+Alt+K).
Like so:
Then, whenever you press Ctrl+Alt+K, regardless of the active application, your script will be invoked.
A more heavy-duty alternative is AutoHotKey: http://www.autohotkey.com/
Just as an FYI.
I tried this and I was not able to register the hotkey when I had the Icon in a costume folder. Even if I added the hotkey, it failed to work.
Once I moved the icon to the "C:\ProgramData\Microsoft\Windows\Start Menu\Programs", the hotkey started to work.

"Open folder in Terminal" for Spotlight or Alfred

Is there any way in Spotlight to have a folder open in a Terminal window, either by providing an "Open in Terminal" option in search results, or (ideally) by holding down a key when selecting a result? Basically the same way holding down command will "Open containing folder" maybe make it so holding option (or whatever key) could "Open in Terminal".
Alternately, is there a way to setup the Alfred app so that it will always open folder search results in the Terminal? that might be even better, then I could use ctrl-space exclusively for opening folders in the Terminal and command-space (Spotlight) for everything else.
The closest thing I can find to anything like these is the "cdto" application, which adds an "Open in Terminal" button to the Finder. This is nice, but being able to do this directly from Spotlight or with a keypress would be much more convenient.
This question is old and you undoubtedly found the answer by now; for the sake of completeness: the latest version of Alfred allows one to search/navigate the filesystem from within Alfred, and take action on the folder or file found. One folder action is "Open Terminal Here", which seems to be what you are asking for.
I've found this to be the fastest method without any external tinkering.
Requirement: need to have iTerm or Terminal in the Dock:
Type the folder name into Alfred / Spotlight
Click and drag the folder that was found into the iTerm / Terminal icon in the Dock
Try this tool:
https://github.com/nmadhok/OpenInTerminal
This is a really handy tool for programmers on Mac as it lets you open the folder directly in Terminal. You can select multiple folders to open them in multiple terminal windows. You can also select files to open the parent directory in Terminal. This application works with Finder as well as without Finder which is a plus!
use this Alfred extension
https://github.com/LeEnno/alfred-terminalfinder
then just lob off the input and set it to a hotkey.. I have one to open the current finder in terminal and vice-versa
#Verboze - I'm still looking for an answer :)
Perhaps it should be migrated to stack exchange or the other one used non-programming topics, such as system administrivia. Though a case could be made that the command line is essential to programming.....
Windows has "Command Prompt Here". Linux has Nautilus' "Open In Terminal". The world's most advanced operating system has nothing (the best I can tell).
For completeness, I did look at the customizable toolbar ('drag your favorites here'; but my favorite is missing). I also found an old Action Script or Automator Script that did not work (the article was old, and it could not be followed).
I did find a program called "CD To...", but its broken. Upon opening the first terminal, the program opens two terminals. I'm not sure what other programming mistakes were made by the developer, and I really don't want to experiment.
Check this: https://github.com/miromannino/alfred-new-terminal-window
It opens a new Terminal/iTerm window in the current space.
Holding the alt key, the new window is also opened opened in the current frontmost Finder folder.
For me that is almost sufficient for my daily work!
Hope it helps!

Windows Explorer "Command Prompt Here" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I frequently find myself with a folder open in Windows, wishing to have a command prompt open with the same working directory.
I am aware of Power Toys "Command Prompt", but that only works as a context menu item on the folder, and not from inside the folder if you are already there. I know you can navigate to the parent directory, and use it from there, but if the parent has thousands of directories in it, this is not so convenient. I have tried some home-brewed batch files associated with folder actions in explorer, but those suffer from similar problems.
So, what is the quickest way to open a command prompt with a working directory of the current windows explorer folder?
My current approach: (horrible)
Alt - D, Ctrl - C (copy path)
Win - R, "cmd", Enter (start command prompt)
"cd", Space (start a change directory command)
Alt - Space, e, p (paste directory)
Enter (execute change directory)
I know there is something better! What is it?
Hold Shift while Right-Clicking a blank space in the desired folder to bring up a more verbose context menu. One of the options is Open Command Window Here. This works in Windows Vista, 7, 8, and 10. Since Windows 10 Creators Update, the option has been replaced with Open PowerShell Here. However, there are ways to enable Open Command Window Here again.
Just type "cmd" to location bar, that's it. It will start a new command prompt in current path.
This solution was confirmed to work in Windows XP, Vista, 7, 8 and 10 (including Creators Update).
Keystrokes to move the focus to the location bar:
AltD in English (pointed out by Tim Stewart in the comments)
AltE in German
Inside your current folder, simply press Shift+Alt+F --then--> Enter.
The prompt will appear with your current folder's path set.
Note: That works only in Windows 7 / Vista. What it does is that drops the "File" menu down for you, because the "Shift" key is pressed the option "Open command window here" is enabled and focused as the first available option of "File" menu. Pressing enter starts the focused option therefor the command window.
Edit:
In case you are in a folder and you already selected some of its contents (file/folder) this wont work. In that case Click on the empty area inside the folder to deselect any previously selected files and repeat.
Edit2:
Another way you can open terminal in current directory is to type cmd on file browser navigation bar where the path of current folder is written.
In order to focus with your keyboard on the navigation bar Ctrl+L. Then you can type cmd and hit Enter
Right-click the title-bar icon of the Explorer window. You'll get the current folder's context menu, where you'll find the "command window here" item.
(Note that to see that menu item, you need to have the corresponding "power toy" installed, or you can create the right registry keys yourself to add that item to folders' context menus.)
As a very quick solution I can give you this. I tested this on Windows 8.1
1- Find File and Right Click on Command Prompt on File Explorer and then add command prompt to your Quick Access Toolbar:
2- After adding it you can access the folder from here:
That will open a command prompt in there for you.
On vista and windows 7:
Alt+d -> it will put focus on the address bar of the explorer window
and then, type the name of any program you would launch using WIN+r
hit Enter
The program will start with its current directory set to that of the explorer instance.
e.g.:python, ghci, powershell, cmd, etc...
For Windows vista and Windows 7 ,to open the command prompt
1) go to folder you want to work
2)In address bar type- cmd
press enter
it will open the command prompt for that location
You can edit the registry to add the Command Prompt item to the context menu. Here are a couple of .reg files that I use.
Cmdhere.reg - for WinNT/2000/XP/Vista/7:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew]
#="Command Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]
#="cmd.exe /k cd %1"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew]
#="Command Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew\Command]
#="cmd.exe /k cd %1"
Doshere.reg - for Win9x:
REGEDIT4
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew]
#="MS-DOS Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]
#="command.com /k cd %1"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew]
#="MS-DOS Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\OpenNew\Command]
#="command.com /k cd %1"
Copy this into an empty text file and change the extension to .reg. Double-clicking on this in Windows Explorer will add these key to the registry.
I use StExBar, a Windows Explorer extension that gives you a command prompt button in explorer along with some other cool features (copy path, copy file name & more).
https://tools.stefankueng.com/StExBar.html
EDIT:
I just found out (been using it for more than a year and did not know this) that Ctrl+M will do it with StExBar. How's that for fast!
Almost the same as yours:
Alt+d, Ctrl+c
Win+r
cmd /K cd , Ctrl+v, ENTER
If that's so bothering, you could try to switch to windows explorer alternative like freecommander which has a toolbar button for that purpose.
I use a lot the "Send To" functionality.
I create my own batch (.bat) files in the shell:sendto folder and send files/folders to them using the context menu (to get there just write 'shell:sendto' in location bar).
I have scripts to perform all sort of things: send files by ftp, launch a php server in the current folder, create folders named with the current date, copy sent path to clipboard, etc.
Sorry, a bit offtopic but useful anyway.
Tried the answer given by Tough Coder in Windows 7 and it works!
Create a shortcut to cmd.exe in %HOMEDRIVE%%HOMEPATH%\Links, open its file properties and change the field 'Start at' to %1 ('Iniciar en' translated from spanish).
Now drag folders to it and you'll see the magic. It works too in all standard Open File dialogs. wow!
ps: those 'strange' tabs above in my picture are because I use Clover. I recommend it!
Use the following in command prompt to open your current location in windows explorer:
C:\your-directory> explorer .

Resources