Jump to content

write computername directory


 Share

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...