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.

58 lines
1.8KB

  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 <> 2 Then
  10. Wscript.Echo "Usage: createshortcuts_clt.vbs <Branding> <Install dir>"
  11. Wscript.Quit 127
  12. End If
  13. strUsername = "postgres"
  14. iPort ="5432"
  15. strBranding = WScript.Arguments.Item(0)
  16. strInstallDir = WScript.Arguments.Item(1)
  17. Dim objShell, objFso
  18. Set objShell = WScript.CreateObject("WScript.Shell")
  19. Set objFso = WScript.CreateObject("Scripting.FileSystemObject")
  20. ' Substitute values into a file ($in)
  21. Sub FixupFile(strFile)
  22. WScript.Echo "Start FixupFile(" & strFile & ")..."
  23. WScript.Echo " Opening file for reading..."
  24. Dim objFile, strData
  25. Set objFile = objFso.OpenTextFile(strFile, ForReading)
  26. strData = objFile.ReadAll
  27. objFile.Close
  28. WScript.Echo " Closing file (reading)..."
  29. WScript.Echo " Replacing placeholders..."
  30. strData = Replace(strData, "PG_MAJOR_VERSION", strVersion)
  31. strData = Replace(strData, "PG_USERNAME", strUsername)
  32. strData = Replace(strData, "PG_PORT", iPort)
  33. strData = Replace(strData, "PG_INSTALLDIR", strInstallDir)
  34. strData = Replace(strData, "PG_SERVICENAME", strServiceName)
  35. WScript.Echo " Opening file for writing..."
  36. Set objFile = objFso.OpenTextFile(strFile, ForWriting)
  37. objFile.WriteLine strData
  38. objFile.Close
  39. WScript.Echo " Closing file..."
  40. WScript.Echo " End FixupFile()..."
  41. End Sub
  42. ' Fixup the scripts
  43. FixupFile strInstallDir & "\scripts\runpsql.bat"
  44. WScript.Echo "createshortcuts_clt.vbs ran to completion"
  45. WScript.Quit 0
上海开阖软件有限公司 沪ICP备12045867号-1