Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: how to run do files in two computers, one with Windows XP, another with Vista


From   "Alan Neustadtl" <[email protected]>
To   [email protected]
Subject   Re: st: how to run do files in two computers, one with Windows XP, another with Vista
Date   Wed, 4 Jun 2008 07:22:12 -0400

I think Dan Weitzenfeld has proposed the easiest solution.  I do
almost exactly what he does but without testing for error return codes
(i;e; changing or "CD"ing to  a nonexistent directory.

The following will automatically change to the appropriate directory
on when your program is run on wither computer:

capture cd "C:\documents and settings\adrian\my documents\research\home"
capture cd "C:\documents and settings\adrian\my documents\research\research"

See help captrure for more information.  Essentially all output,
including error codes generated by your program is suppressed.  So, if
the first command fails, the second will be executed.  Alternatively,
if the first CD works fine, the second will fail but be ignored.

Best,
Alan

On Tue, Jun 3, 2008 at 5:30 PM, Dan Weitzenfeld
<[email protected]> wrote:
> I've been looking for a way to do this as well.  Unfortunately, c(os)
> can't distinguish between XP and Vista.
>
>
> "
>    c(os) returns a string containing "Windows", "Unix", or "MacOSX",
> depending on the operating system that you are using.  The list of
> alternatives,
>        although complete as of the date of this writing, may not be complete.
> "
>
> The best way may be to use a capture-if, along the lines of:
>
>
>
> capture cd "C:\documents and settings\adrian\my documents\research\"
> if _rc!=0 {
>            cd "[windows vista research path]"
> }
>
>
>
> On Tue, Jun 3, 2008 at 2:15 PM, Adrian de la Garza
> <[email protected]> wrote:
>>
>> Hello everyone!
>>
>> Quick question regarding running do files in two separate computers. My old laptop and my desktop both have Windows XP and I've been running my do files with lines with the following contents:
>>
>> cd "C:\documents and settings\adrian\my documents\research\"
>>
>> and I've never had any problems. Now I have a new laptop with Windows Vista and the directory where My Documents are saved no longer comes after "documents and settings"...
>>
>> what can I do in this case? Do I need to change all of my do files or is there an easier fix?
>>
>> Thank you!!
>>
>> Adrian
>>
>> _________________________________________________________________
>> It's easy to add contacts from Facebook and other social sites through Windows Live™ Messenger. Learn how.
>> https://www.invite2messenger.net/im/?source=TXT_EML_WLH_LearnHow
>> *
>> *   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/
>>
>
> *
> *   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/
>

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