batch-file
I am a newbie to batch scripting. I was writing a script which gets a value from a registry key in windows. I am using a for loop
for /f "tokens=1*" %%A in ('reg query HKLM\Software\CDupe\ZIB\ /v BackupSetLocation' ) do SET path_temp=%%B
for /f "tokens=1*" %%A in ("%path_temp%") do SET BackupSet_Path=%%B
From this 2 for loops , I get the Value for the registry key BackupSetLocation.
The value I get when I echo %BackupSet_Path% is C:\ProgramData\CDupe\CDupe Cloud Backup(x64)\zcb\conf.
Problem is :
Now from the BackupSet_Path I want to extract only
C:\ProgramData\CDupe\CDupe Cloud Backup(x64)\ .
I tried this
for /f "tokens=1*" %%A in ('reg query HKLM\Software\CDupe\ZIB\ /v BackupSetLocation' ) do SET path_temp=%%B
for /f "tokens=1-4" %%A in ("%path_temp%") do SET BackupSet_Path=%%B
giving tokens = 1-4 , I get only C:\ProgramData\CDupe\CDupe
because there are whitespaces between "CDupe Cloud Backup(x64)".
Can anyone please tell me how to ignore those spaces and get this string
C:\ProgramData\CDupe\CDupe Cloud Backup(x64)\
Thanks for your time.