257

I have a Virtual Machine in Virtual PC 2007.

To start it from the desktop, I have the following command in a batch file:

"c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc "MY-PC" -launch

But that leaves a dos prompt on the host machine until the virtual machine shuts down, and I exit out of the Virtual PC console. That's annoying.

So I changed my command to use the START command, instead:

start "c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc MY-PC -launch

But it chokes on the parameters passed into Virtual PC.

START /? indicates that parameters do indeed go in that location. Has anyone used START to launch a program with multiple command-line arguments?

JosephStyons
  • 57,317
  • 63
  • 160
  • 234

12 Answers12

542

START has a peculiarity involving double quotes around the first parameter. If the first parameter has double quotes it uses that as the optional TITLE for the new window.

I believe what you want is:

start "" "c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc MY-PC -launch

In other words, give it an empty title before the name of the program to fake it out.

JosephStyons
  • 57,317
  • 63
  • 160
  • 234
Tim Farley
  • 11,720
  • 4
  • 29
  • 30
  • 2
    Is this deprecated? In Win 7 I get `Start-Process : Cannot validate argument on parameter 'FilePath'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again` – geotheory Oct 20 '14 at 12:04
  • 1
    Who would have imagined. Just the number of upvotes to your answer should be a reason enough for Microsoft to fix this 'peculiarity'. – Piyush Soni Apr 03 '15 at 17:57
  • 8
    @geotheory I realize this is an old comment, but in PowerShell, start is an alias for Start-Process. In cmd.exe (a bit antiquated, but not deprecated) "start" is different. They both are meant for starting other processes, but start is an old embedded command in cmd. – Adam Plocher May 17 '16 at 00:35
  • By chance (about URL launching from task manager) do you know the parameter to open a new tab silently when the browser is opened (without changing the current page)? – JinSnow Oct 23 '21 at 09:17
17

Instead of a batch file, you can create a shortcut on the desktop.

Set the target to:

"c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc "MY-PC" -launch

and you're all set. Since you're not starting up a command prompt to launch it, there will be no DOS Box.

Ferruccio
  • 98,941
  • 38
  • 226
  • 299
7

You can use quotes by using the [/D"Path"] use /D only for specifying the path and not the path+program. It appears that all code on the same line that follows goes back to normal meaning you don't need to separate path and file.

    start  /D "C:\Program Files\Internet Explorer\" IEXPLORE.EXE

or:

    start  /D "TITLE" "C:\Program Files\Internet Explorer\" IEXPLORE.EXE

will start IE with default web page.

    start  /D "TITLE" "C:\Program Files\Internet Explorer\" IEXPLORE.EXE www.bing.com

starts with Bing, but does not reset your home page.

/D stands for "directory" and using quotes is OK!

WRONG EXAMPLE:

    start  /D "TITLE" "C:\Program Files\Internet Explorer\IEXPLORE.EXE"

gives:

ERROR "The current directory is invalid."

/D must only be followed by a directory path. Then space and the batchfile or program you wish to start/run

Tested and works under XP but windows Vista/7/8 may need some adjustments to UAC.

-Mrbios

player0
  • 124,011
  • 12
  • 67
  • 124
Mrbios
  • 71
  • 1
  • 3
3

The spaces are DOSs/CMDs Problems so you should go to the Path via:

cd "c:\program files\Microsoft Virtual PC"

and then simply start VPC via:

start Virtual~1.exe -pc MY-PC -launch

~1 means the first exe with "Virtual" at the beginning. So if there is a "Virtual PC.exe" and a "Virtual PC1.exe" the first would be the Virtual~1.exe and the second Virtual~2.exe and so on.

Or use a VNC-Client like VirtualBox.

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
ghostdog21
  • 55
  • 1
  • 3
    This looks like a reasonable work-around, but it doesn't really address the underlying problem, which is covered by the accepted answer. – Sam Nov 11 '13 at 05:18
  • 1
    this won't work if short filenames are not enabled. I always disable 8.3 filenames in my systems – phuclv Jun 09 '17 at 00:39
3

None of these answers worked for me.

Instead, I had to use the Call command:

Call "\\Path To Program\Program.exe" <parameters>

I'm not sure this actually waits for completion... the C++ Redistributable I was installing went fast enough that it didn't matter

rene
  • 41,474
  • 78
  • 114
  • 152
1

If you want passing parameter and your .exe file in test folder of c: drive

start "parameter" "C:\test\test1.exe" -pc My Name-PC -launch

If you won't want passing parameter and your .exe file in test folder of c: drive

start "" "C:\test\test1.exe" -pc My Name-PC -launch

If you won't want passing parameter and your .exe file in test folder of H: (Any Other)drive

start "" "H:\test\test1.exe" -pc My Name-PC -launch

Mack
  • 403
  • 3
  • 11
0

The answer in "peculiarity" is correct and directly answers the question. As TimF answered, since the first parameter is in quotes, it is treated as a window title.

Also note that the Virtual PC options are being treated as options to the 'start' command itself, and are not valid for 'start'. This is true for all versions of Windows that have the 'start' command.

This problem with 'start' treating the quoted parameter as a title is even more annoying that just the posted problem. If you run this:

start "some valid command with spaces"

You get a new command prompt window, with the obvious result for a window title. Even more annoying, this new window doesn't inherit customized font, colors or window size, it's just the default for cmd.exe.

0

If you must use double quotation mark at any parameter, you can get error "'c:\somepath' is not recognized a an internal or external command, operable program or batch file". I suggest below solution when using double qoutation mark: https://stackoverflow.com/a/43467194/3835640

Community
  • 1
  • 1
Mustafa Kemal
  • 1,292
  • 19
  • 24
-1

/b parameter

start /b "" "c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc "MY-PC" -launch
phuclv
  • 37,963
  • 15
  • 156
  • 475
T.Todua
  • 53,146
  • 19
  • 236
  • 237
-4

have you tried:

start "c:\program files\Microsoft Virtual PC\Virtual PC.exe" "-pc MY-PC -launch"

?

JosephStyons
  • 57,317
  • 63
  • 160
  • 234
albertein
  • 26,396
  • 5
  • 54
  • 57
-4

Put the command inside a batch file, and call that with the parameters.

Also, did you try this yet? (Move end quote to encapsulate parameters)

start "c:\program files\Microsoft Virtual PC\Virtual PC.exe -pc MY-PC -launch"
JosephStyons
  • 57,317
  • 63
  • 160
  • 234
Mark Allen
  • 1,230
  • 1
  • 15
  • 17
-4

Change The "Virtual PC.exe" to a name without space like "VirtualPC.exe" in the folder. When you write start "path" with "" the CMD starts a new cmd window with the path as the title. Change the name to a name without space,write this on Notepad and after this save like Name.cmd or Name.bat:

CD\
CD Program Files
CD Microsoft Virtual PC
start VirtualPC.exe
timeout 2
exit

This command will redirect the CMD to the folder,start the VirualPC.exe,wait 2 seconds and exit.