|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: RE: RE: RE: RE: RE: RE: RE: global macro for system directory?
This is a windows problem.
It sounds as if your username was DW, and now is administrator. This is the default windows admin account. I would strongly suggest that you set up a new username that is not administrator. But you may think it is too late for that.
There is a way to create a junction link to the administrator home directory. In vista and win7, junction links are used to map the xp-style directory structure to newer vista structure.
As an example "c:\documents and settings" is actually a symbolic link to "c:\users"
You 'could' create a junction directory "c:\users\dw" that maps to "c:\users\adminstrator" (which would also map "c:\documents and settings\dw" to "c:\documents and settings\administrator") using the 'mklink' command from an elevated-privilege command prompt.
Here is the windows explanation:
mklink
Creates a symbolic link.
MKLINK [[/D] | [/H] | [/J]] Link Target
/D Creates a directory symbolic link. Default is a file
symbolic link.
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link specifies the new symbolic link name.
Target specifies the path (relative or absolute) that the new link
refers to.
To do this:
1. Open an elevated command window (right-click c:\windows\system32\cmd.exe and select 'run as administrator')
2. Change to the c:\users directory:
cd c:\users
3. Make a directory junction from a directory 'dw' to the 'administrator' directory:
mklink /j dw administrator
4. check the directory listing to make sure it worked correctly:
'dir' and you should see something like:
Volume in drive C has no label.
Volume Serial Number is C4D0-XXXX
01/09/2010 05:30 PM <DIR> .
01/09/2010 05:30 PM <DIR> ..
01/09/2010 05:29 PM <DIR> Administrator
07/14/2009 01:48 AM <DIR> Public
01/09/2010 05:30 PM <JUNCTION> dw [C:\Users\Administrator]
Be careful. You can do a lot of damage this way. But it will work to fix your problem.
george
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Saturday, January 09, 2010 5:20 PM
To: [email protected]
Subject: RE: st: RE: RE: RE: RE: RE: RE: RE: global macro for system directory?
Sounds more like a case for a search and replace operation in your favorite text editor than a Stata problem.
HTH
Martin
-original message-
Subject: st: RE: RE: RE: RE: RE: RE: RE: global macro for system directory?
From: David Wallace <[email protected]>
Date: 09-01-2010 23:59
I have a similar issue with migrating Stata to a new laptop and running my .do file. Can I change my hardcoded file paths in all my old .do files by specifying a macro that can reroute the filepaths used in a .do file? So if my .do file says " use "C:\Documents and Settings\DW\My Documents\thesis.dta", clear " can I specify an macro that will reroute all the "C:\Documents and Settings\DW\My Documents" part in .do files to something like "C:\Documents and Settings\administrator\Documents\" ????
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Hoffman, George
Sent: Samstag, 9. Januar 2010 05:33
To: [email protected]
Subject: st: global macro for system directory?
I recently reinstalled stata 10 on my computer with a new os (windows 7). On my old computer, I had installed in "c:\program files\stata". On the new computer, it was in "c:\program files\stata10" by default. I had previously written a bunch of ado and do files for data and log file manipulation that referenced hardcoded directories under "c:\ptogram files\stata".
I know that the sysdir command will reveal the STATA directory to be the install directory. Is there a way to retrieve that into a macro or tempvar that I can then reference from a do or ado file?
Yes, it would all work fine if I just renamed my stata install dir - but I'd rather not hardcode if possible.
Thanks,
George Hoffman
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
Get your new Email address!
Grab the Email name you've always wanted before someone else does!
http://mail.promotions.yahoo.com/newdomains/sg/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/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/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/statalist/faq
* http://www.ats.ucla.edu/stat/stata/