9

In Powershell, when you are typing in a path, using tab-completion, directories don't get a trailing (back)slash, meaning that at each level, I have to type Tab - . Is there any way to make Powershell add the trailing backslash to directories it has autocompleted, like Bash does?

2 Answers 2

3

PowerTab is an extension which adds Intellisense-like capabilities to Powershell. You may find that you like the way its pop-up lists and use of backslash and space to select completions works. It doesn't solve the problem of no trailing backslash, but the author says that the issue is with the way Powershell works.

PowerTab Cheat Sheet

3
  • I tried using it before asking this question, but I couldn't figure out how to install it, and the docs are completely lacking. Any idea how to do that?
    – tghw
    Sep 25, 2010 at 13:19
  • @tghw: Yeah, the docs are pretty bad. Unzip the file into Documents\WindowsPowerShell\Modules so you have a new directory under that called PowerTab. Then in PS do Import-Module powertab. See this for further instructions. You will get error messages (and will need to/unless you) manually create a directory and some files. Sep 25, 2010 at 15:56
  • 1
    PowerTab will not add trailing backslashes to a directory, but it does support recursive tab expansion based on typing a backslash. The reason for this is that it would break chaining of tab expansion. PowerShell will only call a new TabExpansion() if the command line has changed since the last TabExpansion(). So adding a backslash to the result would mean that you could not press <TAB> again. Oct 16, 2010 at 17:23
1

On the off-chance that someone stumbles over this in 2018:

PSReadLine is a neat module that does this and much more. Installing it is as simple as running 2 commands (In PS5 - for older versions, check the README):

Install-Module PSReadLine
Import-Module PSReadLine

With a little configuration, PSReadline can do much more advanced things, but Tab-Autocompletion, proper Ctrl-C/Ctrl-V and some other things work out of the box.

Windows 10 includes PSReadLine by default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .