编码 UI - Keyboard.sendkeys - 包含特殊字符的文件的发送路径

Coded UI - Keyboard.sendkeys - Sending path of a file containing special characters

我正在尝试使用 codedui 中的 keyboard.sendkeys 发送包含特殊字符的文件(动态)路径:

string filepath="I:\^abc\abc\filename.csv";
Keyboard.SendKeys(filepath);

由于某些原因,文件路径中的 ^abc 被视为特殊字符,sendkeys 没有发送它。

是否有解决此问题的方法或有效的方法?我基本上选择了一个 windows 文件,即通过 windows 提示。

根据docs,^是修饰符。在字符发送之前添加它作为控制键组合。例如,“^a”将发送 CTRL+A。

尝试像这样用大括号括起“^”来转义它:

string filepath="I:\{^}abc\abc\filename.csv";