Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
AznChillin
- Posts: 5
- Joined: 30 May 2014 06:04
#1
Post
by AznChillin » 30 May 2014 06:19
I want to silence reg query that is within a for. if the registry doesn't exist i don't want the error to show.
Here is the line i have
Code: Select all
FOR /F "skip=2 tokens=2,*" %%A IN ('reg.exe query "HKLM\SOFTWARE\Windows" /v "ExePath"') DO set "PATHEXE=%%B"
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#2
Post
by foxidrive » 30 May 2014 06:30
Here's something that should work:
Code: Select all
FOR /F "skip=2 tokens=2,*" %%A IN ('reg.exe query "HKLM\SOFTWARE\Windows" /v "ExePath" 2^>nul ') DO set "PATHEXE=%%B"
-
AznChillin
- Posts: 5
- Joined: 30 May 2014 06:04
#3
Post
by AznChillin » 30 May 2014 06:59
foxidrive wrote:Here's something that should work:
Code: Select all
FOR /F "skip=2 tokens=2,*" %%A IN ('reg.exe query "HKLM\SOFTWARE\Windows" /v "ExePath" 2^>nul ') DO set "PATHEXE=%%B"
Thank you so much. You are awesome.
-
AznChillin
- Posts: 5
- Joined: 30 May 2014 06:04
#4
Post
by AznChillin » 30 May 2014 07:01
foxidrive wrote:Here's something that should work:
Code: Select all
FOR /F "skip=2 tokens=2,*" %%A IN ('reg.exe query "HKLM\SOFTWARE\Windows" /v "ExePath" 2^>nul ') DO set "PATHEXE=%%B"
Wait... error is still showing on 32 bit systems...
-
AznChillin
- Posts: 5
- Joined: 30 May 2014 06:04
#6
Post
by AznChillin » 30 May 2014 08:31
foxidrive wrote:What is the error message?
I am getting an Error: The system was unable to find the specified registry key or value
-
AznChillin
- Posts: 5
- Joined: 30 May 2014 06:04
#7
Post
by AznChillin » 30 May 2014 08:34
Nevermind, it works, it didn't replace the file in my virtual machine. Thank you so much for your help.