English 中文(简体)
batch - Ignorespace while parsing a variability using for loop inbatchscript
原标题:batch - Ignore spaces while parsing a variable using for loop in batch script
  • 时间:2011-11-03 20:21:17
  •  标签:
  • batch-file

batch-file

我是打字的新手。 我是一份从窗户的登记处钥匙获得价值的文件。 我正在使用一种假体。

for /f "tokens=1*" %%A in ( reg query HKLMSoftwareCDupeIB  /v BackupSetLocation  ) do SET path_temp=%%B
for /f "tokens=1*" %%A in ("%path_temp%") do SET BackupSet_Path=%%B

从这2处就座机而言,我获得了登记处钥匙的数值<条码>。

Iecho %BackupSet_Path% is C:ProgramDataCDupe Wu Backup(x64)zcbconf.

问题在于:

现改为<代码> BackupSet_Path 我只想提一下。

<代码>C:ProgramDataCDupeCDupeumi Backup(x64)。

我试图这样做。

for /f "tokens=1*" %%A in ( reg query HKLMSoftwareCDupeIB /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:ProgramDataCDupeCDupe

because there are whitespaces between "CDupe Cloud Backup(x64)".

Can anyone please tell me how to ignore those spaces and get this string

C:ProgramDataCDupeCDupe Cloud Backup(x64)

感谢你们的时间。

问题回答
for /f "tokens=1*" %%A in ( reg query HKLMSoftwareCDupeIB /v BackupSetLocation  ) do SET path_temp=%%B
for /f "tokens=1-4 delims=" %%A in ("%path_temp%") do SET BackupSet_Path=%%A\%%B\%%C\%%D




相关问题
complex batch replacement linux

I m trying to do some batch replacement for/with a fairly complex pattern So far I find the pattern as: find ( -name *.php -o -name *.html ) -exec grep -i -n hello {} + The string I want ...

How to split a string by spaces in a Windows batch file?

Suppose I have a string "AAA BBB CCC DDD EEE FFF". How can I split the string and retrieve the nth substring, in a batch file? The equivalent in C# would be "AAA BBB CCC DDD EEE FFF".Split()[n]

How to check which Operating System?

How can I check OS version in a batch file or through a vbs in an Windows 2k/2k3 environment ? You know ... Something like ... : "If winver Win2k then ... or if winver Win2k3 then ....

热门标签