Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Get the current username?


  • Please log in to reply
5 replies to this topic

#1 koresho

koresho

    Wayfarer

  • Active Members
  • Pip
  • 76 posts

Posted 05 November 2007 - 08:37 PM

Anyone got a way to get the current username that a script is running under?
Specifically I am trying to delete temp files.
If i do a DirRemove(@TempDir), it will remove the folder too.
I am thinking of doing:

DirRemove(@TempDir)
DirCreate("C:\Documents and Settings\[insert current user here]\Local Settings\Temp")

Edited by koresho, 05 November 2007 - 08:41 PM.








#2 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,354 posts

Posted 05 November 2007 - 08:41 PM

@UserName ?

<_<

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#3 koresho

koresho

    Wayfarer

  • Active Members
  • Pip
  • 76 posts

Posted 05 November 2007 - 08:46 PM

wow.
i feel retarded now.
Thanks a lot <_<

#4 koresho

koresho

    Wayfarer

  • Active Members
  • Pip
  • 76 posts

Posted 05 November 2007 - 08:54 PM

Okay quick thing:
Windows won't let me do that, the temp dir is a protected windows folder.
Is there an efficient method that autoscript can delete the contents of the folder but not the folder itself?

#5 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,730 posts

Posted 05 November 2007 - 09:07 PM

Okay quick thing:
Windows won't let me do that, the temp dir is a protected windows folder.
Is there an efficient method that autoscript can delete the contents of the folder but not the folder itself?

What reasoning/right do you have to delete someones temp folder? Do have any idea how many programs installed on your PC actually use the temp directory as a directory to store information?

If there is something else you are trying to get at... now would be a good time to explain.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.


#6 koresho

koresho

    Wayfarer

  • Active Members
  • Pip
  • 76 posts

Posted 05 November 2007 - 09:40 PM

heh I see what you are thinking; here is the deal.
I am making a general purpose tune-up program that handles many different functions, from fixing issues to cleaning virii to... removing temp files.
No I didn't know that a lot of programs use the Temp dir to store data; I was under the impression that what Windows cleanup does is essentially delete the entire contents of the folder.

Do you recommend against this? I certainly don't want to do anything to mess computers up.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users