TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MeasureUp on December 11, 2013, 10:29:41 PM

Title: Trying to create folder in "C:\Users\" directory
Post by: MeasureUp on December 11, 2013, 10:29:41 PM
I have tried to create a folder in my account name in the "C:\Users\" directory without any success.
It seems that windows prevents creating folders in the "users" directory programmatically.

Any solutions?

Thanks in advance.
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: irneb on December 12, 2013, 12:52:38 AM
Some areas are limited to administrator access. So if your user account is not set to be an administrator, you might only be able to view/read those, not change them or create new files/folders inside.

Is this folder meant as some place where you want to save data? If so look into the Application Data folder.
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: MeasureUp on December 12, 2013, 01:03:13 AM
Thanks.
It is my own laptop and my account is the only administrative account.
The proposed folder destination is "C:\Users\My_Account_Name".
And yes I want to save data to that folder.

There is same problem to create new folder in"AppData".
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: roy_043 on December 12, 2013, 06:13:48 AM
Are you using double backslashes in your code?
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: ronjonp on December 12, 2013, 10:22:32 AM
Works here: (vl-mkdir (strcat (getenv "userprofile")"\\test"))
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: dgorsman on December 12, 2013, 10:32:26 AM
UAC?
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: snownut2 on December 12, 2013, 11:06:51 AM
UAC?

x2  (UAC is a PITA in windows 7)
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: MeasureUp on December 12, 2013, 05:58:06 PM
Thanks to everyone.
I need to check my code again.
I didn't use (getenv "userprofile") but a long list (strcat ...) which has more chances to make mistakes.
I don't know much about environment variables.
It's nice to talk to your guys.

Another question, what are "UAC" and "PITA"?
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: Kerry on December 12, 2013, 06:06:31 PM
http://lmgtfy.com/?q=PITA

http://bit.ly/rDgolL
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: MP on December 12, 2013, 06:09:04 PM
http://lmgtfy.com/?q=LMGTFY
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: dgorsman on December 13, 2013, 12:13:06 PM
http://lmgtfy.com/?q=LMGTFY

 :-D  Thanks.  I *really* needed that this morning.  Nothing like coming in on a Friday off to update licenses and... they don't work.
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: MeasureUp on December 15, 2013, 11:05:10 PM
Thanks to everyone again.
I like "LMGTFY" and it's fun.

A small fun piece for the holiday season:
Code: [Select]
(defun c:LMGTFY (/ GoogleIt GFY)
(setq GoogleIt (getstring T "Enter your words & let me Google that for you: "))
(setq GFY (strcat "http://lmgtfy.com/?q=" GoogleIt))
(startapp (strcat "C:/Program Files/Internet Explorer/iexplore.exe " GFY))
)

 :-)
Title: Re: Trying to create folder in "C:\Users\" directory
Post by: MeasureUp on December 16, 2013, 07:13:51 PM
BTW, according to that qusetion which I asked, there was a logical error in the "conditional statement 1" in my code:

Code: [Select]
(if (conditional statement 1)
    (create folder in C:/Users/MyName)
    (if (conditional statement 2)
        (create folder in E:/Library/Projects))
)

And There are 5 lines in the "conditional statement 1".
Now the problem is fixed.
Thanks again.