diff --git a/src/bin/initdb/Makefile b/src/bin/initdb/Makefile
index 094c894..122c2e2 100644
--- a/src/bin/initdb/Makefile
+++ b/src/bin/initdb/Makefile
@@ -17,6 +17,7 @@ top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
 override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone $(CPPFLAGS)
+LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils -lpq
 
 # use system timezone data?
 ifneq (,$(with_system_tzdata))
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index a978bbc..0c2262d 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -67,6 +67,7 @@
 #include "getaddrinfo.h"
 #include "getopt_long.h"
 #include "miscadmin.h"
+#include "fe_utils/string_utils.h"
 
 
 /* Define PG_FLUSH_DATA_WORKS if we have an implementation for pg_flush_data */
@@ -332,10 +333,8 @@ do { \
 } while (0)
 
 #ifndef WIN32
-#define QUOTE_PATH	""
 #define DIR_SEP "/"
 #else
-#define QUOTE_PATH	"\""
 #define DIR_SEP "\\"
 #endif
 
@@ -3360,6 +3359,8 @@ main(int argc, char *argv[])
 	int			option_index;
 	char	   *effective_user;
 	char		bin_dir[MAXPGPATH];
+	PQExpBuffer	start_db_cmd;
+	PQExpBuffer	pg_ctl_path;
 
 	/*
 	 * Ensure that buffering behavior of stdout and stderr matches what it is
@@ -3591,10 +3592,33 @@ main(int argc, char *argv[])
 	strlcpy(bin_dir, argv[0], sizeof(bin_dir));
 	get_parent_directory(bin_dir);
 
+	/*
+	 * Build up a shell command to tell the user how to start the server e.g.
+	 * '/path/to/pg_ctl' -D '/path/to/data_dir' -l logfile start
+	 */
+	pg_ctl_path = createPQExpBuffer();
+	start_db_cmd = createPQExpBuffer();
+
+	printfPQExpBuffer(pg_ctl_path, "%s%spg_ctl",
+					  bin_dir,
+					  (strlen(bin_dir) > 0) ? DIR_SEP : "");
+
+	/* path to pg_ctl, properly quoted */
+	appendShellString(start_db_cmd, pg_ctl_path->data);
+
+	appendPQExpBufferStr(start_db_cmd, " -D ");
+
+	/* and data directory, quoted as well */
+	appendShellString(start_db_cmd, pgdata_native);
+
+	appendPQExpBufferStr(start_db_cmd, " -l logfile start");
+
 	printf(_("\nSuccess. You can now start the database server using:\n\n"
-			 "    %s%s%spg_ctl%s -D %s%s%s -l logfile start\n\n"),
-	   QUOTE_PATH, bin_dir, (strlen(bin_dir) > 0) ? DIR_SEP : "", QUOTE_PATH,
-		   QUOTE_PATH, pgdata_native, QUOTE_PATH);
+			 "	  %s\n\n"),
+		   start_db_cmd->data);
+
+	destroyPQExpBuffer(pg_ctl_path);
+	destroyPQExpBuffer(start_db_cmd);
 
 	return 0;
 }
