Jump to content
Sign in to follow this  
wjp79

write computername directory

Recommended Posts

wjp79

Hello people

i'm new to autoit and I am having a little trouble get my script going.

I created a script that writes a text file to a directory. But the directory has to be matched with the computername.

For example the computer name is "computer1" the directory also needs to have that name -->. k:\test\computer1 <----\test.txt

Here is my script:

;variabelen

$root= "K:\beheer\domdata\" & @ComputerName & "\" <------------------------

$soft= "zsm"

;uitvoeren

FileWrite($root & $soft & ".txt", "begin bij " & @HOUR & ":" & @MIN & @CRLF)

Does anyone have a solution, or want to contribute.

Thx in advance.

Wierd Jan

Share this post


Link to post
Share on other sites
monoceres

Use DirCreate() to create the folder before creating the file:

DirCreate($root)

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
wjp79

Use DirCreate() to create the folder before creating the file:

DirCreate($root)

Too quick. Solved it.

$root= "K:\beheer\domdata\"

$soft= "zsm"

$computername= @ComputerName

DirCreate($root & @ComputerName)

FileChangeDir($root & @ComputerName)

FileWrite($soft & ".txt", "begin bij " & @HOUR & ":" & @MIN & @CRLF)

Thx for pushing me in the right direction!

Edited by wjp79

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.