That command stil works for me on win7:
Code: Select all
TOTALCMD#BAR#DATA
cmd /k
?if "%p%s"=="%c1 %c2" ((move %C1 %c1.tempfile) && (move %C2 %C1) && (move %c1.tempfile %C2)) else ((echo You must select two files!) && (echo.) && pause)
C:\Windows\system32\cmd.exe
Swap filename of both SELECTED files
-1
(that is an copy&paste-able TC-button code)
Preview:(arranged and colored)
if
"
D:\d\5b\ACTIVE~1.EXE D:\d\5b\FOTO-F~1.PNG"
==
"
D:\d\5b\ACTIVE~1.EXE D:\d\5b\FOTO-F~1.PNG" (
(move
D:\d\5b\Active_Pixels.exe D:\d\5b\ACTIVE~1.EXE.tempfile) &&
(move D:\d\5b\Foto-Freeware.png
D:\d\5b\Active_Pixels.exe) &&
(move
D:\d\5b\ACTIVE~1.EXE.tempfile D:\d\5b\Foto-Freeware.png)
) else (
(echo You must select two files!) && (echo.) && pause
)
Result:
Code: Select all
1 Datei(en) verschoben.
1 Datei(en) verschoben.
1 Datei(en) verschoben.
D:\d\5b>
File names of both selected files are swapped.
Try to disable the error-check and change every && to an single &
EDIT:
for information and clarification for other readers
That command above also works if the file names contains spaces,
as lower case %c use shortened 8.3 file name anyway, and upper case %C is correctly quoted by TC itself.
For more info about TC parameter click the {Help]-button in the open Button dialog.
if
"D:\d\5b\ACTIVE~1.EXE D:\d\5b\FOTOFR~1.PNG" ==
"D:\d\5b\ACTIVE~1.EXE D:\d\5b\FOTOFR~1.PNG" (
(move "D:\d\5b\Active Pixels.exe" D:\d\5b\ACTIVE~1.EXE.tempfile) &&
(move "D:\d\5b\Foto Freeware.png" "D:\d\5b\Active Pixels.exe") &&
(move D:\d\5b\ACTIVE~1.EXE.tempfile "D:\d\5b\Foto Freeware.png")
) else ((echo You must select two files!) && (echo.) && pause)
And about that &&-thingy:
CommandA & CommandB (the second command is run directly after the first)
CommandA && CommandB (the second command is only run if the first was successful)
For more info google for example for "Windows command prompt: CMD commands explained" by ionos com