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

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"

Related

How to use a specific command in all directories?

Note: I am sorry if I posted this in the wrong stack exchange website. I have seen similar questions on this website. Please correct me if it was wrong.
So I installed VLC into the directory D:\misc\vlc and when I type "vlc" into command prompt, it starts the VLC media player. However, I want to run this "vlc" command in the directory D:\slam\ . However, every time I do that, it says that "'vlc' is not recognized as an internal or external command,
operable program or batch file.".
Is there a way to run the 'vlc' command in any directory?
Any help is appreciated.
You can add the vlc program to the PATH in Windows using the "Edit Environment Variables" dialog. Assuming Windows 10 (though this dialog is present in older versions too), here is how to add a program to the PATH:
Open the Start Search, type in “env”, and choose “Edit the system environment variables”
Click the “Environment Variables…” button.
Under the “System Variables” section (the lower half), find the row with “Path” in the first column, and click edit.
The “Edit environment variable” UI will appear. Here, you can click “New” and type in the new path you want to add. From this screen you can also edit or reorder them.
Dismiss all of the dialogs by choosing “OK”.
Your changes are saved! You will probably need to restart apps for them to pick up the change. Restarting the machine would ensure all apps are run with the PATH change.
In step 4 above, the new path that you will type is the directory containing the vlc program, e.g. "D:\misc". Note that adding this directory will also make any other programs inside of the "misc" directory accessible as well.

Path of a file in Macintosh

I'm programming on Excel-Visual Basic with a Mac, I need to charge a dll but I don't know how to specify the total path of the file, and I don't know how to find it.
For example: on Windows it works by using "C:/ ..." and separating the following documents by /.
Right click on the file in Finder
If you then hold the option button on your keyboard the Copy {filename} option in the context menu turns into Copy {filename} as Pathname
Click on that while still holding the option key and the path of the file is in your clipboard

How do I open a given directory or folder in an existing Explorer window?

I'm trying to create a shell command to open a given directory in the Explorer folder that the command is executed from.
I would add it as an entry to the right-click menu in regedit (HKCR\Directory\background\shell), but I can't figure out how to actually make the folder open in the current Explorer instance. (like the "open file location" option).
The open file location feature (COpenFileLocationMenu in shell32) is a shell extension, not a simple static command in the registry. COpenFileLocationMenu also implements IObjectWithSite.
When the IContextMenu::InvokeCommand method in COpenFileLocationMenu is called, it calls IUnknown_QueryService(..., SID_SInPlaceBrowser, IShellBrowser) on its site so it can navigate the Explorer window with IShellBrowser.
Background menu items receive the folder location in IShellExtInit::Initialize and normal menu items can use IShellBrowser::QueryActiveShellView to get the view and then find the current location...
If you don't want to write a shell extension then you have to settle for the scriptable ShellWindows object but you would have to do some guessing to find the correct window, perhaps by PInvoke'ing GetForegroundWindow from Powershell.

"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