How can I open a new instance of Windows Terminal from Windows Terminal? - windows-store-apps

I'm trying to configure a profile in Windows Terminal that opens a new Windows Terminal window.
When I try to start C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_0.4.2382.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe there is an access denied error.
This is because the Windows Terminal is a Windows-Store-App (aka. Modern Windows App, aka. Mono App).
How can I start the WindowsTerminal.exe from the command line?

The Windows Terminal can be launched simply by "wt.exe".
The proof

1. Open Windows-Store-Apps from the command line
I found this answer on how to open Windows-Store-Apps: https://stackoverflow.com/a/39490206/10069673
Example:
explorer.exe shell:AppsFolder\Microsoft.WindowsAlarms_8wekyb3d8bbwe!App
2. Find the name of the app
start WindowsTerminal
open the TaskManager (ctrl+shift+esc)
expand Windows Terminal (Preview)
right click on OpenConsole.exe and select "Open file location"
File location:
C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_0.4.2382.0_x64__8wekyb3d8bbwe
Final command (remove version number in directory name):
explorer.exe shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App
3. Configure Windows Terminal profile
This is how I configured my profile.
commandline is set to the command from step 2.
icon is set to the Windows Terminal logo from the app's directory
name is self explanatory
We don't need to configure any other properties since this profile just starts a new instance of Windows Terminal with a new tab of the default profile.
{
"commandline": "explorer.exe shell:AppsFolder\\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App",
"icon": "ms-appx:///Images/LockScreenLogo.scale-100.png",
"name": "Terminal"
},
4. Final result

The simple way in 2020
Approach 1:
Press WIN key + R
Type wt -d D:\SomeDirectory and this will open up the default shell present in the settings.json with that directory
Approach 2:
Go to the desired folder using the File Explorer.
In the address bar of the desired folder type wt -d .
https://github.com/microsoft/terminal/issues/620#issuecomment-642267289

Related

Karma: use Windows' Chrome from WSL

I am trying to launch karma from WSL using the Windows version of Google Chrome.
In the karma.conf.js I simply use the Chrome browser:
[...],
browsers: ['Chrome'],
[...]
And I export the CHROME_BIN environment variable like this:
export CHROME_BIN='/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
Karma successfully find Google Chrome, and a new tab is opened at the right URL when Karma is launched. However, I get this error:
Google chrome can't read and write to its data directory /tmp/karma-XXXX
I tried starting chrome as administrator and changing the cache folder to the root of my project but it doesn't work.
I assumed there was a issue with the format of the path that Karma give to Chrome (WSL path vs Windows path).
So I create a custom karma launcher specifying the chromeDataDir:
browsers: ['WindowsChrome'],
customLaunchers: {
WindowsChrome: {
base: 'Chrome',
chromeDataDir: 'D:\\'
}
}
By doing that a I don't have the previous error, a new instance of Chrome is launched but Chrome seems unable to resolve the URL, and karma timeout.
Moreover, a lot of Chrome folders are created inside my project.
Have someone already make karma work from WSL using Chrome or have any cue on what is going on ?
I found that if you create a C:\tmp\karma folder under Windows, this error goes away, and Chrome finds and uses this folder for temp files.
You can also change the temporary folder that Chrome uses for its data by setting the TEMP environment variable like so:
export TEMP='/path/to/your/folder'
The important thing is that C:\path\to\your\folder must exist under Windows.
Now in january 2022, on WSL2, tested on debian 11/WSL under windows 11, it's "easy" :
From windows command prompt :
SET CHROME_EXECUTABLE=C:\Program Files\Google\Chrome\Application\chrome.exe
Test :
echo %CHROME_EXECUTABLE%
C:\Program Files\Google\Chrome\Application\chrome.exe
Share this Windows env variable with WSL (doc. https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/) :
set WSLENV=CHROME_EXECUTABLE/p
From Windows command prompt, enter wsl, :
wsl
Verify the env variable is ok under wsl :
echo $CHROME_EXECUTABLE
/mnt/c/Program Files/Google/Chrome/Application/chrome.exe

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.

Google Chrome Path in Windows 10

Google repeatedly changed the path to the .exe of Chrome. Sometimes it's hidden in %APPDATA%, in Version 35/36 they changed the path back to program files. There are also differencies across the Windows versions.
Where is Google Chrome located in Windows 10?
Please see the screenshot which gives you the ability to seek for the current path of google chrome path or any other application
Task Manager - Windows 10
Windows 10:
%ProgramFiles%\Google\Chrome\Application\chrome.exe
%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe
%LocalAppData%\Google\Chrome\Application\chrome.exe
Windows 7:
C:\Program Files (x86)\Google\Application\chrome.exe
Vista:
C:\Users\UserName\AppDataLocal\Google\Chrome
XP:
C:\Documents and Settings\UserName\Local Settings\Application Data\Google\Chrome
There are also Registry Keys and environment variables to use. Check out this post for universal use for programming.
Chrome can be installed in various places on Windows, for a given user or "all users", in which case it's installed in Program Files.
To determine where it is programmatically:
Batch file:
set exe=
FOR /F "tokens=2* skip=2" %%a in ('reg query HKCR\ChromeHTML\shell\open\command /ve') do set exe=%%b
set exe=%exe:"=%
set exe=%exe:~0,-6%
PowerShell:
(gp Registry::HKCR\ChromeHTML\shell\open\command)."(Default)" -match '"(.*?)"' | Out-Null
$exe=$matches[1]
C#:
var exe = System.Text.RegularExpressions.Regex.Match((string)Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(#"ChromeHTML\shell\open\command").GetValue(null),
#"""(.*?)""",
System.Text.RegularExpressions.RegexOptions.None)
.Groups[1].Value;
Python
import winreg
import re
command = winreg.QueryValueEx(winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, "ChromeHTML\\shell\open\\command", 0, winreg.KEY_READ), "")[0]
exe=re.search("\"(.*?)\"", command).group(1)
VBA / VBScript
Set objShell = CreateObject("WScript.Shell")
cmd = objShell.RegRead("HKCR\ChromeHTML\shell\open\command\")
exe = Mid(cmd, 2, 999)
exe = Left(exe, InStr(exe, Chr(34)) - 1)
The answer I am writing is applicable for any software/application installed on windows.
Windows 10
Click on windows button and search for the application, in this case Chrome.
Right click on application name and click on "Open file location".
You will reach at location of the shortcut of that application. Again right click on the application shortcut and then click on "Open file location" and you will get the path from top url/path bar of explorer or you can click on properties to get the path as shown in image.
And you will get your path for desired application from tab shown in image.
PS: Doesn't works for apps installed from windows store.
Right click on the sub process to see the open file location :
Screenshot
To find the location of Google, type the following command...
chrome://version
And then look for Command Line on the left side of the screen.
I found something in the Registry when I installed Chrome Canary at the same time.
in a batch file, using chrome.exe it always opens Canary...
then I change from:
Equipo\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
"C:\Users\heratess\AppData\Local\Google\Chrome SxS\Application\chrome.exe"
To:
Equipo\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
C:\Program Files\Google\Chrome\Application\chrome.exe
and it worked for me.
maybe it could help you.

How to open a serial terminal in Eclipse Juno?

In previous versions of Eclipse I have been able to open a view that presented a serial terminal/console.
How do I do this in Eclipse Juno?
I have a "Terminals" view open and it has text that says:
To open a terminal, right-click the Terminal subsystem under the target. Then select 'Launch Terminal' from the context menu.
I really have no idea what this is talking about and I've been using Eclipse for several years now!
Can someone shed some light on this?
EDIT:
I've discovered that the "Terminal Subsystem under the target", refers to the "Remote Systems" view. I can't find any options for a serial terminal though.
To use a serial terminal in Eclipse Juno.
1: Install the software for serial terminals:
Navigate to: Help -> Install New Software...
Dropdown list for Work with: to say Juno - http://download.eclipse.org/releases/juno
Select: Mobile and Device Development, especially Target Management Terminal which is "An ANSI (vt102) compatible Terminal including plug-ins for Serial, SSH and Telnet connections."
Click Next and anything else to finish the install ...
2: Open the view
Navigate to: Window -> Show View -> Other ... -> Terminal -> Terminal (NOTE: singular Terminal, not plural Terminals)
3: Open a terminal
The rest should be fairly obvious as the view contains icons to Connect, Disconnect, Settings, etc which are related to Serial, SSH and Telnet connections.
Under remote systems, there is "Local" and the remote connection, in my case 192.168.1.12. Click on the "+" to open subfolders. You should see the project you are working on. Right click on it. Select "Launch Terminal", the third one from the bottom.
Load up the Remote Systems perspective to connect to the server. There you will be able to open an SSH terminal.
There is an Incubator project called Local Terminal. You can install it from the Eclipse update site: http://download.eclipse.org/releases/indigo/ under General Purpose Tools->Local Terminal

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

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.