create a button to copy a given file

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
emmaleixa
Junior Member
Junior Member
Posts: 7
Joined: 2011-02-27, 19:03 UTC

create a button to copy a given file

Post by *emmaleixa »

I have been an "end user" of Total Commander since I was WIndows Commander ...
However, I don't know much about programming and more complicated details.
I was wondering if it is possible to create a button that copies a given file to a given path.
example: I have the file "prefs.js" that I need to copy from a certain directory to another; but without having to go to the two subdirectories ...
Is it possible to generate this copy action on a button?
If I put "cm_copy" it does not allow me to insert parameters ...

Thankful!!

happy New Year!!

Translated by google
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: create a button to copy a given file

Post by *Stefan2 »

Just use MS-DOS commands, like COPY or better the newer xCopy.

First, start a new instance of the command interpreter, Cmd.exe.
Try the xcopy command there:
xCOPY "D:\rive\path to\source.txt" "D:\rive\targetFolder\"
xCOPY "source.txt" "newNonExistentSubFolder\"
xCOPY "source.txt" "newFileWithoutExtension"

- - -

Next, create an button:

- Utilize “Configuration > Button bar…”

- In the "Change button bar" dialog, click "Add", then fill in the properties as follows:
Command: cmd /k
Parameters: xCOPY "D:\rive\path to\source.txt" "D:\rive\targetFolder\"
Start path: <leave empty>
Icon file: f.ex.: WCMICONS.DLL
Tooltip: your text


Take care on correct "..." quoting.
Enable "[_]Run minimized" or "[_]Run maximized", if wanted.
Click the [Help]-button while in dialog for more.
Then click OK to create the button.



- - -


https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd
/c Carries out the command specified by string and then stops (close the black window).
/k Carries out the command specified by string and continues (keep window open to see error or process messages).

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy
xcopy "source.doc" "c:\targetFolder\" (targetFolder will be created, don't forget the trailing backslash)

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/copy
copy "source.doc" "target.doc"
copy "source.doc" "c:\targetFolder" (targetFolder must exist)




 
Post Reply