Como posso fazer uma tradução de string na linha de comando do windows?

3

Se eu tiver algo como set value = c:\some\path

Eu quero converter isso para c:\some\path .

Como faço isso?

    
por user1068446 29.05.2013 / 01:32

1 resposta

3

De Aqui você pode usar string replace.

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

saída

c:\some\path
c:\some\path

(sim, eu acabei de aprender esse truque também)

Esse link também tem

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.
    
por 29.05.2013 / 01:46