我正在尝试在创建文件之前获取文件的短路径。我发现一个示例,如果文件夹或文件存在,该示例可以将路径转换为shortPath。但是,有没有办法在文件存在之前获取短路径?
最佳答案
感谢所有的评论。我认为解决此问题的最简单方法是:
if file DOES NOT existed:
generate shortPath
return shortPath
else:
touch a new file with exact name expected.
generate shortPath
remove temp file
return shortPath
关于powershell - Windows在创建文件之前先获取文件的短路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11271473/