--- a/src/port/sprompt.c
+++ b/src/port/sprompt.c
@@ -60,8 +60,13 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
 	 * Do not try to collapse these into one "w+" mode file. Doesn't work on
 	 * some platforms (eg, HPUX 10.20).
 	 */
+#ifdef WIN32
+	termin = fopen("CONIN$", "r");
+	termout = fopen("CONOUT$", "w+");
+#else
 	termin = fopen(DEVTTY, "r");
 	termout = fopen(DEVTTY, "w");
+#endif
 	if (!termin || !termout
 #ifdef WIN32
 	/* See DEVTTY comment for msys */
