Sign in to follow this  
Followers 0
Tigerweld

Create folder using variable as name

5 posts in this topic

It's me again Margret, the noob. I've spent 30 minutes on trying to figure this out and I know it's gotta be simple. I've searched the forums for one like it and cannot come up with anything. What I need to do is create a folder using the varible name.

DriveMapAdd ("y:", "\\DG8BRR11\Deployment Server\rips")

$computername = regread("HKLM\SYSTEM\CONTROLSET001\CONTROL\COMPUTERNAME\COMPUTERNAME" , "COMPUTERNAME")

if not fileexists("y:\rips\$computername") then

dircreate("y:\$computername")

endif

I know I don't have it right as it is actually creating a folder called $computername. What am I missing here?

Share this post


Link to post
Share on other sites



what exactly...are you asking? :)

Share this post


Link to post
Share on other sites

It's me again Margret, the noob. I've spent 30 minutes on trying to figure this out and I know it's gotta be simple. I've searched the forums for one like it and cannot come up with anything. What I need to do is create a folder using the varible name.

DriveMapAdd ("y:", "\\DG8BRR11\Deployment Server\rips")

$computername = regread("HKLM\SYSTEM\CONTROLSET001\CONTROL\COMPUTERNAME\COMPUTERNAME" , "COMPUTERNAME")

if not fileexists("y:\rips\$computername") then

dircreate("y:\$computername")

endif

I know I don't have it right as it is actually creating a folder called $computername. What am I missing here?

$computername cant be in the quotes:

if not fileexists("y:\rips\" & $computername) then
    dircreate("y:\" & $computername)
endif

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

DriveMapAdd ("y:", "\\DG8BRR11\Deployment Server\rips")

If Not fileexists("y:\rips\" & @ComputerName) then
    DirCreate("y:\" & @ComputerName)
EndIf

That is correct syntax. Maybe that is what you are looking for?

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

MAN, I knew I was close. I got a lot to learn. Thanks guys! This is the fastest replying forum I've ever seen!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0