1.

Solve : Command vs Batch file?

Answer»

I am using the MOVE command, but running in to a problem.  If I put the command in to a Command WINDOW it works fine, but from a batch file I get errors.  Why?  I am running on a Windows 7(64 bit).

move /Y C:\#CAMS\Download\DST_exe\*.* C:\%Backup\DST\

If I use this at a DOS prompt it works great. 
If I use it in a batch file I get the messages "Cannot move multiple files to a single file"

Both folders do exist, and there are multiple files in them.

Maybe there is a better way.  What I am doing is moving file I download then extract files from (exe files and zip files)  to a different directory.  For example, all DST Files are an EXE file that is then ran and put in a 'DST_Work' folder for the DATABASE to PROCESS.  I clear the 'Work" folder, but I want to archive the files in the "DST_exe" folder.  I have 5 vendors like this.  Some are exe, some are zip, and another uses a different format.

Any advice is appreciated.

MichaelThere's a number of syntax problems with your line of code.

% needs to be escaped as %%. Better yet, you shouldn't use this character in folder or file names...

You should also surround your paths with QUOTATION marks, so the command doesn't screw up when it encounters a space.

move /Y "C:\#CAMS\Download\DST_exe\*.*" "C:\%%Backup\DST\"

If Backup is supposed to be an expanded variable, it's because you forgot the second %.

move /Y "C:\#CAMS\Download\DST_exe\*.*" "C:\%Backup%\DST\"

You see, % is USED in expanding DOS variables.



Discussion

No Comment Found