Using Long File Names From The Command Line
Last Updated: 03 Nov 2000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** PLEASE NOTE: Link(s), If Provided, May Be Wrapped ***
In order to manage long file names while writing NT Shell
Scripts OR executing commands such as COPY, RMTSHARE, or
DIR, it is necessary to surround the longname in Quotation
Marks.
EXAMPLES:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
COPY "C:\Directory\Any Long Filename.TXT" D:\Destination
RMTSHARE \\MyServer\MyShare="D:\MyFolder\What A Long Name" /USERS:10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There is nothing inherently wrong with placing quotes
around a shortname, and if you are using environment
variables, then it is a good practise to place quotation
marks around any variable that *might* contain a name of
a file or folder at some point.
EXAMPLES:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Variables
SET @MyFile=C:\Directory\Any Long Filename.TXT
SET @Dest=D:\Destination
SET @MyShare=D:\MyFolder\What A Long Name
:Main
COPY "%@MyFile%" "%@Dest%"
RMTSHARE \\MyServer\MyShare="%@MyShare%" /USERS:10
:End
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RELATED SCRIPTS (ALSO IN THIS ARCHIVE)
• http://KB.UltraTech-llc.com/Scripts/?File=DelOld-A.BAT
• http://KB.UltraTech-llc.com/Scripts/?File=DelOld-F.BAT
RELATED TOPICS (ALSO IN THIS ARCHIVE)
• http://KB.UltraTech-llc.com/?File=EnvVars.TXT
• http://KB.UltraTech-llc.com/?File=Scripting.TXT
• http://KB.UltraTech-llc.com/?File=ResKit.TXT