Windows 10: How to put them together and batch run them?

Discus and support How to put them together and batch run them? in Windows 10 Support to solve the problem; Hi, everyone I found the PowerShell command codes could deny full control permission of registry key, but them were imperfect and not met my need. The... Discussion in 'Windows 10 Support' started by shiwan0804, Oct 27, 2020.

  1. How to put them together and batch run them?


    Hi, everyone
    I found the PowerShell command codes could deny full control permission of registry key, but them were imperfect and not met my need.
    The imperfect PowerShell command codes are as following.

    $path = "HKCU:\Control Panel\Keyboard"
    $Acl = Get-ACL $path
    $AccessRule= New-Object System.Security.AccessControl.RegistryAccessRule("Administrators","FullControl","Deny")
    $Acl.SetAccessRule($AccessRule)
    Set-Acl $path $Acl

    The perfect state should be as first picture as attached.

    How to put them together and batch run them? [​IMG]


    The real condition was as second picture as attached.

    How to put them together and batch run them? [​IMG]


    Q1. Could you correct the imperfect command codes to meet my need?
    Q2. Could you put them together and use batch file to run them automatically?
    Thanks a lot.

    :)
     
    shiwan0804, Oct 27, 2020
    #1
  2. djmcnz Win User

    running DOS as ADMIN

    I assume you don't have 'exit' anywhere in your batch file?

    Rather than playing with 'pause' - if you want to see the output...

    1. Open a command window as admin
    2. Run the batch file manually
    3. Command window will not close unless the 'exit' command is issued
    4. Read output
    That's the first step I'd take to diagnose. Then run every line in your batch file manually, one-by-one, in your admin command window (copy and paste from the actual batch file, don't retype the commands).

    You'll soon find your problem.
     
    djmcnz, Oct 27, 2020
    #2
  3. Bree Win User
    running DOS as ADMIN

    I suggested that in post #4 but @bromberg doesn't seem to have tried it yet...
     
  4. How to put them together and batch run them?

    Running PowerShell script as a batch file

    Hello Baldo,



    Thank you for writing to Microsoft Community Forums.



    I understand that you want to execute the PowerShell commands as a batch file.



    I tried executing the batch file on my machine but I was unable to execute it as the command was incomplete. However, after making some changes in the command I was able to execute the batch file.



    You can try the following command by saving it in a batch file and check if that helps.



    powershell –Command Get-AppxPackage Microsoft.3dBuilder | Remove-AppxPackage



    Also, as the query is related to running a PowerShell script using a batch file, I suggest you to post the issue on

    TechNet
    forums where we have professionals who have more knowledge about the issue.



    Hope it helps.



    Regards,

    Prakhar Khare

    Microsoft Community – Moderator
     
    Prakhar_Khare, Oct 27, 2020
    #4
Thema:

How to put them together and batch run them?

Loading...
  1. How to put them together and batch run them? - Similar Threads - put together batch

  2. Windows Apps keep running in the background even when I end them - How to prevent them from...

    in Windows 10 Gaming
    Windows Apps keep running in the background even when I end them - How to prevent them from...: Hi, I am Abdulqadir, and I got a question about Windows 10, it's a bit annoying, and I was trying 3 months to find a way to disable these Background Apps, but they keep restarting, so I posted a question here.It's a little hard to explain, I have Apps running in the...
  3. Windows Apps keep running in the background even when I end them - How to prevent them from...

    in Windows 10 Software and Apps
    Windows Apps keep running in the background even when I end them - How to prevent them from...: Hi, I am Abdulqadir, and I got a question about Windows 10, it's a bit annoying, and I was trying 3 months to find a way to disable these Background Apps, but they keep restarting, so I posted a question here.It's a little hard to explain, I have Apps running in the...
  4. Windows Apps keep running in the background even when I end them - How to prevent them from...

    in Windows 10 Network and Sharing
    Windows Apps keep running in the background even when I end them - How to prevent them from...: Hi, I am Abdulqadir, and I got a question about Windows 10, it's a bit annoying, and I was trying 3 months to find a way to disable these Background Apps, but they keep restarting, so I posted a question here.It's a little hard to explain, I have Apps running in the...
  5. how to run or convert apk files to exe or run them on windows 10

    in Windows 10 Network and Sharing
    how to run or convert apk files to exe or run them on windows 10: hello before you say get an android emluator please dont i want the file on windows 10 itself and no there is not a exe file of the program im trying to run and yes ive tryed on my android phone but it needs a keyboard and my bluetooth one wont connect for some reson so my...
  6. Open two windows , then put them side by side

    in Windows 10 Customization
    Open two windows , then put them side by side: I want to be able to open two windows on the computer screen, then put them side by side. I have looked at all the windows 10 forums and still no luck. The answers did not match my windows 10 0/S system/ My computer is new in Jan 2021. Thanks [Original subject:...
  7. Dual monitor, how to turn off/ put one of them to sleep

    in Windows 10 Graphic Cards
    Dual monitor, how to turn off/ put one of them to sleep: Hi all, Are there any native win10 or 3rd party app that allows me to turn off/ put one of the monitor to sleep without using the power on/off switch? Reason being I'm only using the 2nd monitor for certain portrait layout tasks, majority of the time it's just distraction...
  8. Dual monitor, how to turn off/ put one of them to sleep

    in Windows 10 Support
    Dual monitor, how to turn off/ put one of them to sleep: Hi all, Are there any native win10 or 3rd party app that allows me to turn off/ put one of the monitor to sleep without using the power on/off switch? Reason being I'm only using the 2nd monitor for certain portrait layout tasks, majority of the time it's just distraction...
  9. marking batch emails without checking off all of them

    in Windows 10 Network and Sharing
    marking batch emails without checking off all of them: Does anyone know if you can mark a batch of emails without checking each one. I used to be able to mark the beginning then scroll down and mark the end email while holding the shift key. It doesn't work with the windows 10 mail....
  10. Files and Folders have nothing I put in them but have this kind of stuff in them

    in AntiVirus, Firewalls and System Security
    Files and Folders have nothing I put in them but have this kind of stuff in them: <?xml version="1.0" encoding="UTF-8"?> <root><SystemConfig><DEP OverrideDEP="false" EmulateAtlThunks="false" Enable="true"/><ASLR Enable="true" OverrideForceRelocateImages="false" ForceRelocateImages="false"/><ControlFlowGuard Enable="false" OverrideStrictCFG="false"...