Can't create a user command to move a file

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
User avatar
Ross
Bronze Member
Bronze Member
Posts: 102
Joined: 2008 May 02, 19:51

Can't create a user command to move a file

Post 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? :?:
otlaolap
Silver Member
Silver Member
Posts: 236
Joined: 2007 Aug 11, 21:37

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

Post 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.
User avatar
Ross
Bronze Member
Bronze Member
Posts: 102
Joined: 2008 May 02, 19:51

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

Post 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"?
User avatar
nikos
Site Admin
Site Admin
Posts: 15771
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

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

Post 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)
User avatar
Ross
Bronze Member
Bronze Member
Posts: 102
Joined: 2008 May 02, 19:51

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

Post 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?
Last edited by Ross on 2020 Apr 27, 01:17, edited 1 time in total.
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

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

Post 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.
User avatar
Ross
Bronze Member
Bronze Member
Posts: 102
Joined: 2008 May 02, 19:51

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

Post 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:
Post Reply