我必须开始将其放置在Program Files中的过程。但是问题是Process.Start不会占用路径空间。
Process regeditProcess = Process.Start("regedit.exe", "/s C:\\Program Files\\Test Folder\\sample.reg");
路径:
C:\\Program Files\\Test Folder\\sample.reg
在“程序文件”中的程序和文件之间有一个空格。
那是我的问题。如何避免空间?
最佳答案
您应该在引号(“)中传递包含空格的命令行参数,如下所示:
Process regeditProcess = Process.Start("regedit.exe", "/s \"C:\\Program Files\\Test Folder\\sample.reg\"");
关于c# - 如何删除路径中的空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11644145/