Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: st: Identify computer on which Stata is running


From   Chamara Anuranga <[email protected]>
To   [email protected]
Subject   Fwd: st: Identify computer on which Stata is running
Date   Thu, 17 Oct 2013 14:11:57 +0530

Dear Stefan,

Following command may useful

local folder: dir . dirs "*",respectcase
foreach comname of local folder {
dis "`comname'"
cd "`comname'"
}


What you have to do is first change the directory to C:Users as it
always in same path
cd "C:\Users\"

I think in this location you have only one folder which is the
computer name. If you have more than one you have to use if condition.
It may be possible as length of the computers name  are 4 and last
three are numbers.


regards,
Chamara




On Thu, Oct 17, 2013 at 1:21 PM, Stefan Pichler
<[email protected]> wrote:
>
> Dear Statalisters,
>
> I am running Stata on different PC's. Is there a way that Stata knows from which PC it is running and changes the directory accordingly. To be more specific I would like to to the following:
>
> if currentPC==PC1 {
> cd "C:\Users\a123"
> }
> if currentPC==PC2 {
> cd "C:\Users\b456"
> }
> if currentPC==PC3 {
> cd "C:\Users\c789"
> }
> ...
>
>
> where Stata should find out which PC I am using and set the right directory.
>
> Any advice would be greatly appreciated.
>
> Stefan
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index