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]

Re: st: Identify computer on which Stata is running


From   Chamara Anuranga <[email protected]>
To   [email protected]
Subject   Re: st: Identify computer on which Stata is running
Date   Thu, 17 Oct 2013 20:51:37 +0530

Hi,

It may be useful to give example. There is way of access some system
and computer properties base on creturn command. such as
dis "`c(username)'"
dis "`c(machine_type)'"
dis "`c(os)'"

These command also may helpful as Jeph pointed out. I have done a
program called expl (you can download using ssc install expl) with
help to create clickable link to open folders or files. I used loop
command to change the directory base on operation system.

Chamara

On Thu, Oct 17, 2013 at 7:06 PM, Jeph Herrin <[email protected]> wrote:
> There is a Stata macro functin -env- which returns environment variables. If
> your OS is Windows, you should be able to access the computer name via the
> environmental variable %COMPUTERNAME%. For other OSes, there should be
> something similar.
>
> hth,
> Jeph
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Chamara Anuranga
> Sent: Thursday, October 17, 2013 4:42 AM
> To: [email protected]
> Subject: Fwd: st: Identify computer on which Stata is running
>
> 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/
>
> *
> *   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