Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Novel feature of -shell- under Windows


From   James Hassell <[email protected]>
To   [email protected]
Subject   st: RE: Novel feature of -shell- under Windows
Date   Mon, 12 Jul 2004 17:36:35 -0500

Roger Newson wrote:

>I think I have discovered an unwanted new feature of the -shell- command, 
>at least in the 01 July 2004 version of Stata 8.2 under Windows 2000. It 
>appears not to work when both the DOS command path and the filename are 
>enclosed in quotes.
>
>This feature of the -shell- command has partially disabled my -stcmd-
>package, which is downloadable from SSC and also shipped with official
>StatTransfer 7, but which will no longer work with filenames in quotes,
>which used to cause no problems. I personally would never define a filename
>containing spaces (and therefore necessitating quotes), but some of my
>SPSS-using collaborators do this with the .sav files which they send me.
>(As a quick and dirty fix, I suppose I always could rename these .sav
>files, substituting underscores for blanks.)

I was able to reproduce the behavior that Roger described and eventually
track down the problem. This problem occurs when the command issued to 
-shell- must be enclosed in quotation marks. In some circumstances this 
is unavoidable since the command issued to -shell- is located in a folder
such as "Program Files". 

Under Windows OS versions such as XP and 2000, commands passed to -cmd.exe-
that are quoted, require the entire command and argument list to be quoted. 
(Underneath Stata makes a call to -cmd.exe-) 

Here is a simple experiment that exploits the problem. From the Windows
-Start Menu- >> -Run- type :

        cmd.exe /c "notepad" "junk.txt"

You should find that this fails, but typing :

        cmd.exe /c ""notepad" "junk.txt""

will work. (notice the extra set of quotes)

For a temporary work around, this technique can be used with the -shell-
command. 

Example:

        . shell ""notepad" "junk 1.txt""


The work around is really only suitable for interactive use, because
the fix, which will be made available in the next executable update, 
would have the effect of breaking the work around. That is, Windows 
does not like :

        -cmd.exe /c """notepad" "junk.txt"""-



-- James
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index