Requires Shortcut.exe from
here, put it in
C:\Scripts or edit the command file to point to where you've copied it.
MovenShortcut.cmd
Installation:Copy it somewhere.
Running:Double-click it.
@if (@CodeSection == @Batch) @then
@echo off
color 1a
setlocal EnableExtensions
setlocal DisableDelayedExpansion
echo Select SOURCE folder
for /F "delims=" %%S in ('CScript //nologo //E:JScript "%~F0"') do (
set srce=%%S
)
if "%srce%"=="" goto :End2
echo Selected folder: "%srce%"
echo Select DESTINATION folder
for /F "delims=" %%D in ('CScript //nologo //E:JScript "%~F0"') do (
set dest=%%D
)
if "%dest%"=="" goto :End2
echo Selected folder: "%dest%"
if "%srce%"=="%dest%" goto :End1
:GetExt
echo.
set /P ext=Please enter extension [eg. jpg] ENTER to exit:
if %ext%=="" goto :End2
for /r "%srce%" %%a in (*.%ext%) do (call :ProcessFile "%%~fa")
:End
set ext=
goto :GetExt
:End1
color 1c
echo **** SOURCE and DESTINATION are the same! ****
:End2
set srce=
set dest=
pause
exit
:ProcessFile
setlocal
if not exist "%dest%\%~nx1" goto :move2
:loop
set /a fileCounter+=1
set "fileName=%~n1__%filecounter%%~x1"
if exist "%dest%\%fileName%" goto :loop
move "%~1" "%dest%\%filename%"
rem Full path to Shortcut.exe
C:\Scripts\shortcut.exe /F:"%~dpn1.lnk" /A:C /T:"%dest%\%filename%"
goto :endProcessFile
:move2
move "%~1" "%dest%"
rem Full path to Shortcut.exe
C:\Scripts\shortcut.exe /F:"%~dpn1.lnk" /A:C /T:"%dest%\%~nx1"
:endProcessFile
endlocal
goto :eof
endlocal
End of Batch section
@end
// JScript section
// Creates a dialog box that enables the user to select a folder and display it.
var title = "Select a folder", rootFolder = 0x11;
var shl = new ActiveXObject("Shell.Application");
var folder = shl.BrowseForFolder(0, title, 0, rootFolder);
WScript.Stdout.WriteLine(folder ? folder.self.path : "");
File collisions will be renamed: {filename}__{number}.{ext}
So goes the theory.