PC Review


Reply
Thread Tools Rate Thread

Calling START command to invoke command with a Path containing spaces

 
 
TJT
Guest
Posts: n/a
 
      24th Mar 2005
Let's say for example that I have a directory named "D:\Test Folder" (with
an embedded space). In this folder is a bat file named test.bat. Here is
the contents of test.bat:
@echo off
echo p1=%1
echo p2=%2
echo p3=%3

If I were to execute this using the following CALL command
CALL "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm 3"
Everything works OK.

Now on the other hand if I try to execute the following START command
start "TestWindowTitle" "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm 3"
I get the following error message in the newly spawned window:
'D:\Test' is not recognized as an internal or external command,
operable program or batch file.

Can someone tell me what I'm doing wrong?

Any help would be greatly appreciated.



 
Reply With Quote
 
 
 
 
Michael D. Ober
Guest
Posts: n/a
 
      24th Mar 2005
Are you sure you have 'TestWindowTitle' in quote marks. The start command
uses the first quoted string as the window title.

Mike Ober.


"TJT" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Let's say for example that I have a directory named "D:\Test Folder" (with
> an embedded space). In this folder is a bat file named test.bat. Here is
> the contents of test.bat:
> @echo off
> echo p1=%1
> echo p2=%2
> echo p3=%3
>
> If I were to execute this using the following CALL command
> CALL "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm 3"
> Everything works OK.
>
> Now on the other hand if I try to execute the following START command
> start "TestWindowTitle" "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm

3"
> I get the following error message in the newly spawned window:
> 'D:\Test' is not recognized as an internal or external command,
> operable program or batch file.
>
> Can someone tell me what I'm doing wrong?
>
> Any help would be greatly appreciated.
>
>
>
>




 
Reply With Quote
 
TJT
Guest
Posts: n/a
 
      24th Mar 2005
Yes - it is within double-quotes "TestWindowTitle". The newly spawned
window has the correct title.
--Tom
"Michael D. Ober" <mdo.@.wakeassoc..com> wrote in message
news:(E-Mail Removed)...
> Are you sure you have 'TestWindowTitle' in quote marks. The start command
> uses the first quoted string as the window title.
>
> Mike Ober.
>
>
> "TJT" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Let's say for example that I have a directory named "D:\Test Folder"

(with
> > an embedded space). In this folder is a bat file named test.bat. Here

is
> > the contents of test.bat:
> > @echo off
> > echo p1=%1
> > echo p2=%2
> > echo p3=%3
> >
> > If I were to execute this using the following CALL command
> > CALL "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm 3"
> > Everything works OK.
> >
> > Now on the other hand if I try to execute the following START command
> > start "TestWindowTitle" "D:\Test Folder\test" "Parm 1" "Parm 2"

"Parm
> 3"
> > I get the following error message in the newly spawned window:
> > 'D:\Test' is not recognized as an internal or external command,
> > operable program or batch file.
> >
> > Can someone tell me what I'm doing wrong?
> >
> > Any help would be greatly appreciated.
> >
> >
> >
> >

>
>
>



 
Reply With Quote
 
Garry Deane
Guest
Posts: n/a
 
      25th Mar 2005
On Thu, 24 Mar 2005 14:28:34 -0500, "TJT" <(E-Mail Removed)> wrote:

>Let's say for example that I have a directory named "D:\Test Folder" (with
>an embedded space). In this folder is a bat file named test.bat. Here is
>the contents of test.bat:
>@echo off
>echo p1=%1
>echo p2=%2
>echo p3=%3
>
>If I were to execute this using the following CALL command
> CALL "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm 3"
>Everything works OK.
>
>Now on the other hand if I try to execute the following START command
> start "TestWindowTitle" "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm 3"
>I get the following error message in the newly spawned window:
>'D:\Test' is not recognized as an internal or external command,
>operable program or batch file.
>
>Can someone tell me what I'm doing wrong?
>
>Any help would be greatly appreciated.


It's START that's at fault. It get's confused when the program is
quoted then followed by more quoted strings. The easiest? fix is to
use the SFN of the program path so there's no need to quote it:

start "TestWindowTitle" D:\testfo~1\test "Parm 1" "Parm 2" "Parm 3"

Garry

 
Reply With Quote
 
Jerold Schulman
Guest
Posts: n/a
 
      25th Mar 2005

I confirm the bug.

A workaround is:

start "TestWindowTitle" /D "D:\Test Folder" test.bat "Parm 1" "Parm 2" "Parm 3"


OR

pushd "D:\Test Folder"
start "TestWindowTitle" test.bat "Parm 1" "Parm 2" "Parm 3"
popd



On Thu, 24 Mar 2005 14:28:34 -0500, "TJT" <(E-Mail Removed)> wrote:

>Let's say for example that I have a directory named "D:\Test Folder" (with
>an embedded space). In this folder is a bat file named test.bat. Here is
>the contents of test.bat:
>@echo off
>echo p1=%1
>echo p2=%2
>echo p3=%3
>
>If I were to execute this using the following CALL command
> CALL "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm 3"
>Everything works OK.
>
>Now on the other hand if I try to execute the following START command
> start "TestWindowTitle" "D:\Test Folder\test" "Parm 1" "Parm 2" "Parm 3"
>I get the following error message in the newly spawned window:
>'D:\Test' is not recognized as an internal or external command,
>operable program or batch file.
>
>Can someone tell me what I'm doing wrong?
>
>Any help would be greatly appreciated.
>
>



Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Line command for Start>Run and Regional Settings Richhall Windows XP General 2 1st Sep 2008 02:05 PM
Long Path as command-line argument in Process.Start? Vagabond Software Microsoft VB .NET 1 7th Oct 2005 03:10 AM
How do I shell the following command line or process.start it (very different command!) David Eadie Microsoft VB .NET 3 5th Apr 2005 12:21 PM
Changing Command Path In Command Prompt =?Utf-8?B?VGhlIE1vbGU=?= Windows XP Help 2 9th Feb 2004 08:11 PM
START command prompt - fails for flnm with spaces BryanC Windows XP General 2 12th Nov 2003 02:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:24 PM.