1.

Solve : reformat a string?

Answer»

Hi

here's my problem: When I enter a string in the form S-1-5-21-12345-6789 via
SET /p sid=SID:
I need to have it "converted" to the following format: 5 21 12345 6789 (so without "-", "S" and "1").

The reason for this is that I have SIDs that I want to have resolved to usernames with the tool "sid2user.exe", which unfortunately needs this special format as a parameter.
(
set /p sidtousersidname=SID:
CONVERSION, no idea how to do this
sid2user %formattedsid%
)

Is this possible?Code: [Select]set /p sid=SID:
set sid=%sid:~4%
set sid=%sid:-= %
sid2user %sid%

Good luck. Beware using
(
%PERCENT sign VARIABLES% in parenthetical expressions
)



Discussion

No Comment Found