开发者

Windows Path as an argument

开发者 https://www.devze.com 2023-02-08 08:22 出处:网络
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.

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消