我有一个.bat脚本,可将自定义文件夹添加到文件资源管理器导航窗格。
我可以看到新的扩展名,来自 Microsoft Word的OneDrive和GDrive。和默认的文件浏览器。
我无法从 Microsoft Visual Studio 看到新的扩展程序或GDrive,但是我可以看到OneDrive和它自己的回购文件夹。
所以我认为程序中有一些设置要显示什么取决于注册表项。 因此,我希望代码中缺少一些关键。哪个OneDrive有。 :思考:
:: Step 1: get the uids from here -> https://www.guidgen.com/
@set CLSID=82ca13c3-a60c-46fa-b805-fca6dc0cd75f
@set apperance_name=""
@set icon_path=""
@set folder_path=""
:: Step 1: Add your CLSID and name your extension
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%} /f /ve /t REG_SZ /d %apperance_name% >nul 2>&1
:: Step 2: Set the image for your icon
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\DefaultIcon /f /ve /t REG_EXPAND_SZ /d %icon_path% >nul 2>&1
:: Step 3: Add your extension to the Navigation Pane and make it visible
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%} /f /v System.IsPinnedToNamespaceTree /t REG_DWORD /d 0x1 >nul 2>&1
:: Step 4: Set the location for your extension in the Navigation Pane
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%} /f /v SortOrderIndex /t REG_DWORD /d 0x42 >nul 2>&1
:: Step 5: Provide the dll that hosts your extension.
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\InProcServer32 /f /ve /t REG_EXPAND_SZ /d "%SystemRoot%\system32\shell32.dll" >nul 2>&1
:: Step 6: Define the instance object
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\Instance /f /v CLSID /t REG_SZ /d "{0E5AAE11-A475-4c5b-AB00-C66DE400274E}" >nul 2>&1
:: Step 7: Provide the file system attributes of the target folder
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\Instance\InitPropertyBag /f /v Attributes /t REG_DWORD /d 0x11 >nul 2>&1
:: Step 8: Set the path for the sync root
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\Instance\InitPropertyBag /f /v TargetFolderPath /t REG_EXPAND_SZ /d %folder_path% >nul 2>&1
:: Step 9: Set appropriate shell flags
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\ShellFolder /f /v FolderValueFlags /t REG_DWORD /d 0x28 >nul 2>&1
:: Step 10: Set the appropriate flags to control your shell behavior
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\ShellFolder /f /v Attributes /t REG_DWORD /d 0xF080004D >nul 2>&1
:: Step 11: Register your extension in the namespace root
@reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{%CLSID%} /f /ve /t REG_SZ /d %apperance_name% >nul 2>&1
:: Step 12: Hide your extension from the Desktop
@reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /f /v {%CLSID%} /t REG_DWORD /d 0x1 >nul 2>&1
答案 0 :(得分:0)
好,我知道了。这是用于添加到简单文件浏览器并在另一个程序的文件浏览器中查看的完整代码。
要在程序的文件浏览器中查看,您需要在HKEY_CLASSES_ROOT\WOW6432Node\CLSID
中添加相同的密钥。
当心!您需要修改第二个图标路径,因为该部分看不到C:\Windows\..etc
文件夹。
之后,您就可以准备好了!
:: Step 1: get the uids from here -> https://www.guidgen.com/
:: HKEY_CURRENT_USER\Software\Classes\CLSID\{82ca13c3-a60c-46fa-b805-fca6dc0cd75f}
:: HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{82ca13c3-a60c-46fa-b805-fca6dc0cd75f}
@set CLSID=82ca13c3-a60c-46fa-b805-fca6dc0cd75f
@set apperance_name=""
@set icon_path=""
@set icon_secondpath=""
@set folder_path=""
:: Step 1: Add your CLSID and name your extension
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%} /f /ve /t REG_SZ /d %apperance_name% >nul 2>&1
:: Step 2: Set the image for your icon
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\DefaultIcon /f /ve /t REG_EXPAND_SZ /d %icon_path% >nul 2>&1
:: Step 3: Add your extension to the Navigation Pane and make it visible
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%} /f /v System.IsPinnedToNamespaceTree /t REG_DWORD /d 0x1 >nul 2>&1
:: Step 4: Set the location for your extension in the Navigation Pane
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%} /f /v SortOrderIndex /t REG_DWORD /d 0x42 >nul 2>&1
:: Step 5: Provide the dll that hosts your extension.
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\InProcServer32 /f /ve /t REG_EXPAND_SZ /d "%SystemRoot%\system32\shell32.dll" >nul 2>&1
:: Step 6: Define the instance object
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\Instance /f /v CLSID /t REG_SZ /d "{0E5AAE11-A475-4c5b-AB00-C66DE400274E}" >nul 2>&1
:: Step 7: Provide the file system attributes of the target folder
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\Instance\InitPropertyBag /f /v Attributes /t REG_DWORD /d 0x11 >nul 2>&1
:: Step 8: Set the path for the sync root
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\Instance\InitPropertyBag /f /v TargetFolderPath /t REG_EXPAND_SZ /d %folder_path% >nul 2>&1
:: Step 9: Set appropriate shell flags
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\ShellFolder /f /v FolderValueFlags /t REG_DWORD /d 0x28 >nul 2>&1
:: Step 10: Set the appropriate flags to control your shell behavior
@reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{%CLSID%}\ShellFolder /f /v Attributes /t REG_DWORD /d 0xF080004D >nul 2>&1
:: Step 11: Register your extension in the namespace root
@reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{%CLSID%} /f /ve /t REG_SZ /d %apperance_name% >nul 2>&1
:: Step 12: Hide your extension from the Desktop
@reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /f /v {%CLSID%} /t REG_DWORD /d 0x1 >nul 2>&1
:: It will add a copy of it, so it will appear in programs file explorer like Microsoft Visual Studio
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%} /f /ve /t REG_SZ /d %apperance_name% >nul 2>&1
:: You need to give a different path to this icon, because this part can't see the C:\Windows\...etc
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%}\DefaultIcon /f /ve /t REG_EXPAND_SZ /d %icon_secondpath% >nul 2>&1
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%} /f /v System.IsPinnedToNamespaceTree /t REG_DWORD /d 0x1 >nul 2>&1
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%} /f /v SortOrderIndex /t REG_DWORD /d 0x42 >nul 2>&1
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%}\InProcServer32 /f /ve /t REG_EXPAND_SZ /d "%SystemRoot%\system32\shell32.dll" >nul 2>&1
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%}\Instance /f /v CLSID /t REG_SZ /d "{0E5AAE11-A475-4c5b-AB00-C66DE400274E}" >nul 2>&1
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%}\Instance\InitPropertyBag /f /v Attributes /t REG_DWORD /d 0x11 >nul 2>&1
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%}\Instance\InitPropertyBag /f /v TargetFolderPath /t REG_EXPAND_SZ /d %folder_path% >nul 2>&1
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%}\ShellFolder /f /v FolderValueFlags /t REG_DWORD /d 0x28 >nul 2>&1
@reg add HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{%CLSID%}\ShellFolder /f /v Attributes /t REG_DWORD /d 0xF080004D >nul 2>&1