Page 1 of 1

Can't create a user command to move a file

Posted: 2020 Apr 23, 23:49
by Ross
Hi, one of my tasks involved creating a list.txt file on my Desktop. This files is then moved to my current working directory, but I always have to do it by hand.

I'm trying to create a custom user command to move it with one call or set of keys, but I'm encountering difficulties:

Code: Select all

> move C:\Users\me\Desktop\list.txt $R
(given that I'm usually on the right pane when browsing to the desired location)

But the statusbar displays the message, “the program tried its best but the command is impossible to execute”.

What am I missing? :?:

Re: Can't create a user command to move a file

Posted: 2020 Apr 24, 01:42
by otlaolap
It seems likely that you mean to execute the DOS move command to move the file from one place to another. If so, the command should be prefixed with "$" rather than ">". ">" is for windows commands; "$" is for DOS commands. On my system the (example) command "$ move G:\z.exe $R" does move the file as expected to the folder at which the right pane is open.

The command does pop up a console; I don't know how to suppress the popup so that the move is quiet.

Re: Can't create a user command to move a file

Posted: 2020 Apr 24, 05:15
by Ross
otlaolap wrote: 2020 Apr 24, 01:42 It seems likely that you mean to execute the DOS move command to move the file from one place to another. If so, the command should be prefixed with "$" rather than ">". ">" is for windows commands; "$" is for DOS commands. On my system the (example) command "$ move G:\z.exe $R" does move the file as expected to the folder at which the right pane is open.

The command does pop up a console; I don't know how to suppress the popup so that the move is quiet.
Exactly! I tried the "$" prefix before, and I got the same behaviour you mentioned — the nagging popup. So what is the ">" equivalent to the DOS command above? Does x2 use another keyword instead of "move"?

Re: Can't create a user command to move a file

Posted: 2020 Apr 24, 08:13
by nikos
you cannot run a dos command outside a console window. Try the xcopy command instead (use xcopy -? for its options or google it)

Re: Can't create a user command to move a file

Posted: 2020 Apr 24, 21:54
by Ross
nikos wrote: 2020 Apr 24, 08:13 you cannot run a dos command outside a console window. Try the xcopy command instead (use xcopy -? for its options or google it)
Thanks Nikos! This worked...

Code: Select all

> xcopy /c /y /e /i C:\Users\me\Desktop\*list.txt $R
BUT... by looking at its options, I see it only copies; doesn't move. So I thought of concatenating with a

Code: Select all

&& del C:\Users\me\Desktop\*list.txt
command, but that's concerning; I could eventually have other "*list" files on my Desktop and the DEL command sends it away for good; doesn't support the Recycle Bin.

Can you think of a safer workaround?

Re: Can't create a user command to move a file

Posted: 2020 Apr 25, 06:55
by FrizzleFry
try this:

Code: Select all

> cmd /C move C:\Users\Leo\Desktop\*list.txt $R
if that works just ignore the following stuff...


you can use the '$ move x.list $R' command without getting the leftover console but you have to make a couple of changes in settings

you have to change
szDosCmdPreamble=cmd.exe /K
to
szDosCmdPreamble=cmd.exe /C

for whatever layout you are using for this...
default is in [xplorer2_UC]

I think you have to make this change by editing the registry or ini file (make sure you completely exit x2 with Alt-X before)

the other change is simpler...
Tools/Options/General (tab)
uncheck 'redirect DOS command output to local console'

Another way to go is to install some kind of external move command...
I have Gow (GNU On Windows) installed and on my path
it includes a move command (mv) so I can do:

> mv x.list "$R"

I usually enclose the $ tokens in quotes because they tend not to be space aware (except for $A and $S)

You could probably use something like TeraCopy also.

Re: Can't create a user command to move a file

Posted: 2020 Apr 27, 01:16
by Ross
FrizzleFry wrote: 2020 Apr 25, 06:55 try this:

Code: Select all

> cmd /C move C:\Users\Leo\Desktop\*list.txt $R
if that works just ignore the following stuff...
[...]
Worked like a charm! That was it! Thanks!! :bigsmile: :beer: