By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,871 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,871 IT Pros & Developers. It's quick & easy.

how to set the file short name?

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a


"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.