Re: Windows Short Names for FilePaths

  • From: "Mesut" <mesut.kokalan@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 19 Mar 2011 08:35:32 +0200

You can use this:
string path = 
System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);

  ----- Original Message ----- 
  From: RicksPlace 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Friday, March 18, 2011 11:57 PM
  Subject: Windows Short Names for FilePaths


  Hi: I am trying to write a script, vbs, that will take a file path with 
spaces like c:\Program Files\.... and generate the short name (8.3)?
  like c:\Progra~1\...
  Do you have anything that works?I have been trying to use the WsShell run 
command and the Cmd /c ... to try out diferent options but I can't seem to get 
anything to work.The FSO.GetShortName, think that was it, will return the 
filename in the path shortened but not the other path names of the folders. 
There is something (dir /x)but I'm not sure how to use it in my script. Since 
this should be such a common thing to do when installing software or doing 
other system functions in a script I thought someone may have already found a 
technical that would work. I have to eliminate the spaces in the file path to 
try and do a insert for the gacutil utility. I want to point to my project 
folder, debug in the bin, in one of my vb.net projects to pick up the assembly 
- Phew! I have been at this for 2 or 3 days, they are running together now...
  Thanks Rick USA 

Other related posts: