If I to include a graphic I have to manually replace backslashes '\' with slashes '/', which isn't very convenient especially if the path is long. But Latex is all about convenience and automation, right?
So I wonder if the a macro/package that would take a Windows path and replace backslashes with slashes and return it, preferably could handle sdpaces in the path. Intended use for including graphics and listings like this
\includegraphics{"\windowspath{my path1\my path2\my image.png}"}
\lstinputlisting{"\windowspath{my path1\my path2\myscript.m}"}
I found something similar here but it seems to define the converted path as a new variable, rather then returning it.

\includegraphics{"my image"}would be enough in most cases. The syntax you suggest would be very tricky as the space after\myis never tokenised it will have been absorbed while tex parsed the command\myso while you could detokenise the string and turn\to/you can not reliably tell if there should be a space after\my– David Carlisle Nov 07 '17 at 19:17\with/? How did the original string get entered? I ask as it would be better to fix that process so the/version gets entered into the file. – David Carlisle Nov 07 '17 at 19:27\in them and return the same path with/instead of\. The bad: it won't work in\inputand I don't think it would in\includegraphicsor similar. – Skillmon Nov 07 '17 at 19:44/as path delimiter instead of\? – egreg Dec 03 '17 at 14:55