copy file's short name (DOS 8.3) to clipboard with full path

English support forum

Moderators: Hacker, Stefan2, white, sheep

User avatar
leopoldus
Senior Member
Senior Member
Posts: 221
Joined: 2004-11-21, 09:47 UTC

copy file's short name (DOS 8.3) to clipboard with full path

Post by *leopoldus » 2013-09-07, 15:31 UTC

Could not find any internal command or other solution to copy a file's short name (in DOS-format 8.3) to a clipboard with or without full path.

No a single word in the Manual neither here at forum. Have I missed anything? I can't believe me to be the first, who needs it.

User avatar
white
Power Member
Power Member
Posts: 2020
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: copy file's short name (DOS 8.3) to clipboard with full

Post by *white » 2013-09-07, 15:46 UTC

leopoldus wrote:Could not find any internal command or other solution to copy a file's short name (in DOS-format 8.3) to a clipboard with or without full path.
Use the new beta and something like this as button command:

Code: Select all

cm_SwitchLongNames,cm_CopyNamesToClip,cm_SwitchLongNames

User avatar
MVV
Power Member
Power Member
Posts: 8121
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2013-09-07, 15:57 UTC

Using a tool like TCMC of TCFS2 it is possible with any TC version. TCFS2 may also check if long names are enabled before switching it off.

User avatar
leopoldus
Senior Member
Senior Member
Posts: 221
Joined: 2004-11-21, 09:47 UTC

Post by *leopoldus » 2013-09-07, 20:43 UTC

2white
Use the new beta and something like this as button command:
I see, thanks. It should work to copy short names without paths.

But what about copying the full path, including short names of the folders?
As far as I know, TC can not copy short names of files immediately after switching from long names format - and visa versa. In order to get the correct path, you need to go through the whole path from the root folder to your file after you switch to alter name format, otherwise you will get some ugly hybrid of long and short names. Am I right?

2MVV
Using a tool like TCMC of TCFS2 it is possible with any TC version.
I'll try this tool, thanks.

User avatar
white
Power Member
Power Member
Posts: 2020
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white » 2013-09-08, 00:34 UTC

leopoldus wrote:But what about copying the full path, including short names of the folders?
As far as I know, TC can not copy short names of files immediately after switching from long names format - and visa versa. In order to get the correct path, you need to go through the whole path from the root folder to your file after you switch to alter name format, otherwise you will get some ugly hybrid of long and short names. Am I right?
Yes, you are right. Forgot about that. Also, a selection of multiple files is lost after cm_SwitchLongNames.

You can use command "cd" and parameter "%p" to go to path with short names.
But it seems you can not use command "cd" and parameter "%P" to go to path with long names.

There seems to be a bug somewhere when you execute the following commands sequentially:
cm_SwitchLongNames
cd %p
cd %P
cm_SwitchLongNames

After this, use the Go back and Go forward buttons to see the history list is messed up.

EDIT:
Bug report: here
EDIT 2:
Doesn't seem to be a bug. See above mentioned thread.
Last edited by white on 2013-09-08, 16:14 UTC, edited 2 times in total.

User avatar
HolgerK
Power Member
Power Member
Posts: 4962
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK » 2013-09-08, 08:50 UTC

Button code (Copy code to clipboard, paste into button-bar, adapt the nircmd-path):

Code: Select all

TOTALCMD#BAR#DATA
C:\Tools\NirSoft\nircmd.exe
clipboard readfile "%l"
WCMICONS.DLL,45
Selected Files to Clipboard (8.3 DOS Names)


-1
http://www.nirsoft.net/utils/nircmd.html

Regards
Holger

User avatar
leopoldus
Senior Member
Senior Member
Posts: 221
Joined: 2004-11-21, 09:47 UTC

Post by *leopoldus » 2013-09-08, 11:56 UTC

2HolgerK
Thank you, but seems, that something is missed in the code. At least, at my system pressing this button brings to the front Explorer window with Nircmd folder. I've checked the path twice, all is OK. Surrounding nircmd name with quotes does not help too.

User avatar
MVV
Power Member
Power Member
Posts: 8121
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2013-09-08, 12:20 UTC

leopoldus,
Please check it once again:

Code: Select all

Command: X:\Path\To\nircmd.exe
Parameters: clipboard readfile "%l"

User avatar
HolgerK
Power Member
Power Member
Posts: 4962
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK » 2013-09-08, 12:21 UTC

I've checked the path twice
Posting the content of the Command field from your button would help to analyze your problem.

Okay, do it manual:
- Drag&Drop nircmd.exe on a free place of the button bar
- Context menu of the new created button -> Change...
- Parameter:

Code: Select all

clipboard readfile "%l"
Regards
Holger

User avatar
leopoldus
Senior Member
Senior Member
Posts: 221
Joined: 2004-11-21, 09:47 UTC

Post by *leopoldus » 2013-09-08, 16:46 UTC

2HolgerK
Posting the content of the Command field from your button would help to analyze your problem.
Here is a copy of my buttons's fields "command" and "parameter"

Code: Select all

"D:\Nirsoft\Nircmd\nircmd.exe"
clipboard readfile "%1"
BTW, I've checked it now at another machine. Here it does not anything at all, even does not open Explorer window.

User avatar
white
Power Member
Power Member
Posts: 2020
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white » 2013-09-08, 16:49 UTC

2leopoldus
You used the number 1 instead of the lowercase L in %l.

Code: Select all

1 does not equal l, although it looks the same in a code block

User avatar
leopoldus
Senior Member
Senior Member
Posts: 221
Joined: 2004-11-21, 09:47 UTC

Post by *leopoldus » 2013-09-08, 16:58 UTC

white wrote:You used the number 1 instead of the lowercase L in %l.
Damn it!!! :oops: :oops: :oops:

But how you could detect my mistake so easily? This two symbols looks actually so similar.

User avatar
white
Power Member
Power Member
Posts: 2020
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white » 2013-09-08, 17:06 UTC

leopoldus wrote:But how you could detect my mistake so easily?
Because it did not work for you. It seemed like the most obvious mistake from the beginning. Probably others expected it too.

What we did not expect that you would not use copy and paste..

User avatar
leopoldus
Senior Member
Senior Member
Posts: 221
Joined: 2004-11-21, 09:47 UTC

Post by *leopoldus » 2013-09-08, 17:29 UTC

Thanks again!
Well, the only small sub-case still is not solved is copying several selected filenames in 8.3 format without paths.
I've reread now you post above and was not able to understand it in total:
You can use command "cd" and parameter "%p" to go to path with short names.
But it seems you can not use command "cd" and parameter "%P" to go to path with long names.
To avoid a new embarrassment I'd better ask just now, what I should do exactly in order to copy filename in 8.3 format by using "cd" command with parameter "%p"?

User avatar
white
Power Member
Power Member
Posts: 2020
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white » 2013-09-08, 17:46 UTC

leopoldus wrote:Well, the only small sub-case still is not solved is copying several selected filenames in 8.3 format without paths.
As I tried (but failed) to explain above, my solution does not work for several selected files.
leopoldus wrote: I've reread now you post above and was not able to understand it in total:
You can use command "cd" and parameter "%p" to go to path with short names.
But it seems you can not use command "cd" and parameter "%P" to go to path with long names.
To avoid a new embarrassment I'd better ask just now, what I should do exactly in order to copy filename in 8.3 format by using "cd" command with parameter "%p"?
This has to do with copying file name including path. I have included a link in my message above to a bug report where you can find more information about this.

You can find more information about %P, %p, %l, %L in Total Commander's help. These variables must be used in the Parameters field. Creating a button with "cd" in the Command field and "%p" in the Parameters field will allow you to go to the current path in short naming notation.

Post Reply