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

st: Novel feature of -shell- under Windows


From   Roger Newson <[email protected]>
To   [email protected]
Subject   st: Novel feature of -shell- under Windows
Date   Sun, 11 Jul 2004 16:28:09 +0100

Fellow Statalisters (especially StataCorp):

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.

For instance, if the user has StatTransfer 7 installed in a folder

C:\Program Files\StatTransfer7\

and has the auto data in a file auto.dta in the local directory, then the command

shell "C:\Program Files\StatTransfer7\st" /o /y auto.dta my_auto.xls

will create a Microsoft Excel version of the auto data in the file my_auto.xls. However, the command

shell "C:\Program Files\StatTransfer7\st" /o /y auto.dta "my auto.xls"

will not create a Microsoft Excel version of the auto data in a file "my auto.xls". The problem is the quotes and not the embedded spaces in the filename (which make the quotes necessary), because the command

shell "C:\Program Files\StatTransfer7\st" /o /y auto.dta "my_auto.xls"

does not create a Microsoft Excel version of the auto data in a file my_auto.xls.

This feature of -shell- is specific to the -shell- command syntax

shell operating_system_command

because, if I simply type

shell

and open a DOS window and then, in that DOS window, type

"C:\Program Files\StatTransfer7\st" /o /y auto.dta "my auto.xls"

then a Microsoft Excel version of the -auto- data is created in the file "my auto.xls".

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.)

The new feature of -shell- is not specific to StatTransfer. In my system, WinZip lives in a folder

C:\Program Files\winzip\

If I have 2 .zip files named demo1.zip and "demo 1.zip", then the Stata command

shell "C:\Program Files\winzip\wzunzip" -e -o demo1.zip

will unzip demo.zip, but the Stata command

shell "C:\Program Files\winzip\wzunzip" -e -o "demo 1.zip"

will not unzip "demo 1.zip". Again, both DOS commands work if typed manually in a DOS window opened by the command

shell

typed in Stata without arguments.

Even more curiously, the Stata command

shell copy my_auto.xls "my auto.xls"

will work if the file my_auto.xls exists, and create a new file "my auto.xls". The Stata command

shell copy "my auto.xls" "my new auto.xls"

will also work, and create a new file "my new auto.xls". This suggests that the problem only appears if both the DOS command path and at least one filename are enclosed in quotes.

Can other users reproduce this feature? And, if so, is it likely to be permanent?

Best wishes (and thanks in advance)

Roger

--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://www.kcl-phs.org.uk/rogernewson

Opinions expressed are those of the author, not the institution.

*
* 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