First thing to understand is that for your purpose desktop is merely a regular directory with special name, under the user's home directory. For example, my desktop on my XP system is here:
c:\Documents and Settings\SAKryukov\Desktop\
For example, on Windows 7 root directory is
Users
.
In view of that, let's create a batch file to copy all files from one directory to another, through command line parameters.
@echo off
set source=%1
set dest=%2
set mask=%3 %4 %5 %6 %7 %8 %9
if "%source%"=="" goto:error
if "%dest%"=="" goto:error
if "%mask%"=="" goto:error
if NOT EXIST %source% goto:error
if NOT EXIST %dest% goto:error
if NOT EXIST %mask% goto:error
for %%f in (%source%\%mask%) do copy %%f %dest%
goto:eof
:error
echo Error: Specify all three parameters: source destination mask
Usage:
Assume the above text is save in the file
cp.exe
(warning, do not it
copy.bat
!):
First parameter: source directory, must exist
Second parameter: destination directory, must exist
More parameters: file masks delimited by blank space; at least one must exist.
cp c:\sa\source c:\sa\dest *.jpg *.tif *.bmp *.png
Attention! Do not use trailing "\" in directory name.
Now, note that typing all that is no easier than typing complete copy command. So, for one-click usage, create a new batch file with one line similar to the usage line shown above.
I recently found that batch files language in modern versions of Windows is not exactly that boring defunct stuff anymore, it's just a bit better. Even functions with parameters are supported (in rather perverted way).
—SA