You need to alter the text "servername" in the BCP command to the name of your server where you want to execute the query. Also alter the text "\\servername\d$\directoryname\" into a valid and existing UNC path.
And as Jeff allready suggested: run the command from a command prompt to see if it works correctly.