Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Get short file name from long one ?

Reply
 
Old 07-07-2009   #1 (permalink)
Vilius Mockûnas


 
 

Get short file name from long one ?

Hi,

I have long file name like wscript.scriptfullname
How do convert it to short form ?

thanks
Vilius



My System SpecsSystem Spec
Old 07-07-2009   #2 (permalink)
Bukkake Face


 
 

Re: Get short file name from long one ?

On Jul 8, 10:08*am, "Vilius Mockûnas" <v_mocku...@xxxxxx> wrote:
Quote:

> Hi,
>
> I have long file name like wscript.scriptfullname
> How do convert it to short form ?
>
> thanks
> Vilius
Use :

wscript.scriptname
My System SpecsSystem Spec
Old 07-07-2009   #3 (permalink)
James Whitlow


 
 

Re: Get short file name from long one ?

"Vilius Mockûnas" <v_mockunas@xxxxxx> wrote in message
news:uHd4l90$JHA.4984@xxxxxx
Quote:

> Hi,
>
> I have long file name like wscript.scriptfullname
> How do convert it to short form ?
You can use the 'ShortName' & 'ShortPath' properties of the 'GetFile' &
'GetFolder' methods of the 'Scripting.FileSystemObject object'.

Set oFSO = CreateObject("Scripting.FileSystemObject")

MsgBox oFSO.GetFolder("C:\New Folder").ShortName
MsgBox oFSO.GetFile("C:\New Folder\New Text Document.txt").ShortName
MsgBox oFSO.GetFile("C:\New Folder\New Text Document.txt").ShortPath


My System SpecsSystem Spec
Old 07-08-2009   #4 (permalink)
OldDog


 
 

Re: Get short file name from long one ?

On Jul 7, 5:26*pm, "James Whitlow" <jwhitlow.60372...@xxxxxx>
wrote:
Quote:

> "Vilius Mockûnas" <v_mocku...@xxxxxx> wrote in message
>
> news:uHd4l90$JHA.4984@xxxxxx
>
Quote:

> > Hi,
>
Quote:

> > I have long file name like wscript.scriptfullname
> > How do convert it to short form ?
>
> * You can use the 'ShortName' & 'ShortPath' properties of the 'GetFile'&
> 'GetFolder' methods of the 'Scripting.FileSystemObject object'.
>
> Set oFSO = CreateObject("Scripting.FileSystemObject")
>
> MsgBox oFSO.GetFolder("C:\New Folder").ShortName
> MsgBox oFSO.GetFile("C:\New Folder\New Text Document.txt").ShortName
> MsgBox oFSO.GetFile("C:\New Folder\New Text Document.txt").ShortPath

strPath1 = "the fully quallified path"
Set objFile=objFSO.GetFile(strPath1)
Wscript.Echo objFile.ShortPath



Put the fully quallified path in strPath1 and it returns the short
path name.
Or
.ShortName

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Motherboard 1 long and 3 short beeps General Discussion
multiselect file open dialog that supports long file names VB Script
Fix for long, long, long deleting and copying of files? Vista General
coping file from a remote file share - FILE IS NO LONG THERE bogus error message Vista networking & sharing
Error 1325 - 'File name' is not a valid short file name. Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46