/build/static/layout/Breadcrumb_cap_w.png

Hostname needs to be change in .cfg file

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

Answers (3)

Posted by: shweta_kar 14 years ago
Blue Belt
0
Dim WshShell,cmd_line
Set WshShell = CreateObject("WScript.shell")
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%"))
objFile.Close

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.
Posted by: anonymous_9363 14 years ago
Red Belt
0
Careful! The posted script replaces every occurence of the word, which may not be the effect you want.
Posted by: ekniranjan 14 years ago
Purple Belt
0
Thanks for your reply. the .cfg file is residing in AllUsersProfile>Application Data>...\..\
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ