Emulating cmd.exe's START command in Microsoft Powershell
I often browse through directories using the command line interface. It is sometimes times faster and provides more information than using the GUI. However, many times there are operations that are easier in the GUI. This is why I always loved CMD.exe's START command.
The START COMMAND
Starts a separate window to run a specified program or command.
START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/AFFINITY <hex affinity>] [/WAIT] [/B] [command/program]
"title" Title to display in window title bar.
path Starting directory
B Start application without creating a new window. The
application has ^C handling ignored. Unless the application
enables ^C processing, ^Break is the only way to interrupt
I The new environment will be the original environment passed
to the cmd.exe and not the current environment.
MIN Start window minimized
MAX Start window maximized
SEPARATE Start 16-bit Windows program in separate memory space
SHARED Start 16-bit Windows program in shared memory space
LOW Start application in the IDLE priority class
NORMAL Start application in the NORMAL priority class
HIGH Start application in the HIGH priority class
REALTIME Start application in the REALTIME priority class
The START command is built into the command processor and lets you launch ("start") programs. Where this command comes in handy is that if you pass it a directory path it will open that directory in a GUI window. So, when I am traversing directories in the command window and I want to open the directory in a GUI I just type "start ." and presto it opens.
The Move To Powershell
When I started using Powershell the START command no longer worked since its not part of Powershell. After a little searching I found the Invoke-Item command-let.
The Invoke-Item Command
Invokes the provider-specific default action on the specified item.
Invoke-Item [-path] <string> [-include <string>] [-exclude <string>] [-filter <string>] [-credential <PSCrede
ntial>] [-whatIf] [-confirm] [<CommonParameters>]
Invoke-Item [-literalPath] <string> [-include <string>] [-exclude <string>] [-filter <string>] [-credential <
PSCredential>] [-whatIf] [-confirm] [<CommonParameters>]
Invokes the provider-specific default action on the specified item. When applied to a file system item, for example
, it will either run the file or open it with the application associated with that file type.
This command-let doesn't behave exactly the same as START command. For example calling the command START without any parameters will spawn a new command shell however to do that with Invoke-Item you must write "Invoke-Item [path to Powershell directory]\Powershell.exe". But since the way I mainly use it still works since "Invoke-Item ." does the same thing as "START .".
After figuring this out there was one more thing I had to do. I am so used to writing "start ." that is became second nature to me therefore I needed to be able to do that in Powershell as well. So I added this line into my Powershell profile:
set-alias start Invoke-Item
Now I can write "start ." in both Powershell and cmd.exe and have it behave the way I want.