diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 69e0133450df3dcb32873a54726776f66005fe31..676c002e68a77e2fc4e243d8ed2ce94c073d883f 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1662,7 +1662,6 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom,
 
     return ret;
 }
-#endif /* WIN32 */
 
 static bool
 cmdConsole(vshControl *ctl, const vshCmd *cmd)
@@ -1696,6 +1695,7 @@ cleanup:
     virDomainFree(dom);
     return ret;
 }
+#endif /* WIN32 */
 
 /* "domif-setlink" command
  */