The default PowerShell is not convinient to copy/paste command output. SublimeREPL solves this problem very well; however, there's no tab-completion. This made PowerShell hard to use. Is there a way to get the tab-completion?
Keyboard shortcuts can differ, based on your configuration and OS.
Have you tried Alt+/?
Related
If you can start powershell in admin privileges with keyboard shortcut WIN+X>A, how do you exit it. Alt+F4 does not work. I have tried other possible combinations but none seems to work.
Note: I am not asking about Powershell ISE(which i can close with Alt+f4).
I am asking about the on-demand readily available terminal powershell.
To close a PowerShell window using the system menu you can use
Alt + Spacebar, C
Nearly every Windows window has this option. The Close or Exit option may differ based on the context so you'll just have try it and see.
This answer is accurate for the time of its writing but things may change.
Update: If you're using Windows Terminal, no workaround is needed: Alt-F4 works as-is.
The following therefore only applies to regular (conhost.exe) console windows.
Note:
For an ad hoc solution that uses different keys (strictly speaking, a keyboard shortcut followed by an additional, UI-language-dependent keypress), but requires no setup, see No Refunds No Returns's answer.
This answer provides a workaround that works transparently, i.e., with the original shortcut key, but it requires modification of your $PROFILE file; on the plus side, you can use the same technique to make other unavailable shortcuts available too.
It is the imported-by-default PSReadline module that prevents Alt+F4 from being effective[1].
While unloading PSReadline (Remove-Module -Force PSReadline) is an option in principle, you'll lose valuable command-line editing features if you do.
The best approach is therefore to define a Alt+F4 handler for PSReadline that emulates the default behavior:
Add the following to your $PROFILE, which sets up a PSReadline key-chord handler that uses the .SendKeys() method of the WScript.Shell COM object to send Alt+F4 to the caller's console window, which closes it:
Set-PSReadlineKeyHandler Alt+F4 -ScriptBlock {
(New-Object -ComObject WScript.Shell).SendKeys('%{F4}')
}
[1] As of v2.0.0-beta3. The longstanding underlying technical problem is explained in this GitHub issue, which also contains workarounds for other standard keyboard shortcuts, such as Ctrl+F.
I use auto-complete heavily...
When I invoke the auto-completion with tab key...
Powershell also includes any files from the current folder
or in the current path in the autocomplete list
How can I configure Powershell to ignore these files
(eg. auto-complete only with Powershell commands/functions)
There is no simple way to get the behavior you're looking for.
At best, you can define your own function named TabExpansion2 and either fully implement tab completion yourself (definitely not recommended) or filter the results returned from the default implementation of TabExpansion2.
I recall discussing this idea recently, I thought there might even be an open issue, but I didn't see it after a quick search here.
I don't know the exact history, but at one point we did implement the behavior you're wanting. It did break some tests, and I think some people preferred seeing effectively useless completions over no completions, perhaps it was reassuring that completions were still working.
At any rate, I think it's a reasonable feature request, I'd suggestion opening an issue if you can't find one.
Powershell ISE terminal has the IntelliSense feature. Is it possible to get/enable the same IntelliSense feature in VSCode powershell terminal
Many thanks
The PowerShell extension(PSReadLine) for VSCode is still in pipeline for the next Enhancement, the teams are working on it should be released soon enough.
From what I read seems like a lot of work before they can get PSReadline to coexist with the PowerShell extension's language.
As per the comment from David Wilson from the discussion
"PSReadline is not supported in the integrated console at this time. A non-trivial amount of work is needed to make PowerShell Editor Services and PSReadline play nicely together so this could take some time.
Features this will enable:
1.Ctrl+Arrow keys, etc (keyboard navigation of the input line)
2.Syntax highlighting of input text
3.Multi-line text input (writing a function definition in the console across multiple lines)"
You can follow the discussion on
https://github.com/PowerShell/vscode-powershell/issues/535
Does everything you do in the GUI in windows (i.e. through pointing, clicking and typing) have a command line equivalent, or are there some things (or maybe a lot of things) the command prompt can’t do?
FYI I'm very new to using the command line and just curious
Microsoft does not guarantee that, but it does gradually allow every changes on UI to have a related PowerShell cmdlet.
Thus, you'd better check out PowerShell, which is more related to server management, than programming.
I'm running Console2, which I believe is just an interface to windows cmd
I have a custom batch file that does most of my dirty work for me, but there are lot of commands in it now. Is there a way I can get a tap autocomplete working for it in the windows command prompt?
For example: my script is called rob.bat and it takes in a various number of arguments
It'd like to type rob set{Tab} and then have it cycle through
setup_envvars
setup_userprefs
setup_whateverothersetupscriptsIhave
Is there a way to do this?
Console2 has no special provisions for tab completion and instead relies on the program running within it to provide such features. Picture Console2 as little more than something that runs a console program hidden somewhere, regularly polls that hidden window for changes, and forwards all input to that window; this is, in essence, what's happening.
Note that Console2 does nothing special with cmd. You can run any shell within it. As for customizing tab completion, cmd offers nothing of that sort. You may be able to change this by installing clink, which has extension points for Lua code. Another option would be PowerShell, which has customizable tab completion out of the box, either by wrapping your program in a function that provides the necessary parameters, or by writing a custom TabExpansion or TabExpansion2 function.