/build/static/layout/Breadcrumb_cap_w.png

How To append in a file Using Wise

During Installation I need to append few values to the existing file.

For example

Two entries needs to appended during installation in the below mentioned file.

File: C:\WINDOWS\system32\drivers\etc\services

Entries:
knetd 2053/tcp
man 9535/tcp

How can we do this using WISE.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: fetgor 18 years ago
Senior Purple Belt
0
you can create a custom action, that calls a exe file created by wse script.

first create the exe file, then add it in the msi file, as a binary file then call it using a Custom action, but be aware ot also create a uninstallation script.

/fetgor
Posted by: brenthunter2005 18 years ago
Fifth Degree Brown Belt
0
Here are two vbscript custom actions that can be used:

CustomAction_AddToHostsFile
Condition: NOT Installed AND NOT REMOVE~="ALL"
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(objShell.ExpandEnvironmentStrings("%windir%") & "\SYSTEM32\Drivers\etc\services.",8)
objFile.WriteLine "knetd 2053/tcp"
objFile.WriteLine "man 9535/tcp"
objFile.Close



CustomAction_RemoveFromHostsFile
Condition: REMOVE~="ALL"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objFile = objFSO.OpenTextFile(objShell.ExpandEnvironmentStrings("%windir%") & "\System32\drivers\etc\services.", 1)
strContents = objFile.ReadAll()
objFile.Close
strOldText = "knetd 2053/tcp"
strOldText2 = "man 9535/tcp"
strNewText =""
strContents = Replace(strContents, strOldText, strNewText)
strContents = Replace(strContents, strOldText2, strNewText)
Set objFile = objFSO.OpenTextFile(objShell.ExpandEnvironmentStrings("%windir%") & "\System32\drivers\etc\services.", 2)
objFile.Write strContents
objFile.Close
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