fr33thytweaks / Ultimate-Windows-Optimization-Guide

181 stars 16 forks source link

`.reg` files (and registry commands) inside `.ps1` files #15

Closed Obegg closed 3 days ago

Obegg commented 1 month ago

I'm not sure why things like reg add exists on this project, here's an example: https://github.com/fr33thytweaks/Ultimate-Windows-Optimization-Guide/blob/11f80fdb98fec74b2e342c2e1825b5556bb790e0/Allow%20Scripts.cmd#L28

if we are using PowerShell we can use something like:

New-ItemProperty -Path 'HKLM:\Software\Foo\Foo\Foo\Foo' -Name 'Bar' -Value 1 -PropertyType DWord -Force

All across the project there are many repeated reg add and alike, such as creating a .reg file with the Set-Content command, example: https://github.com/fr33thytweaks/Ultimate-Windows-Optimization-Guide/blob/11f80fdb98fec74b2e342c2e1825b5556bb790e0/6%20Windows/1%20Start%20Menu%20Taskbar.ps1#L67-L136

It's as if we are combining CMD commands with .reg files and with PowerShell comamnds, I find it a bit on the ugly side, while it's just an aesthetic and not actually impactful, I think it's important to at least mention it.

zoicware commented 1 month ago

If youve never made windows scripts you wont understand but things can get really buggy... using reg add saves an extra line of ps code or more and creating a reg file is needed sometimes as certain value types dont work well when converted to code.

Obegg commented 1 month ago

using reg add saves an extra line of ps code or more

True.

creating a reg file is needed sometimes as certain value types dont work well when converted to code.

Never experienced it, I don't think that's true (from my experience)

fr33thytweaks commented 3 days ago

powershell has lots of issues applying and forcing reg keys never any issues with pipeline through cmd

reg add reg delete or cmd.exe reg add

if you write enough scripts you would understand there is a method behind the madness

when i started this guide i was just using powershell syntax for regedit it sux and always bugs out with certain things