diff --git a/which.c b/which.c
index 496db08..f9f609b 100644
--- a/which.c
+++ b/which.c
@@ -104,7 +104,14 @@ static char *find_command_in_path(const char *name, const char *path_list, int *
     if (abs_path)
       free(abs_path);
 
+#if defined(__MSYS__)
+    if (*name != '.' && !IS_ABSOLUTE(name) && *name != '~'
+       && !((strlen (name) > 2
+            && tolower (name[0]) >= 'a' && tolower (name[0]) <= 'z'
+            && name[1] == ':' && name[2] == '/')))
+#else
     if (*name != '.' && !IS_ABSOLUTE(name) && *name != '~')
+#endif
     {
       abs_path = (char *) xmalloc(3 + name_len);
       strcpy(abs_path, "./");
@@ -250,7 +257,14 @@ static char *path_clean_up(const char *path)
 
   int saw_slash = 0, saw_slash_dot = 0, saw_slash_dot_dot = 0;
 
+#if defined(__MSYS__)
+  if (!IS_ABSOLUTE(p1)
+      && !((strlen (p1) > 2
+           && tolower (p1[0]) >= 'a' && tolower (p1[0]) <= 'z'
+           && p1[1] == ':' && p1[2] == '/')))
+#else
   if (!IS_ABSOLUTE(p1))
+#endif
   {
     get_current_working_directory();
     strcpy(result, cwd);
