diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 496ec86b45e..43f63f64da8 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -171,7 +171,7 @@ void WCMD_copy (void) { if (outpath[strlenW(outpath) - 1] == '\\') outpath[strlenW(outpath) - 1] = '\0'; attribs = GetFileAttributes(outpath); - if (attribs & FILE_ATTRIBUTE_DIRECTORY) { + if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY)) { strcatW (outpath, slashW); copyToDir = TRUE; }