468,310 Members | 1,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,310 developers. It's quick & easy.

how to set the file short name?

Hi,

Does anyone know how to change the file's short (8.3) name?
I cannnot find the way anywhere including MSDN.

I know how to get the long name and the short name of the files.
(using GetLongPathName() and GetShortPathName())

Unfortunately, what I want to do is not to GET the short file name, but to
SET the short file name.

For example, assume that I create a file named "My Data File.dat".
Then this file is automatically assigned with the short name "MYDATA~1.DAT".
(Of course, the short name is hidden in common condition.)

Now, I want to change the short name to "MDF_01.DAT", how can I do that?
(Sure, the long file name must be kept in its original name.)

I know there is a function SetFileShortName() that may be the one I'm
looking for,
but this function is only available in Windows XP or Server 2003.
(I cannot test this function. My system is Windows 2000.)

Is there no way to solve this problem?

Thanks in advance,

petitehs.
Nov 17 '05 #1
5 7829

"petitehs" <pe******@hitel.net> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
Hi,

Does anyone know how to change the file's short (8.3) name?
I cannnot find the way anywhere including MSDN.

I know how to get the long name and the short name of the files.
(using GetLongPathName() and GetShortPathName())

Unfortunately, what I want to do is not to GET the short file name, but to
SET the short file name.

For example, assume that I create a file named "My Data File.dat".
Then this file is automatically assigned with the short name "MYDATA~1.DAT". (Of course, the short name is hidden in common condition.)

Now, I want to change the short name to "MDF_01.DAT", how can I do that?
(Sure, the long file name must be kept in its original name.)

I know there is a function SetFileShortName() that may be the one I'm
looking for,
but this function is only available in Windows XP or Server 2003.
(I cannot test this function. My system is Windows 2000.)

Is there no way to solve this problem?


I think that SetShortFileName is the only documented way to change the
short name without changing the long name. I think it would be possible to
write a program which by-passes the file system and changes the short name
in the directory entry directly but I'm not certain that this can be done
without getting the file system confused.

--
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.mvps.org/ArcaneIncantations/consulting.htm
-g*******@mvps.org

Nov 17 '05 #2
Gary Chanson wrote:
"petitehs" <pe******@hitel.net> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
Hi,

Does anyone know how to change the file's short (8.3) name?
I cannnot find the way anywhere including MSDN.

I know how to get the long name and the short name of the files.
(using GetLongPathName() and GetShortPathName())

Unfortunately, what I want to do is not to GET the short file name, but to
SET the short file name.

For example, assume that I create a file named "My Data File.dat".
Then this file is automatically assigned with the short name
"MYDATA~1.DAT".
(Of course, the short name is hidden in common condition.)

Now, I want to change the short name to "MDF_01.DAT", how can I do that?
(Sure, the long file name must be kept in its original name.)

I know there is a function SetFileShortName() that may be the one I'm
looking for,
but this function is only available in Windows XP or Server 2003.
(I cannot test this function. My system is Windows 2000.)

Is there no way to solve this problem?

I think that SetShortFileName is the only documented way to change the


(typo, it is SetFileShortName if he wants to search MSDN for it.)
short name without changing the long name. I think it would be possible to
write a program which by-passes the file system and changes the short name
in the directory entry directly but I'm not certain that this can be done
without getting the file system confused.


--
Olof Lagerkvist
ICQ: 724451
Web page: http://here.is/olof

Nov 17 '05 #3
The Visual Basic File System Object "File" Object gives you both short an
long filenames. You can get to it directly from VB or VBScript, or in C++
via COM
http://msdn.microsoft.com/library/de...bjectmodel.asp

"petitehs" wrote:
Hi,

Does anyone know how to change the file's short (8.3) name?
I cannnot find the way anywhere including MSDN.

I know how to get the long name and the short name of the files.
(using GetLongPathName() and GetShortPathName())

Unfortunately, what I want to do is not to GET the short file name, but to
SET the short file name.

For example, assume that I create a file named "My Data File.dat".
Then this file is automatically assigned with the short name "MYDATA~1.DAT".
(Of course, the short name is hidden in common condition.)

Now, I want to change the short name to "MDF_01.DAT", how can I do that?
(Sure, the long file name must be kept in its original name.)

I know there is a function SetFileShortName() that may be the one I'm
looking for,
but this function is only available in Windows XP or Server 2003.
(I cannot test this function. My system is Windows 2000.)

Is there no way to solve this problem?

Thanks in advance,

petitehs.

Nov 17 '05 #4
Try fsutil utility.

"petitehs" <pe******@hitel.net> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
Hi,

Does anyone know how to change the file's short (8.3) name?
I cannnot find the way anywhere including MSDN.

Nov 17 '05 #5


"Eskimo" schrieb:
Try fsutil utility.

"petitehs" <pe******@hitel.net> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
Hi,

Does anyone know how to change the file's short (8.3) name?
I cannnot find the way anywhere including MSDN.



Hi

I've try

fsutil file setshortname C:\Programme Progra~1

but I held a Error Message.
How can I change a short name for a system folder??

Thank's for help
Roger
Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Skc | last post: by
3 posts views Thread by David Elliott | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.