Windows: How to open a .exe in a shell window that won't close? - mysql

I've had this problem for ages, and it's SO ANNOYING.
Suppose I want to run mysqldump.exe... here's my process: Start->run, type "cmd" ... dir into directory after directory until I finally get to c:/program files/mysql/bin/then I can FINALLY call "mysqldump.exe"
I don't mind using Windows Explorer to get to c:/program files/mysql/bin, but then I can't freaking open up any of the .exe files in a shell, and I can't open up shell with the directory being that one.
How can I do this?

This is what I do for those type of commands:
Drag a copy of the "Command Prompt" shortcut onto your desktop.
Open the properties of the shortcut.
Change the Target: field to: %SystemRoot%\system32\cmd.exe /k mysqldump.exe
Change the Start in: field to: c:/program files/mysql/bin/
Hit Ok, then rename the short cut from "Command Prompt" to "Mysqldump".
Then just double click the icon whenever you need that command. The "/k" option for cmd.exe leaves the window open.

Microsoft released a powertoy for Windows XP called Open Command Prompt Here. If you're using Vista, all you need to do is hold shift and right-click.

here's my process: Start->run, type
"cmd" ... dir into directory after
directory until I finally get to
c:/program files/mysql/bin/ then I can
FINALLY call "mysqldump.exe"
Why not just the following?
c:
cd "c:/program files/mysql/bin"
mysqldump.exe
Better yet, put this in a batch file and execute it.
You can also create a shortcut for cmd.exe and set the "Start in" directory to "c:/program files/mysql/bin".

You can download an add-in so that you can right click on the folder and open a command prompt. Saves a lot of time and you say you dont mind navigating to the location.
http://download.microsoft.com/download/whistler/Install/2/WXP/EN-US/CmdHerePowertoySetup.exe

A nice little trick is that the icon in the adress bar of explorer could be dragged to a command line window and it insert the full path at your current cursor position.
It doesn't work in vista but if you SHIFT-RightClick on a folder you have an "Open Command Windows Here" option that appears.
Under xp you could have it by saving this as a .reg and executing it :
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd]
#="Open Command Prompt Here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd\command]
#="cmd.exe /k pushd %L"

Just use the explorer to navigate to the bin or any directory. then enter cmd at the address bar und hit return. the command line with start at this location.

You can do it with python:
If you don't have activepython already, download from ActiveState's Website. Next, run PythonWin and create a new script. Write the following:
from subprocess import *
Call("c://program files//mysql//bin//mysqldump.exe")
Save the script somewhere. When you want to run it, just doubleclick. There are easier ways if you like writing batch files, but Python is more succinct than even windows for this case.

Just put c:/program files/mysql/bin/ into your path...
Then you can run mysqldump.exe directly without even opening a cmd prompt by typing it into " Start > Run "

I was using the MS PowerToy for a while but moved on to the open source Open Command Prompt Shell Extension because of the key feature:
(copied verbatim from the website)
The ability to open a command prompt in the directory that you are currently in by right-clicking on any empty screen space in the directory. This eliminates the need to navigate up a level in order to open a command prompt in the current directory.
Having to actually click on a folder to open the command prompt using the MS tool was a annoyance for me... especially since I always need to run command line tools on my current directory at the time.

Related

Console command for opening files inside already opened project in PhpStorm

I've faced the problem. I use PhpStorm to edit files from FTP server using WinSCP client. In WinSCP client I've set command for using external editor. So, when I try to open php-file from remote FTP server WinSCP downloads this file in temporary file and open it using command provided by me - "C:\Program Files\JetBrains\PhpStorm 2020.1.1\bin\phpstorm64.exe" "!.!"
Earlier, when I used PhpStorm 2019 or 2018, it opened file in already opened window/project. But when I've upgraded to PhpStorm 2020, it started to open file from FTP in separate windows. It's so annoying and some functionality doesn't work in such case (auto suggestions and others).
I know that I can use built-in remote files browser within PhpStorm to view and edit remote files, but I accustomed to use separate FTP client for such purposes.
Does somebody know how to fix this problem? What console command should I use so as to open separate file in already opened window/project?
It's a LightEdit mode: https://blog.jetbrains.com/idea/2020/04/lightedit-mode/
Since 2020.2 you can use the -p (--project) option instead to force opening files in already opened project windows. For example idea -p myfile.txt. IDEA-237118
You can also permanently disable that mode by following these steps:
Invoke Help | Find Action... (or via Search Anywhere: use Double Shift and switch to Actions tab)
Search for Registry... action and select it
Once in the Registry dialog locate light.edit.file.open.enabled entry (just start typing, speed search will narrow it down) and set it to false (uncheck the box).
Not sure if IDE restart is needed (probably not).

How to open a project in PhpStorm from command line on Windows

How to open a project in PhpStorm from command line on Windows?
I tired this:
How to open a directory in PHPStorm or IntelliJ (or any JetBrains IDE) from the command line? but can't find Tools -> Create command line launcher on Windows.
I am using latest PhpStorm.
To open the current directory just run:
phpstorm64 .
If you are using git bash on Windows run:
cmd "/C phpstorm64 ."
Make sure that C:\Program Files\JetBrains\PhpStorm 2018.3.3\bin is in your environment variable PATH (it is by default after the installation)
Edit 2021:
Install Jetbrains Toolbox
Go to settings
Enable "Shell Scripts" and follow the instructions
Now you can use "phpstorm ." to open the current directory.
On macOS ( I assume on windows too) there is option to "Create Command-line Launcher". Just click that and you are good to go next time you open a terminal.
You can even specify how you would like to start "pstorm" / "phpstorm" / "ps" etc.. up to you.
Command-line launcher is currently only available fo UNIX; there is a feature request for providing it on Windows, IDEA-114307, please feel free to vote for it.
If you like to start PhpStorm from command prompt, open cmd console, cd to %PS_install_dir%/bin and run either phpstorm64.exe or phpstorm.bat, passing a path to project folder to it, like it's described in https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html. If you like to start it from any directory, add %PS_install_dir%/bin to your system %PATH%
I know this is too late, but it will help others if they need it:
if you want to open phpStorm in the current directory via cmd/Powershell, just use this command:
phpstorm64.exe .
Or if you want to open it in another directory, just use:
phpstorm64.exe YOUR_DIRECTORY_PATH
as simple as that!
go to your project using terminal
Cd myproject
and write
phpstorm64.exe
then hit enter
I see this is a little old but I wanted to supply my answer as I was grappling with this yesterday. My solution was to use cygwin.
Track down the phpstorm bin folder called something like C:\Users\UserName\AppData\Local\JetBrains\Toolbox\apps\PhpStorm\ch-0\201.7223.96\bin and add it to your windows system Path environment variable.
Next fire up a cygwin terminal and navigate into your project directory. I'm not a bash expert so I struggled to sort out the code as an alias but if you run:
crntproj=$(cygpath -w $PWD)
phpstorm.bat $crntproj
You need cygpath because simply running phpstorm.bat $PWD doesn't work as PHPStorm tries to open a folder called $PWD. I tried a bunch of variations trying to get it to open and none seemed to work.
It will fire up phpstorm with the current folder as the project path. And you now have a terminal feed from your project too.

launching putty from browser also opens up cmd.exe

I was trying to launch PUTTY from web browser while, I was able to achieve this after reading this post " http://johnsofteng.wordpress.com/2009/05/12/launch-putty-from-browser/ " but when i click on any ssh:// link both command prompt(cmd.exe) and putty.exe are opening up.I do not want command prompt(cmd.exe) to openup instead only putty.exe should launch.
The command window runs you batch file, you can achieve what you want with the following:
add start (https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true) to the batch file call to start putty, ie:
start /b "C:\Program Files\PuTTY\putty.exe" %extract%
this allows the batch file to close once putty has launched, rather than waiting for it to exit.
To prevent the command window appearing in the first place take a look at this answer https://superuser.com/a/443181 and the thread it is in in general
Use this:
CD C:\Program Files\PuTTY
start putty.exe %extract%
exit
instead of :
"C:\Program Files\PUTTY\putty.exe" %extract% exit

Open google chrome (all users installation) in kiosk mode from terminal

I execute this in order to open Google chrome in kiosk mode:
"C:\Users\Javier\AppData\Local\Google\Chrome\Application\chrome.exe" --user-data-dir=$(mktemp -d) --kiosk "url"
but, what I need to modify if google chrome is installed in Program Files(x86)? If I execute:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=$(mktemp -d) --kiosk "url"
I get an error in --user-data-dir=$(mktemp -d) sentence.
Thanks in advance.
Javier
I think there may be no elegant solution at this point. "mktemp -d" is a linux/unix command and I can't find it, or an equivalent, on windows. It may have worked at one time (I stumbled on mktemp on a microsoft development page), but on 8.1 it didn't. The error I was getting said it had to do with permissions, but that wasn't the case.
If someone could get commands in Cygwin working at the windows command prompt then maybe the above would work. Another option may be to create something for PowerShell that does the same and plug that in there.
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=c:\somedir --kiosk "some.url.here" does work though. It works from a shortcut, so it should also work from the command line, but you do lose the random temp directory.
For my case, I just wanted some websites/web-apps to default full screen (F11) from a shortcut and I'd just Alt-F4 to close, and Alt-Tab between them and the desktop. As it is, I'm thinking I'll have to make a separate data-dir for each one I want to do.
I was using the command chrome.exe --user-data-dir=$(mktemp -d) --kiosk http://someUrl/ and it was working well for over a week until I started testing my program with a limited privilege user today. I noticed that chrome process itself did not start after calling process.start() method. There were no entries in event logs to see what went wrong. After looking at your solution, I changed my program to generate a temp folder using C# command pass it as an argument and it started working. Thanks for the help. This is the simplified version of the code I use.
DirectoryInfo tempDirectory = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "Chrome" + DateTime.Now.ToString("ddMMHHmmss")));
Process process = new Process();
process.StartInfo.FileName = GetBrowserPathFromRegistry();
process.StartInfo.Arguments = String.Format("--user-data-dir={0} --kiosk {1}", tempDirectory.FullName, this.uri);
process.Start();

open access file from command line - cover all versions

I have some trouble opening access file from command line.
start "FullPath\Database.mdb" - does nothing
start "C:\Program Files\Microsoft Office\OFFICE14\MSACCESS.EXE" "FullPath\Database.mdb"
Opens the file normally
But different computers can have different versions of office, how can i cover all corners here?
If Access is installed, it usually ensures that the msaccess executable is available in the system path. Try it right now: hit Win-R, type msaccess, then press Enter.
So you can leave out the folder path in your command to start Access, and it should work on any computer where Access is properly installed.