How to squelch the Cygwin DOS path warning

CygwinIn Cygwin version 1.7 they added a “feature” that would warn you about using DOS-style paths on the command line.

my-cygwin-pc> cd c:/<TAB>cygwin warning:
 MS-DOS style path detected: c:/
 Preferred POSIX equivalent is: /cygdrive/c
 CYGWIN environment variable option "nodosfilewarning" turns off this warning.
 Consult the user's guide for more details about POSIX paths:
 http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

At least this only happens the first time during the session, but I still wanted it gone.

So I tried to turn it off, but the instructions were a little ambiguous to me.  I tried setting a nodosfilewarning environment variable in my .cshrc.  I actually tried it several different ways:

setenv NODOSFILEWARNING 1
setenv nodosfilewarning 1
set nodosfilewarning=1

Turns out none of these are right.  You need to set a Windows environment variable named CYGWIN:

 

Mystery solved.

Tags: ,

14 Responses to “How to squelch the Cygwin DOS path warning”

  1. Johnson Says:

    Thank you very much for your chapter.My problem solved too.

  2. James Anthony Says:

    I was getting this every time I used a networked map drive.
    Thanks for the tip on turning this feature off!
    Another problem fixed indeed.

  3. Mark Baker Says:

    Thank you for documenting this, and no thank you to Cygwin for such a TERRIBLE error message.

  4. About nodosfilewarning « Smells LIke Rails Says:

    [...] to rails newbies. I was able to fix it by going to two pages. First at Ellery Chan’s Auxiliary Memory blog is the actual fix for Windows. You create a new system variable with the variable name = CYGWIN and [...]

  5. Paul Scoggan Says:

    Thanks for the tip. Worked great.

  6. Aaron Says:

    Thank you for this note!!

  7. David Elson Says:

    O.k., tiny bit more info.

    I set CYGWIN as you have describe above as a windows System environment variable, and that indeed fixed it for cygwin bash stuff … thank you for that ! It’s been a fly in my geek ointment for some time.

    However, the warning still popped up in Apache’s error.log when I did a server side include via exec cgi.

    So, in httpd.conf (or a virtual host def), I put:

    SetEnv CYGWIN nodosfilewarning

    That fixed it for this case as well.

  8. ellery Says:

    Thanks for adding that. If you are running Apache on it, you are doing far more with your Cygwin than I am with mine!

  9. Patrick van Staveren Says:

    Thanks for figuring this out – finally solves the error messages sent by all my cron jobs! Mine was quite bizarre:
    cygwin warning:
    MS-DOS style path detected: /cygdrive/c/Users/Patrick van Staveren/Downloads/
    Preferred POSIX equivalent is: /cygdrive/c/Users/Patrick van Staveren/Downloads/

  10. Martin Says:

    Great, thanks!

  11. DHAIVID3 Says:

    Genius. Thank you very much!

  12. ph Says:

    Setting an environment variable system-wide in Windows itself might work but just seems wrong. Does anyone know a place to set this just for one cygwin dll without affecting non-cygwin processes?

    You are not the only one who read the message too quickly and misinterpreted
    CYGWIN environment variable option “nodosfilewarning”
    to mean that an environment variable called nodosfilewarning needs setting, although the case should have been a clue.
    I can’t think of any other environment variable whose value consists of space separated “options”…

  13. ellery Says:

    You could set it in your .bashrc, .cshrc, .login, .profile, or other applicable startup script.

  14. Dr. Dan Says:

    Excellent! Thank you very much, you saved me a lot of headache.

Leave a Reply