My application package creating the .cfg file after installation and this file having the hostname information. Hostname should be changed as per the machine hostname. How can i include this in the Package? If i want to edit the .cfg file using vbscript, how can i do this? Any idea please...
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.


Dim WshShell,cmd_line
Set WshShell = CreateObject("")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile(Session.Property("INSTALLDIR") & "<location of the .cfg file", 1) ' check whether the file resides under INSTALLDIR else need to edit it
cmd_line = objFile.ReadAll
cmd_line = Replace(cmd_line, "<HostName>", WshShell .ExpandEnvironmentStrings("%COMPUTERNAME%"))

Note:<Provide the name which you want to replace it value with ,this will replace wherever the value of Hostname to %COMPUTERNAME% to get the desired result.
Answered 09/28/2010 by: shweta_kar
Blue Belt

Please log in to comment
Careful! The posted script replaces every occurence of the word, which may not be the effect you want.
Answered 09/29/2010 by: VBScab
Red Belt

Please log in to comment
Thanks for your reply. the .cfg file is residing in AllUsersProfile>Application Data>...\..\
Answered 09/29/2010 by: ekniranjan
Purple Belt

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