I have a file abc.x and i want to replace a certain string within the file by another string. For eg, the file contents are :
Hello user
I want the "user" string to be replaced by the windows user accountname of the current running user. Like if my windows account name was Jack, it would be :
Hello Jack
Now i have two queries:
1. Firstly, the file i am referring to isnt a normal .txt file. However, its contents can be seen by opening it in notepad. Is it still possible to replace the string? If so, how
2. How can i obtain the current user account name?
Kindly answer these queries. examples would be of great help
Question
Captain Jack
I have a file abc.x and i want to replace a certain string within the file by another string. For eg, the file contents are :
Hello user
I want the "user" string to be replaced by the windows user accountname of the current running user. Like if my windows account name was Jack, it would be :
Hello Jack
Now i have two queries:
1. Firstly, the file i am referring to isnt a normal .txt file. However, its contents can be seen by opening it in notepad. Is it still possible to replace the string? If so, how
2. How can i obtain the current user account name?
Kindly answer these queries. examples would be of great help
Link to comment
Share on other sites
7 answers to this question
Recommended Posts