not an X-Y Problem. So that I can properly give an example of what I was trying to accomplish, I just assigned c:\\temp\\\\ to the variable $ScriptDir. in actuality, $ScriptDir gets its value from the terminal input from the end user $ScriptDir=<STDIN>; So I am trying to plan for the end user entering slashes and correct it