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)
Please log in to answer
Posted by:
shweta_kar
14 years ago
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.
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
Posted by:
ekniranjan
14 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.