This is a tricky one, I have the following output:
mysqldump: Got error: 1045: Access denied for user \'root\'@\'localhost\' (using password: YES) when tr
Putting -p as the first option worked for me on Windows Server 2012R2 (in cmd.exe as Admin).
mysqldump.exe –p --user=root --databases DBname --result-file=C:\DBname.sql