gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.1KB

  1. ' Copyright (c) 2012-2020, EnterpriseDB Corporation. All rights reserved
  2. On Error Resume Next
  3. ' PostgreSQL server shortcut creation script for Windows
  4. ' Note that on Windows, the shortcuts themselves are created by the installer,
  5. ' we just hack up the various helper scripts here.
  6. Const ForReading = 1
  7. Const ForWriting = 2
  8. ' Check the command line
  9. If WScript.Arguments.Count <> 7 Then
  10. Wscript.Echo "Usage: createshortcuts_server.vbs <Major.Minor version> <Username> <Port> <Branding> <Install dir> <Data dir> <ServiceName>"
  11. Wscript.Quit 127
  12. End If
  13. strVersion = WScript.Arguments.Item(0)
  14. strUsername = WScript.Arguments.Item(1)
  15. iPort = CLng(WScript.Arguments.Item(2))
  16. strBranding = WScript.Arguments.Item(3)
  17. strInstallDir = WScript.Arguments.Item(4)
  18. strDataDir = WScript.Arguments.Item(5)
  19. strServiceName = WScript.Arguments.Item(6)
  20. Dim objShell, objFso
  21. Set objShell = WScript.CreateObject("WScript.Shell")
  22. Set objFso = WScript.CreateObject("Scripting.FileSystemObject")
  23. ' Substitute values into a file ($in)
  24. Sub FixupFile(strFile)
  25. WScript.Echo "Start FixupFile(" & strFile & ")..."
  26. WScript.Echo " Opening file for reading..."
  27. Dim objFile, strData
  28. Set objFile = objFso.OpenTextFile(strFile, ForReading)
  29. strData = objFile.ReadAll
  30. objFile.Close
  31. WScript.Echo " Closing file (reading)..."
  32. WScript.Echo " Replacing placeholders..."
  33. strData = Replace(strData, "PG_MAJOR_VERSION", strVersion)
  34. strData = Replace(strData, "PG_USERNAME", strUsername)
  35. strData = Replace(strData, "PG_PORT", iPort)
  36. strData = Replace(strData, "PG_INSTALLDIR", strInstallDir)
  37. strData = Replace(strData, "PG_DATADIR", strDataDir)
  38. strData = Replace(strData, "PG_SERVICENAME", strServiceName)
  39. WScript.Echo " Opening file for writing..."
  40. Set objFile = objFso.OpenTextFile(strFile, ForWriting)
  41. objFile.WriteLine strData
  42. objFile.Close
  43. WScript.Echo " Closing file..."
  44. WScript.Echo " End FixupFile()..."
  45. End Sub
  46. ' Fixup the scripts
  47. FixupFile strInstallDir & "\scripts\serverctl.vbs"
  48. FixupFile strInstallDir & "\scripts\runpsql.bat"
  49. WScript.Echo "createshortcuts_server.vbs ran to completion"
  50. WScript.Quit 0
上海开阖软件有限公司 沪ICP备12045867号-1