Jump to content
Sign in to follow this  
AntiVirusGuy

write computer name to a file

Recommended Posts

AntiVirusGuy

how do I wruite the computer name to a file something like @computername filewrite ("file.txt") do I need to creat the file first?

Share this post


Link to post
Share on other sites
MSLx Fanboy

$fHandle = FileOpen("file.txt", 2)

FileWriteLine($fHandle, @ComputerName)

FileClose($fHandle)

FileOpen will create the file if it does not already exist. The '2' erases any previous contents of the file, and sets the pointer to the first character position in the file.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites
AntiVirusGuy

Thanks a bunch that saves me a ton of time

$fHandle = FileOpen("file.txt", 2)

FileWriteLine($fHandle, @ComputerName)

FileClose($fHandle)

FileOpen will create the file if it does not already exist.  The '2' erases any previous contents of the file, and sets the pointer to the first character position in the file.

<{POST_SNAPBACK}>

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  

×