In my opinion (untested) the command needs to go into a MSDOS Batch file with a ".BAT" extension. It is not a unix Shell command, it is a MSDOS command which you were typing at a "CMD" prompt.
To handle this in Shell we would need the MSDOS share "\\ser2\e$" to be mounted as a unix filesystem on a named mountpoint.