Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8850253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:51:31+00:00 2026-06-14T12:51:31+00:00

I am trying to write a batch script that will loop through the following

  • 0

I am trying to write a batch script that will loop through the following registry entry and update the different sub keys:

“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\”

For example:

reg add HKLM\System\CurrentControlSet\Control\Print\<Some Printer>\PrinterDriverData /t REG_DWORD /v SSNPNotifyEventSetting /d 0

I need to run that update for each printer installed and I think a FOR statement should be able to. I am just no good with FOR statements which is why I need help. This is what I have researched/tried so far:

set var1="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\"

FOR /F "PrinterDriverData" %%F IN ('REG QUERY %var1%') DO REG ADD %var1%\%%F\PrinterDriver\Data /t REG_DWORD /v SSNPNotifyEventSetting /d 0

I know this is probably way off, but its as far as I could figure out on my own. Any help is appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:51:32+00:00Added an answer on June 14, 2026 at 12:51 pm

    Here is the solution I came up with. Not sure it is the best way or simplest, but it works so far. Feel free to critique or improve please.

    set key="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers"
    
    reg query %key% > temp.txt
    
    FOR /F "delims=" %%a IN ('findstr /B "HKEY_LOCAL_MACHINE" temp.txt') DO (
        if /I NOT "%%a" == %key% (
            reg add "%%a\PrinterDriverData" /f /t REG_DWORD /v SSNPNotifyEventSetting /d 0 
        )
    )
    

    First, I query the registry and save all the needed reg keys into a text file. Then, inside the FOR loop, I search the file for the different registry keys and add the new sub key if not in he root key. I’ve added this to the tool I’m building to fix print servers and it has been great so far.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to write a batch file that will loop through all the files in
I am trying to write a windows batch script that it will search until
I'm trying to write a batch script (CMD @ Windows XP Pro) that will
I'm trying to write a small batch script that will delete files old files
I'm trying to write two batch files that will allow me to switch the
I'm trying to write an after update trigger that does a batch update on
I am trying to write a script that will parse a local file and
I am trying to write a batch file for Windows 7 that will create
I am trying to write a batch script that combines several css files into
I'm trying to write a batch script that errors if port 1099 is already

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.