Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2004

Tip: Looking for answers? Try searching our database.

how to set the file short name?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
petitehs - 18 Sep 2004 02:46 GMT
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.
Gary Chanson - 18 Sep 2004 05:22 GMT
> Hi,
>
[quoted text clipped - 20 lines]
>
> 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.

Signature

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

Olof Lagerkvist - 18 Sep 2004 17:53 GMT
>>Hi,
>>
[quoted text clipped - 25 lines]
>
>     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.

Signature

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

RNEELY - 21 Sep 2004 14:53 GMT
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/default.asp?url=/library/en-us/vbcon98/html/vb
conprogramminginfsoobjectmodel.asp


> Hi,
>
[quoted text clipped - 24 lines]
>
> petitehs.
Eskimo - 21 Sep 2004 15:26 GMT
Try fsutil utility.

> Hi,
>
> Does anyone know how to change the file's short (8.3) name?
> I cannnot find the way anywhere including MSDN.
Roger Frei - 24 Nov 2004 15:01 GMT
"Eskimo" schrieb:

> Try fsutil utility.
>
> > 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.