Windows Path as an argument
I am developing an application in C# to encrypr/decrypt files. I have used file association to invoke decryption application on clicking the encrypted file. So code 'Applic开发者_Go百科ation.ExecutablePath + " %1"'enables that.
%1 gives the FullName of the file. If the filename doesnt have spaces in it its works properly but if it have spaces like "C:\Folder Name\Encrypted File.enc" is received as "C:\FOLDERNAM~1\ENCRPTEDFIL~1".
How to get that File name Correctly correctly?
does this piece of code do what you need?
private string GetLongFileName(string shortName)
{
return new FileInfo(shortName).FullName;
}
精彩评论