Author Topic: Trying to create folder in "C:\Users\" directory  (Read 1926 times)

0 Members and 1 Guest are viewing this topic.

MeasureUp

  • Bull Frog
  • Posts: 436
Trying to create folder in "C:\Users\" directory
« 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.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Trying to create folder in "C:\Users\" directory
« Reply #1 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.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

MeasureUp

  • Bull Frog
  • Posts: 436
Re: Trying to create folder in "C:\Users\" directory
« Reply #2 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".
« Last Edit: December 12, 2013, 01:09:19 AM by MeasureUp »

roy_043

  • Water Moccasin
  • Posts: 1731
  • BricsCAD 18
Re: Trying to create folder in "C:\Users\" directory
« Reply #3 on: December 12, 2013, 06:13:48 AM »
Are you using double backslashes in your code?

ronjonp

  • Needs a day job
  • Posts: 7051
Re: Trying to create folder in "C:\Users\" directory
« Reply #4 on: December 12, 2013, 10:22:32 AM »
Works here: (vl-mkdir (strcat (getenv "userprofile")"\\test"))

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

dgorsman

  • Water Moccasin
  • Posts: 2400
Re: Trying to create folder in "C:\Users\" directory
« Reply #5 on: December 12, 2013, 10:32:26 AM »
UAC?
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

snownut2

  • Swamp Rat
  • Posts: 934
  • ADT 2004 - AutoCad 2011 Bricscad 19
Re: Trying to create folder in "C:\Users\" directory
« Reply #6 on: December 12, 2013, 11:06:51 AM »
UAC?

x2  (UAC is a PITA in windows 7)

MeasureUp

  • Bull Frog
  • Posts: 436
Re: Trying to create folder in "C:\Users\" directory
« Reply #7 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"?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

MP

  • Seagull
  • Posts: 17471
Re: Trying to create folder in "C:\Users\" directory
« Reply #9 on: December 12, 2013, 06:09:04 PM »
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

dgorsman

  • Water Moccasin
  • Posts: 2400
Re: Trying to create folder in "C:\Users\" directory
« Reply #10 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.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

MeasureUp

  • Bull Frog
  • Posts: 436
Re: Trying to create folder in "C:\Users\" directory
« Reply #11 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))
)

 :-)
« Last Edit: December 16, 2013, 06:57:28 PM by MeasureUp »

MeasureUp

  • Bull Frog
  • Posts: 436
Re: Trying to create folder in "C:\Users\" directory
« Reply #12 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.