Solved

PowerShell Tab Completion for External Commands (MSIEXEC.EXE in particular)

Posted on 2015-01-05
3
117 Views
Last Modified: 2015-01-21
When using PowerShell, either the console or ISE (as a shell - I'm not concerned with scripting for this question), how does one tab complete when using an external command so that .\ is NOT placed in front of your argument.

So my specific example is this: I am a Setup Developer. I use msiexec.exe all the time..

So to test my packages I go to (instead of CMD prompt) PowerShell and type say something like:

(assume testpackage.msi is in my current directory)

PS C:\Packages\TestPackageFolder> msiexec.exe /i  test <hit tab complete here and I get>

PS C:\Packages\TestPackageFilder> msiexec.exe /i .\testpackage.msi

Now, msiexec.exe has no idea what .\testpackage.msi means and can't find testpackage.msi - Therefore I have to backspace and delete .\ so that finally I get

PS C:\Packages\TestPackageFilder> msiexec.exe /i testpackage.msi

THAT works.

I get that PowerShell needs an absolute or relative path, but my external commands, especially msiexec.exe which is my bread and butter does not.

I tried & at the beginning of the command like:

PS C:\Packages\TestPackageFilder>  & msiexec.exe /i .\testpackage.msi

but that makes no difference - tab complete still appends .\

Going nuts.. Want to learn PowerShell and abandon CMD.exe but as you can imagine, since I run the above command probably 100 times a day I'm losing time and productivity.

Any help is appreciated! Thanks!
0
Comment
Question by:Jim Fitzgerald
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40532437
Interesting.  MsiExec does not recognise a valid path.
No, there is no way to suppress the relative path notation if using tab completion in PowerShell.
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 40532636
If you are running it strictly as a script file .ps1 then as Qlemo said you cannot. If you are actually using the cmdletbinding and using the .psm1 (module) extension then when you import your module into the powershell session you can Tab complete just like other native cmdlets.

Example
script file name get-user.psm1
function get-user
import-module .\get-user.psm1

Now when you do get-module you will see your module in the PS session

You can then Tab complete get-u >Tab = get-user

Will.
0
 

Author Closing Comment

by:Jim Fitzgerald
ID: 40562349
Thanks for confirming that this is impossible.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS - Powershell 7 81
invoke-sqlcmd help 5 34
Add server count in powershell 5 26
Exchange 2010 permissions issue 8 29
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
A brief introduction to what I consider to be the best editor for PowerShell.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question