@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: Removes illegal characters from a file or directory name. Enforces the 8.3 filename format on drives that do not support long file names. !!!!C# Signature: [DllImport("shell32.dll", EntryPoint="PathCleanupSpec", CharSet=CharSet.Unicode)] internal static extern int PathCleanupSpec( StringBuilder pszDir, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder pszSpec); !!!!VB Signature: <DllImport("shell32.dll", EntryPoint:="PathCleanupSpec", CharSet:=CharSet.Unicode)> _ Friend Shared Function PathCleanupSpec( _ ByVal pszDir As StringBuilder, _ <MarshalAs(UnmanagedType.LPWStr)> ByVal pszSpec As StringBuilder) As Integer End Function !!!!Sample Code: const int MAX_PATH = 260; StringBuilder folderSpec = new StringBuilder(MAX_PATH); folderSpec.Append(@"D:\"); StringBuilder fileSpec = new StringBuilder(MAX_PATH); fileSpec.Append("Bad*file?<test>.txt"); int result = NativeMethods.PathCleanupSpec(folderSpec, fileSpec); Console.WriteLine("FileName: {0}", fileSpec.ToString()); Documentation: PathCleanupSpec@msdn on MSDN
Edit shell32.PathClean...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.