How to convert
\"String path = @\"C:\\Abc\\Omg\\Why\\Me\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\";
into
String path = @\"C:\\A
You can use path.TrimEnd('\\'). Have a look at the documentation for String.TrimEnd.
path.TrimEnd('\\')
If you want the trailing slash, you can add it back easily.