倒,居然可以,多谢楼上:)
不过我现在是写死成“C:\PROGRA~1”可以成功备份到“C:\Program Files”,但是备份路径是用户可以随便选择的,我如何自动将有空格的转成~1,~2这种形式呢,PS,我用的是c#
不过我现在是写死成“C:\PROGRA~1”可以成功备份到“C:\Program Files”,但是备份路径是用户可以随便选择的,我如何自动将有空格的转成~1,~2这种形式呢,PS,我用的是c#
public static extern int GetShortPathName
(
[MarshalAs(UnmanagedType.LPTStr)]
string path,
[MarshalAs(UnmanagedType.LPTStr)]
StringBuilder shortPath,
int shortPathLength
);
//使用此函数很简单 StringBuilder shortPath = new StringBuilder(80);
int result = GetShortPathName(
@"d: est.jpg", shortPath, shortPath.Capacity);
string s = shortPath.ToString();
如:
CD ‘Program files’ --错误
应该
cd "Program files" --就可以--个人意见