title: How to remove part of a string in a Windows Bat file and prepend another part of a string to it?
body: <p>I am trying to add a Windows Context Menu item that will let me right click a file in Windows Explorer and click a button <code>Open in Dev Server</code>.</p>
  
  <p>This will then pass the file path of the selected file to a Windows <code>.bat</code> file.</p>
  
  <p>In my .bat file <code>openLocalHostWebBrowser.bat</code> so far I have this code below which wehn ran opens a new tab in my web browser with the supplied URL.</p>
  
  <pre><code>@echo off
  start "webpage name" "http://someurl.com/"
  </code></pre>
  
  <p>So I need help.  I know how to add the context menu in Windows Explorer that will run my <code>openLocalHostWebBrowser.bat</code> file when clicked on.</p>
  
  <p>What I need help with is taking that file path that is passed and changing it by removing part of the front of it and prepending my localhost or any URL for that matter, perhaps another one for a production server.</p>
  
  <p>So if the file path passed to my .bat file is like this... </p>
  
  <p><code>E:\Server\htdocs\labs\php\testProject\test.php</code></p>
  
  <p>then I need to somehow turn it into this...</p>
  
  <p><code>http://localhost/labs/php/testProject/test.php</code></p>
  
  <p>The <code>E:\Server\htdocs\</code> should be replaced with <code>http://localhost/</code></p>