Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have something like set value = c:\\some\\path

I want to convert this to c:\some\path.

How do I do this?

share|improve this question

migrated from May 29 '13 at 5:30

This question came from our site for professional and enthusiast programmers.

Why the close vote? Shell programming is valid for SO. – Preet Sangha May 28 '13 at 23:48
I agree this seems like an arbitrary move to SuperUser. It fits right in with StackOverflow in my mind. – dbenham May 29 '13 at 21:00
SO is a really funny well "reputated" & sophisticated forum (rofl)! – Endoro May 31 '13 at 8:10
up vote 3 down vote accepted

From Here you can use string replace.

@echo off
set value=c:\\some\\path
echo %value%
set new_value=%value:\\=\%
echo %new_value%



(yes I just learned this trick too)

That Link also has

Align Right          Align text to the right i.e. to improve readability of number columns.
Left String          Extract characters from the beginning of a string.
Map and Lookup       Use Key-Value pair list to lookup and translate values.
Mid String           Extract a Substring by Position.
Remove               Remove a substring using string substitution.
Remove both Ends     Remove the first and the last character of a string.
Remove Spaces        Remove all spaces in a string via substitution.
Replace              Replace a substring using string substitution.
Right String         Extract characters from the end of a string.
Split String         Split a String, Extract Substrings by Delimiters.
String Concatenation Add one string to another string.
Trim Left            Trim spaces from the beginning of a string via "FOR" command.
Trim Quotes          Remove surrounding quotes via FOR command.
Trim Right           Trim spaces from the end of a string via substitution.
Trim Right           Trim spaces from the end of a string via "FOR" command.
share|improve this answer
Cheers thanks. :) – user1068446 May 28 '13 at 23:52
What did you google to find it btw? – user1068446 May 28 '13 at 23:52
I googled: "windows batch strip" it was the the last on the page! – Preet Sangha May 28 '13 at 23:54
Or type "help set" in cmd.exe :-). – Werner Henze May 29 '13 at 9:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .