Hi Guys,
I'm trying to store IE download folder into a variable.
The following code works in vista but not in XP
(vista "cuts" the spaces, XP shows the path with preceding spaces)
Can anyone please help me get it right?
@ECHO OFF
FOR /F "tokens=2* delims=REG_SZ " %%A IN (' REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer" /v "Download Directory" ') DO SET directory=%%B
echo %directory%
Thanks
Get Internet Explorer download folder
Moderator: DosItHelp
Re: Get Internet Explorer download folder
Use a "Tab" character as delimiter.
Regards
aGerman
Regards
aGerman
-
- Expert
- Posts: 442
- Joined: 01 Aug 2010 17:13
- Location: Canadian Pacific
- Contact:
Re: Get Internet Explorer download folder
I modify this line when querying the registry. The default delimiters are (space) and (tab), so there's no need to set it.
So you know, when you set delims, it makes each individual character a delimiter. It is not a string input.
Code: Select all
for /f "skip=2 tokens=3*" %%x in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer" /v "Download Directory"') do set "value=%%y"
So you know, when you set delims, it makes each individual character a delimiter. It is not a string input.
Re: Get Internet Explorer download folder
- on some localized Windows REG.EXE use SPACE or TAB as delimiter
- on some Windows versions REG.EXE header may be different
- on some Windows versions REG.EXE header may be different
Code: Select all
@for /f "tokens=3* delims= " %%x in (
'reg query "HKCU\Software\Microsoft\Internet Explorer" /v "Download Directory"^|find "REG_SZ"'
) do @set "directory=%%y"
@set directory
@pause >nul
-
- Posts: 2
- Joined: 15 Sep 2010 17:04
Re: Get Internet Explorer download folder
orange_batch's post did the trick..
Thanks guys for your help!!
Thanks guys for your help!!