Edit
Attach
Printable
topic end
<!-- * Set TOPICTITLE = #define private public - "Don't quote me on this", I said (03 Apr 2007) --> <style type="text/css"> pre {background-color:#ffeecc;} </style> %STARTINCLUDE% <a name="03"></a> ---+++ [[BlogEntry20070403]["Don't quote me on this", I said]] (03 Apr 2007) A [[BlogOnSoftware20060318][good while ago]], I discussed how the idiosyncratic command-line parsing rules in =cmd.exe= can hurt code which uses C runtime APIs such as [[http://msdn2.microsoft.com/en-us/library/277bwbdz(VS.71).aspx][system]], and how to soothe the pain using mildly counterintuitive, yet simple quoting rules: * Quote the command * Quote all arguments * If both the command and at least one of the arguments contain blank characters, quote the whole command line as well. This works for almost all situations except if you use [[http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx][start]]: <pre> C:\>start /b "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin\uuidgen" -ofoobar.txt </pre> Try the above in a command prompt (everything in one line!): "The system cannot find the file -ofoobar.txt". When asking for syntax help (=start /?=), we get: <verbatim> I:\>start /? 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] [parameters] "title" Title to display in window title bar. ... </verbatim> Note the optional _title_ argument and how it can create a syntactical ambiguity. In "<tt>start some command</tt>", which part of the command line is the title and which is the command? This may or may not be the reason why =start= trips over command names which contain blank characters - but the optional title argument also provides the workaround for the problem: <pre> C:\>start "eureka" /b "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin\uuidgen" -ofoobar.txt </pre> In fact, an empty title string will do just as well: <pre> C:\>start "" /b "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin\uuidgen" -ofoobar.txt </pre> The above example is a little contrived - but the problem is real; recently, it [[http://ww3.cad.de/foren/ubb/Forum15/HTML/001263.shtml][affected some customers]] when we changed installation paths for our products at <nop>CoCreate. --- %STOPINCLUDE% %COMMENT{type="below" nonotify="on"}% ---
to top
End of topic
Skip to action links
|
Back to top
Edit
|
Attach image or document
|
Printable version
|
Raw text
|
Refresh
|
More topic actions
Revisions: | r1.3 |
>
|
r1.2
|
>
|
r1.1
|
Total page history
|
Backlinks
You are here:
Blog
>
BlogEntry20070403
r1.3 - 03 Apr 2007 - 19:25 -
ClausBrod
to top
Blog
This site
2017
:
12
-
11
-
10
2016
:
10
-
7
-
3
2015
:
11
-
10
-
9
-
4
-
1
2014
:
5
2013
:
9
-
8
-
7
-
6
-
5
2012
:
2
-
10
2011
:
1
-
8
-
9
-
10
-
12
2010
:
11
-
10
-
9
-
4
2009
:
11
-
9
-
8
-
7
-
6
-
5
-
4
-
3
2008
:
5
-
4
-
3
-
1
2007:
12
-
8
-
7
-
6
-
5
-
4
-
3
-
1
2006:
4
-
3
-
2
-
1
2005:
12
-
6
-
5
-
4
2004:
12
-
11
-
10
C++
CoCreate Modeling
COM & .NET
Java
Mac
Lisp
OpenSource
Scripting
Windows
Stuff
Changes
Index
Search
Maintenance
Impressum
Datenschutzerklärung
Home
Webs
Atari
Blog
Claus
CoCreateModeling
Klassentreffen
Main
Sandbox
Sommelier
TWiki
Xplm
Jump:
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback