petermad wrote: ↑2020-06-15, 11:01 UTC
by *petermad » Mon Jun 15, 2020 13:01
I tested your script out of curiosity.
Sorry, but that error check didn't work for me.
Microsoft Windows [Version 10.0.18363.900] - Eng/Ger
To check why, I have exchanged the "(echo •)"-parts by "(ECHO err)".
cmd /k
if not exist "%P" (ECHO errA) else if exist %P%S1\ (ECHO errB) else if not *%C3==* (ECHO errC) else if %C2==%T%S1 (ECHO errD) else if %C2==%P%S1 (ECHO errE) and the rest...
It stops for me at errB , but I have no sub folders in that test folder.
By removing all of that error checks the command works for me.
cmd /c
echo Temp file for TC Extended Menu > %%TEMP%%\tc_ext.tmp && xcopy %C1 %%TEMP%%\tc_ext.tmp /H /R /K /Y && xcopy %C2 %C1 /H /R /K /Y && xcopy %%TEMP%%\tc_ext.tmp %C2 /H /R /K /Y && del %%TEMP%%\tc_ext.tmp /F /A
- - -
Here is an alternative PoSh script for an All-in-one-button command:
Code: Select all
TOTALCMD#BAR#DATA
PowerShell
$C=Get-Content '%F';if($C.count -eq 2){Rename-Item $C[0] ($C[0]+'.tmp');Rename-Item $C[1] $C[0];Rename-Item ($C[0]+'.tmp') $C[1]}else{'Select TWO items from one panel'}
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
Swap names of TWO selected files
1
-1
(this is an copy&paste Button-code)
The script:
$C=Get-Content '%F';
if($C.count -eq 2){
Rename-Item $C[0] ($C[0]+'.tmp');
Rename-Item $C[1] $C[0];
Rename-Item ($C[0]+'.tmp') $C[1]
}else{'Select TWO items from one panel'}
Me think, that would be enough code for that script (it anyway just takes the first two files from the selection):
$C=Get-Content '%F';Rename-Item $C[0] ($C[0]+'tmp');Rename-Item $C[1] $C[0];Rename-Item ($C[0]+'tmp') $C[1];
For error checking use "PowerShell -NoExit" as cmd