Solved I heed help to create batch file. How to take characters fro

April 7, 2012 at 11:17:14
Specs: Windows 7
Hello, there is a task that I want to automate. I need to update program on some PCs (about 10-15). So I need to

uninstall old program version and install new one. And I want to make Batch file for this.
At first I want to find old App that installed on the system and uninstall it:
I have found EXE file that can help me - UninstallW.exe. And bathch start with:
@echo off
uninstallW /w /a > 1.txt
SO i get file with all installed programs, like:
{CFEF48A8-BFB8-3EAC-8BA5-DE4F8AA267CE}: Microsoft .NET Framework 4 Multi-Targeting Pack (version 4.0.30319)
{EB879750-CCBD-4013-BFD5-0294D4DA5BD0}: Apple Application Support (version 2.1.7)
{ED784556-66AA-3F17-9B58-7246ACB5C7E4}: Microsoft Visual Basic 2010 Express - ENU (version 10.0.40219)

To find the string that I need, I use:
for /f "delims=" %%a in ('findstr /C:"My DICOM Viewer" 1.txt') do set key=%%a
echo %key%

And I will get string like this saved in "key" variable:
{5A3C1721-F8ED-11E0-8AFB-B8AC6F97B88E}: My DICOM Viewer (version

Then to unistall programm - I need only {5A3C1721-F8ED-11E0-8AFB-B8AC6F97B88E}.

So my question is - how can I get(extract) value in the { ---- } and save it to the new variable like "key1" ?

Thank you.

See More: I heed help to create batch file. How to take characters fro

Report •

April 7, 2012 at 14:48:42
✔ Best Answer
Another For?

for /f "tokens=1 delims=:" %%1 in ("%key%") do (
    set key1=%%1

Report •

April 8, 2012 at 02:34:30
Thank you!

Report •
Related Solutions

Ask Question