简体   繁体   English

使用 REGValue 在任务栏中创建 Windows 工具栏

[英]Create Windows ToolBar in TaskBar with REGValue

i am currently working on a demo deployment where custom toolbars for users are a requirement.我目前正在开发一个演示部署,其中需要为用户提供自定义工具栏。

Normally you create those toolbars as the user directly with right click to the taskbar and than toolbars and create new.通常,您直接以用户身份创建这些工具栏,右键单击任务栏而不是工具栏并创建新工具栏。 Not like the pinned items which many people suggest creating by a other value and folder.不像许多人建议通过其他值和文件夹创建的固定项目。

As i did some research it turns out it's not easy to do this in a script or program (i am working mostly with C# and PowerShell).我做了一些研究,结果证明在脚本或程序中做到这一点并不容易(我主要使用 C# 和 PowerShell)。 I already found out that the REG-Binary key under:我已经发现 REG-Binary 键位于:

HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Streams\\Desktop HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Streams\\Desktop

holds the info i want to rewrite but i am unable to decode this value or create a new value for new mappings.保存我想重写的信息,但我无法解码此值或为新映射创建新值。 I also did try the export import stuff which is very troublesome because the values are somewhat influenced by username (of cause it is in the user context) and the machine name the settings are created at.我也尝试了导出导入的东西,这很麻烦,因为这些值在某种程度上受用户名(因为它在用户上下文中)和创建设置的机器名称的影响。

Has anybody worked with those values before and can give an insight of how microsoft is encoding them?有没有人以前使用过这些值,并且可以深入了解微软如何对它们进行编码? It seems to be something like a old savestate in a game where according to the bytes changed diffrent states are active.这似乎有点像游戏中的旧保存状态,其中根据字节更改不同的状态处于活动状态。 These are the inner parts i could so far figure out myself.这些是我迄今为止可以自己弄清楚的内部部分。

I would love to build a tool to de and encode the settings in the TaskbarWinXP key and make it open source we all can profit from this.我很想构建一个工具来对 TaskbarWinXP 密钥中的设置进行解码和编码,并使其开源,我们都可以从中受益。

It is not easy to decode it, there is some magic there.解码它并不容易,那里有一些魔法。 And if you change the computer name inside the reg it will not work, because in the reg it is coded the size of the computer name.如果您更改 reg 内的计算机名称,它将不起作用,因为在 reg 中,它被编码为计算机名称的大小。 but there is a solution.但有一个解决方案。

as you said, first create the toolbar put it in the position you want, then save the reg :正如你所说,首先创建工具栏把它放在你想要的位置,然后保存 reg :

reg export HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop taskbar_toolbar_Backup.reg

and if you want to save the position of the taskbar too (left dock, bottom ...etc) ,then save this too:如果您也想保存任务栏的位置(左停靠栏,底部...等),也请保存:

REM change StuckRects2 to StuckRects3 if you are in win10
reg export HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2 taskbar_position.reg

now the important part, you will of course copy the reg to another computer but it have to be the same OS (xp to xp , win 7 to win 7 ...etc) create the folder needed then run both REGs, but it will not work because explorer will reset the registry again.现在是重要的部分,您当然会将 reg 复制到另一台计算机,但它必须是相同的操作系统(xp 到 xp,win 7 到 win 7 ...等)创建所需的文件夹,然后运行两个 REG,但它会不起作用,因为资源管理器将再次重置注册表。 the solution I found is to close the explorer first then run the reg then run again explorer and voila , it works, windows will accept the computer name of the other PC, and will update it automatically in next login, so do not worry about.我找到的解决方案是先关闭资源管理器然后运行reg然后再次运行资源管理器和瞧,它的工作原理,Windows将接受另一台PC的计算机名称,并在下次登录时自动更新它,所以不用担心。

@echo off
REM mkdir path\to\folder 

taskkill /f /im explorer.exe

reg import Taskbar-Toolbars-Backup.reg"
reg import taskbar_position.reg

start explorer.exe

that is all.就这些。

now if the folder path will be fix then you are good to go, but if you want to change it pragmatically in other PC's then here is how:现在,如果文件夹路径将被修复,那么您就可以开始了,但是如果您想在其他 PC 中以务实的方式更改它,那么方法如下:

I could not find any solution so I made this workaround: first I create a shortcut of any folder to a permanent fixed path, for example I will save the shortcut to system32 or the home folder.我找不到任何解决方案,所以我做了这个解决方法:首先我创建一个任何文件夹的快捷方式到一个永久的固定路径,例如我将快捷方式保存到 system32 或主文件夹。 then we begin this guide from the beginning, but instead of using the folder you want to convert to toolbar we will put the shortcut that we have created now inside the taskbar(it will work as if it was a folder and show it s content as a folder would do).然后我们从头开始本指南,但不是使用您要转换为工具栏的文件夹,而是将我们现在创建的快捷方式放在任务栏中(它将像文件夹一样工作并将其内容显示为一个文件夹就可以了)。 now you can save the backup of the reg value and copy the reg to other pc and continue with steps as I explained before.现在您可以保存 reg 值的备份并将 reg 复制到其他 PC 并继续执行我之前解释的步骤。

as you see the toolbar now point to a shortcut, so can use the same reg in any computer and you have to edit only the shortcut not the reg.正如您所看到的,工具栏现在指向一个快捷方式,因此可以在任何计算机中使用相同的 reg,您只需编辑快捷方式而不是 reg。 creating and editing the shortcut is easy and there is a lot of guides and tools to do it pragmatically, so I will not explain it.创建和编辑快捷方式很容易,并且有很多实用的指南和工具可以做到这一点,所以我不会解释它。

of course now you have to prepare a reg for every OS , one for xp , one for win 7 , another for win8.1 and one for win10 , and from now you can use those reg's anywhere and you have to change only the shortcut当然现在你必须为每个操作系统准备一个reg,一个用于xp,一个用于win 7,另一个用于win8.1,一个用于win10,从现在开始你可以在任何地方使用这些reg,你只需要改变快捷方式

one more thing;还有一件事; what happens if you save the shortcut in D:\\ and now you want to change it to C:\\for example ?例如,如果您将快捷方式保存在 D:\\ 中,现在您想将其更改为 C:\\ 会发生什么? you can edit the reg easily for this, you have to change only two letters (a hex), you can look in the regedit to see the binary as decimal , then find the position of the letter , now in the reg file change those two letters to mydrive , and from now you can change the reg pragmatically easily by replacing mydrive with the hex of your wanted drive.and of course you have to respect the same path saved in the reg, fr example if you saved the shortcut in the reg as d:\\path\\to\\folder then you can change D drive to C drive but use the same folder structure :\\path\\to\\folder , so it become c:\\path\\to\\folder您可以为此轻松编辑reg,您只需更改两个字母(十六进制),您可以在regedit中查看二进制为十进制,然后找到字母的位置,现在在reg文件中更改这两个mydrive字母,从现在开始,您可以通过将mydrive替换为您想要的驱动器的十六进制来轻松地更改 reg。当然,您必须尊重保存在 reg 中的相同路径,例如,如果您将快捷方式保存在 reg 中作为d:\\path\\to\\folder那么你可以将D盘改为C盘但使用相同的文件夹结构:\\path\\to\\folder ,所以它变成c:\\path\\to\\folder

I think with this there is no need to decrypt the binary inside that reg which no one did until now (while the other reg StuckRects2 they decrypted it; but this one no one I know did it yet)我认为这样就没有必要解密那个 reg 中的二进制文件,直到现在没有人这样做(而另一个 reg StuckRects2他们解密了它;但是我认识的这个人还没有这样做)

resources资源

  • Force Taskbar Toolbar to All Users link强制任务栏工具栏到所有用户链接
  • DISPLAY COMPUTER NAME IN START MENU AND WINDOWS EXPLORER WITH GPO link使用 GPO 链接在开始菜单和 WINDOWS 资源管理器中显示计算机名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM