3

I'm trying to send the path of a file (dynamically) containing special characters in it using keyboard.sendkeys in codedui:

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

For some reason, ^abc in the filepath is treated as special character and sendkeys is not sending it.

Is there a workaround for this or an efficient way of doing this? I'm basically selecting a windows file i.e., through a windows prompt.

Jim Hewitt
  • 1,726
  • 4
  • 24
  • 26

1 Answers1

2

According to the docs, ^ is a modifier character. Adding it before a character sends that as a control key combo. For example, "^a" would send CTRL+A.

Try wrapping the "^" in braces, like this, to escape it:

string filepath="I:\{^}abc\abc\filename.csv";
Toby Deshane
  • 608
  • 1
  • 9
  • 23