How to run an executable in Windows Terminal? - windows-terminal

I want to run an executable with Windows Terminal. Something like this:
wt.exe myConsoleApp.exe
But this only opens the Terminal itself.
Making the Terminal the default for all ps1, bat and command line exe files would work too.

Update: This is now possible with:
wt myConsoleApp.exe

If you're using Windows 11:
If wt.exe does not work, check if Windows Terminal / wt.exe is enabled under "App execution aliases" (in Settings).
Go to Settings > Apps > Apps & features > App execution aliases. Check that the line containing wt.exe is checked. (click for photo)

You should include start when you want to run an executable. For example:
start wt.exe
Also note that, you should include the full file path if you are not currently on the directory of your executable file.

Related

How to create AutoHotKey which starts script (i.e .bat) using Cmder command line arguments?

I am trying to create an autohotkey which starts a script (i.e .bat):
#!g::
Run "Path\To\script\script.bat" debug
Return
The AutoHotKey works properly. However, I would like the .bat to be opened using Cmder instead of the default windows cmd.
I tried to set the Cmder as the default cmd by going to Settings-> Integration -> Default term and by checking the "Force ConEmu as default terminal for console applications", but this did not change anything in my particular case, and the script is still being ran in windows cmd.
Assuming Cmder can take a command line parameter, make it explicit:
Run "Path\To\exe\Cmder.exe Path\To\script\script.bat" debug
Else, run Cmder and then use AHK to file open the script.
EDIT: Based on OP's solution, could try:
Run "Path\To\exe\Cmder.exe /Task ""Path\To\script\script.bat debug"""
or
Run "Path\To\exe\Cmder.exe /Start ""Path\To\script"" /Task ""script.bat debug"""
The exact syntax and whether and where to surround things with quotes is tbd, but try and see.
In the end I used below script to make it work:
; Win+Alt+y - Start script
#!y::
Run "d:\cmder\Cmder.exe" "d:\somePath\FolderContainingTheBat\"
sleep 1000
send script.bat debug{enter}
Return
EDIT
Another solution for this does not involve AutoHotKey and works only with default windows cmd. I did the following:
Create a .bat file which contains the following
script.bat debug
Create shortcut for the newly created bat file and assign to it a "keyboard shortcut": Right click on the created shortcut -> Properties -> "Shortcut" tab -> Shortcut key
I made it work with this
Run, C:\path\Cmder\vendor\conemu-maximus5\ConEmu64.exe C:\path\to\script.exe

How can I launch command-line python 2.7 programs into full screen by default on Windows?

I want to launch my python programs into full screen or whenever i run it from cmd or powershell i always want to get the output into full screen. How can I do that ?
Create a shortcut for .cmd file and modify the Shortcut tab under Properties. Choose "Maximized" from Run: section.

How do you run programs in Windows terminal?

What is the windows equivalent to "./filename"
So for example I would usually compile by doing something like:
gcc -c homework1.c
gcc -o homework1 homework1.o
This would give me the executable names homework1
And for me to run the program, I would type: ( ./homework1 ) <-- ignore the parenthesis.
Usually I was write all my code in my schools Unix Shell thingy and I also compile it and run it there, but recently I think I took up all the disc space (because it says "disc quota exceeded").
Run cmd.exe
Go to where the program is example : cd C:\foder1\
Then type the program name with extension, for example : test1.exe or "test1.exe"
In windows (as in Linux) you can either run a program though a GUI interface or from a shell environment.
The GUI option is a program called Explorer, you navigate through the file system and double click executable files to run then. Executable typically have the extension '.exe' or '.bat', but there are others.
The shell environment in windows is called the 'command prompt', you can run it by going to the start menu and selecting 'run' or simply press the windows key and 'r' simultaneously. A box will popup, type 'cmd' (without the quotes) and hit enter - the command prompt should open. From there you can navigate the file system using commands like 'cd'. To run your executable type the name of the file (it should work with or without the '.exe').
A nice shortcut to open the command prompt already at a particular path, is to browse to the folder in Explorer, hold shift and then right-click the folder - the resulting context menu that pops up should have an option like 'open in command prompt'.

Perl not running in Windows 10

I've just downloaded ActivePerl for Windows 10 on my 64 bit laptop, but when I go to the command prompt, perl -v fails unless the directory is C:\Perl64\bin in which case it tells me that I have Perl 5.20.2 Copyright Larry Ullman etc, but if I try and open perl files anywhere, nothing happens, if I run perl.exe it just shows me a command window with a flashing bar and nothing happens, and when I try and run .pl programs in Eclipse it tells me predictably that because perl-v failed it won't run.
What can I do to get .pl files running?
You must create a file association between the .pl file extension and the Perl runtime.
At a command prompt type the following.
assoc .pl=PerlScript
ftype PerlScript=c:\perl\bin\perl.exe %1 %*
Choose perl.exe or wperl.exe, depending on your need to get a visible command window.
To get perl to be recognized, you must add C:\Perl64\bin to the PATH environment variable. Go to Control Panel > System > Advanced System Settings > Environment Variables. Edit the line containing PATH in the top box marked User variables for , and add ;C:\Perl64\bin (note the semicolon) to the end. Be sure not to corrupt anything that's already there.
installing perl in windows 7

Open a file from Cygwin

Is there an equivalent to OSX open command in cygwin. open opens a file with the default application for that type.
I want to do something like
$ magic-command file.xls
#excel opens as if file.xls would have been double-clicked
$ magic-command file.txt
#notepad opens as if file.txt would have been double-clicked
You get the idea?
Basically something like a "cygwin-double-click" command.
You can also use the cygwin utility:
cygstart <your file>
To make things OSX-like add the following to your bashrc
alias open='cygstart'
Don't forget to check out the man page for cygstart.
You can use the start command from the CMD like this:
cmd /c start <your file>
explorer <your file>
works too. What is nice is
explorer .
opens a windows explorer window in the current directory. But then
cygstart .
does the same thing and does more, but I find 'explorer' slightly easier to remember.
I am using Cygwin in Win7. I can run file on windows through ccygwin command line.
cygstart <your file>
when you run this command your file will open in windows.
Under the Windows command-line interpreter (cmd.exe) there is support for the start command. I know of somebody who implemented start in cygwin. You can find the page about it here.
You could also simply call cmd.exe (usually located in /cygdrive/c/windows/system32/cmd.exe) with the following arguments cmd /c "start yourfile.file"
If, like me, you are using putty to ssh locally on your windows machine to Cygwin as cmd.exe is a terrible console, you may want to change your sshd service to allow it to access the local desktop (this will only work on certain windows flavors) under the sshd windows service Logon properties.
Yes, there is an equivalent to Windows, try with xdg-open <your file>

Resources