I am looking to place the current logged on username into a text file on the local machine. How is the best way to do this?

I am using Wise and I took a look at the WiseScript editor and it appears that I would use the 'Insert line into text file' action but I am not sure how I go about reading in the current userid.

Also, I am difficulties getting Wisescript editor to create an exe so that I can test it....It doesnt seem to compile


0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


I would probably use VBScript, but if you are going to use Wise then the value to get the currently logged on user would be [LogonUser].

Good luck.
Answered 05/25/2005 by: brenthunter2005
Fifth Degree Brown Belt

Please log in to comment
In Wisescript, you can also use the Get Registry Key Value. The last logged on user is recorded in the registry in DefaultUserName value in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon.

Insert that into your text file.
Answered 05/25/2005 by: Bladerun
Green Belt

Please log in to comment
If the format of the text file doesn't matter, you could even use the "IniFile" table. Then you wouldn't even need a custom action, and the file doesn't even have to have an ".ini" exension. Maybe something like this?

Answered 05/25/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Hello. Here is how you can do it with a batch file.

echo %username% > c:\username.txt

If you need other things in the text file, you can easily do this:

echo [Someheader] >> c:\username.txt
echo %username% >> c:\username.txt
echo [Somefooter] >> c:\username.txt

The difference between > and >> is that double greater than signs will append the file, rather than replace it.
Answered 08/25/2005 by: PowerCat
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity