Registro do Windows para Novo Menu com Arquivos em Lote

1

Como posso adicionar um item ao 'novo' menu de contexto?

Isso mostra como adicionar itens ao menu suspenso "Novo". Que tal levá-los embora?

Além disso, quero criar um arquivo em lote que automatize isso. Assim:

@echo off
echo Enter you file extension
set /p ext=
copy con ext.reg
echo Windows Registry Editor Version 5.00 >> ext.reg
echo. >> ext.reg
echo [HKEY_CLASSES_ROOT\.%ext%\ShellNew] >> ext.reg
echo "NullFile"="" >> ext.reg
start /wait ext.reg
del ext.reg
echo Complete
exit
  1. Algo de errado com isso, em geral?
  2. Você pode gravar em outros tipos de arquivos que não são de texto, como arquivos de registro com arquivos em lote?
  3. Por favor, me diga o código do registro para remover um item, para que eu possa adicionar isso.
  4. O mais importante, um arquivo de registro pode interagir com o usuário, como inserir e fazer uma variável, então não preciso de um arquivo de lote?
por Jam35B0nd. 29.02.2012 / 15:43

4 respostas

2

  1. Eu não posso julgar isso, desculpe.
  2. Eu não conheço uma boa maneira de escrever arquivos binários (não textuais) a partir de um script em lote.
  3. Você também pode remover uma chave do Registro usando um arquivo .reg . Simplesmente colocando colocando um hífen antes da chave .

    To delete a registry key with a .reg file, put a hyphen (-) in front of the RegistryPath in the .reg file. For example, to delete the Test subkey from the following registry key: HKEY_LOCAL_MACHINE\Software
    put a hyphen in front of the following registry key in the .reg file: HKEY_LOCAL_MACHINE\Software\Test
    The following example has a .reg file that can perform this task.
    [
    -HKEY_LOCAL_MACHINE\Software\Test
    ]

  4. Um arquivo de registro é usado apenas para manipular a seção do Registro. Nenhuma interação do usuário (além de um prompt de confirmação) é suportada no processo até onde eu sei.

por 29.02.2012 / 16:13
1
  1. Absolutamente não, apenas certifique-se de fazer o backup do registro antes de ficar louco.
  2. Não é muito fácil. Você seria muito melhor simplesmente escrever um arquivo .reg, que pode lidar com praticamente tudo que você precisa.
  3. Em um arquivo .reg, basta adicionar um '-' (menos) após o colchete de abertura do item a ser removido. Veja o exemplo abaixo.
  4. Não. Talvez escreva um script (ou arquivo de lote) para automatizar a geração de um arquivo .reg, que pode então ser invocado.

Aqui está o conteúdo do arquivo de registro que eu uso para eliminar muitos dos novos itens de modelo comuns do Windows 7. Sinta-se à vontade para usá-lo como base para o seu próprio. LEMBRE-SE DE RESERVAR O REGISTRO PRIMEIRO .

    Windows Registry Editor Version 5.00
;Remove everything from the "New" menu other than folder and .txt

; MFC Trace file
[-HKEY_CLASSES_ROOT\.trc\ShellNew]

;Briefcase
[-HKEY_CLASSES_ROOT\Briefcase\ShellNew\Config]
[-HKEY_CLASSES_ROOT\Briefcase\ShellNew]

; Bitmap
[-HKEY_CLASSES_ROOT\.bmp\ShellNew]

; Contact
[-HKEY_CLASSES_ROOT\.contact\ShellNew]

; Skype Contact
[-HKEY_CLASSES_ROOT\.skype\Skype.Content\ShellNew]

; Link
[-HKEY_CLASSES_ROOT\.lnk\ShellNew]

; Microsoft Word Documents
[-HKEY_CLASSES_ROOT\.doc\Word.Document.8\ShellNew]
[-HKEY_CLASSES_ROOT\.dochtml\wordhtmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.docm\Word.DocumentMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.docx\Word.Document.12\ShellNew]
[-HKEY_CLASSES_ROOT\.docxml\wordxmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.dot\Word.Template.8\ShellNew]
[-HKEY_CLASSES_ROOT\.dothtml\wordhtmltemplate\ShellNew]
[-HKEY_CLASSES_ROOT\.dotm\Word.TemplateMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.dotx\Word.Template.12\ShellNew]
[-HKEY_CLASSES_ROOT\.rtf\Word.RTF.8\ShellNew]
[-HKEY_CLASSES_ROOT\.wbk\Word.Backup.8\ShellNew]
[-HKEY_CLASSES_ROOT\.wiz\Word.Wizard.8\ShellNew]
[-HKEY_CLASSES_ROOT\.wll\Word.Addin.8\ShellNew]
[-HKEY_CLASSES_ROOT\.rtf\ShellNew]

; Microsoft Excel Documents
[-HKEY_CLASSES_ROOT\.csv\Excel.CSV\ShellNew]
[-HKEY_CLASSES_ROOT\.oft\Outlook.File.oft.14\ShellNew]
[-HKEY_CLASSES_ROOT\.slk\Excel.SLK\ShellNew]
[-HKEY_CLASSES_ROOT\.xla\Excel.Addin\ShellNew]
[-HKEY_CLASSES_ROOT\.xlam\Excel.AddInMacroEnabled\ShellNew]
[-HKEY_CLASSES_ROOT\.xld\Excel.Dialog\ShellNew]
[-HKEY_CLASSES_ROOT\.xlk\Excel.Backup\ShellNew]
[-HKEY_CLASSES_ROOT\.xll\Excel.XLL\ShellNew]
[-HKEY_CLASSES_ROOT\.xlm\Excel.Macrosheet\ShellNew]
[-HKEY_CLASSES_ROOT\.xlsb\Excel.SheetBinaryMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.xlshtml\Excelhtmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.xlsm\Excel.SheetMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.xlsx\Excel.Sheet.12\ShellNew]
[-HKEY_CLASSES_ROOT\.xlt\Excel.Template.8\ShellNew]
[-HKEY_CLASSES_ROOT\.xlthtml\Excelhtmltemplate\ShellNew]
[-HKEY_CLASSES_ROOT\.xltm\Excel.TemplateMacroEnabled\ShellNew]
[-HKEY_CLASSES_ROOT\.xltx\Excel.Template\ShellNew]
[-HKEY_CLASSES_ROOT\.xlw\Excel.Workspace\ShellNew]
[-HKEY_CLASSES_ROOT\.xls\Excel.Sheet.8\ShellNew]

; Microsoft Powerpoint Documents
[-HKEY_CLASSES_ROOT\.pot\PowerPoint.Template.8\ShellNew]
[-HKEY_CLASSES_ROOT\.pothtml\powerpointhtmltemplate\ShellNew]
[-HKEY_CLASSES_ROOT\.potm\PowerPoint.TemplateMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.potx\PowerPoint.Template.12\ShellNew]
[-HKEY_CLASSES_ROOT\.ppa\PowerPoint.Addin.8\ShellNew]
[-HKEY_CLASSES_ROOT\.ppam\PowerPoint.Addin.12\ShellNew]
[-HKEY_CLASSES_ROOT\.pps\PowerPoint.SlideShow.8\ShellNew]
[-HKEY_CLASSES_ROOT\.ppsm\PowerPoint.SlideShowMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.ppsx\PowerPoint.SlideShow.12\ShellNew]
[-HKEY_CLASSES_ROOT\.ppt\PowerPoint.Show.8\ShellNew]
[-HKEY_CLASSES_ROOT\.ppthtml\powerpointhtmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.pptm\PowerPoint.ShowMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.pptx\PowerPoint.Show.12\ShellNew]
[-HKEY_CLASSES_ROOT\.pptxml\powerpointxmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.pwz\PowerPoint.Wizard.8\ShellNew]
[-HKEY_CLASSES_ROOT\.sldm\PowerPoint.SlideMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.sldx\PowerPoint.Slide.12\ShellNew]

; Microsoft Outlook entries
[-HKEY_CLASSES_ROOT\.msg\Outlook.File.msg.14\ShellNew]
[-HKEY_CLASSES_ROOT\.vcf\Outlook.File.vcf.14\ShellNew]
[-HKEY_CLASSES_ROOT\.hol\Outlook.File.hol.14\ShellNew]
[-HKEY_CLASSES_ROOT\.ics\Outlook.File.ics.14\ShellNew]
[-HKEY_CLASSES_ROOT\.pst\Outlook.File.pst.14\ShellNew]
[-HKEY_CLASSES_ROOT\.vcs\Outlook.File.vcs.14\ShellNew]

; Microsoft Visio Drawing
[-HKEY_CLASSES_ROOT\.vdx\Visio.Drawing.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vsd\Visio.Drawing.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vss\Visio.Stencil.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vst\Visio.Template.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vsw\Visio.Workspace.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vsx\Visio.Stencil.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vtx\Visio.Template.11\ShellNew]

; Microsoft Project Document
[-HKEY_CLASSES_ROOT\.mpp\MSProject.Project.9\ShellNew]
[-HKEY_CLASSES_ROOT\.mpt\MSProject.Template\ShellNew]
[-HKEY_CLASSES_ROOT\.mpw\MSProject.Workspace\ShellNew]
[-HKEY_CLASSES_ROOT\.mpx\MSProject.MPX\ShellNew]
[-HKEY_CLASSES_ROOT\.mpd\MSProject.MPD\ShellNew]
[-HKEY_CLASSES_ROOT\.mpf\MediaPackageFile\ShellNew]

; Microsoft OneNote
[-HKEY_CLASSES_ROOT\.one\OneNote.Section.1\ShellNew]
[-HKEY_CLASSES_ROOT\.onepkg\OneNote.Package\ShellNew]
[-HKEY_CLASSES_ROOT\.onetoc\OneNote.TableOfContents\ShellNew]
[-HKEY_CLASSES_ROOT\.onetoc2\OneNote.TableOfContents.12\ShellNew]

; Microsoft Graph
[-HKEY_CLASSES_ROOT\.gra\MSGraph.Chart.8\ShellNew]

; Microsoft Office Theme
[-HKEY_CLASSES_ROOT\.thmx\OfficeTheme.12\ShellNew]

; Microsoft Office List Shortcut
[-HKEY_CLASSES_ROOT\.ols\OfficeListShortcut\ShellNew]

; Microsoft Journal Entry
[-HKEY_CLASSES_ROOT\.jnt\jntfile\ShellNew]

; Microsoft Publisher
[-HKEY_CLASSES_ROOT\.pub\Publisher.Document.14\ShellNew]

; PCB
[-HKEY_CLASSES_ROOT\.pcb\PCBFile\ShellNew]

; PDX
[-HKEY_CLASSES_ROOT\.pdx\PDXFileType\ShellNew]

; UMP Profile
[-HKEY_CLASSES_ROOT\.umprofile\umprofilefile\ShellNew]

; UMS Shortcut
[-HKEY_CLASSES_ROOT\.umshortcut\umshortcutfile\ShellNew]

; Zip
[-HKEY_CLASSES_ROOT\.zip\CompressedFolder\ShellNew]
    
por 01.03.2012 / 23:06
0

Basta remover esta linha para que funcione:

copy con ext.reg
    
por 09.03.2013 / 17:02
0

na verdade você pode programar / ler / interagir programaticamente com o registro ...

[uso, @ cmd] reg /?

para excluir (via reg /? | clip:)

nome_de_chave do comando DELETE do REG [/ v ValueName | / ve | / va] [/ f]

KeyName [\ Machine] FullKey     Nome da máquina da máquina remota - omitindo os padrões da máquina atual.              Apenas HKLM e HKU estão disponíveis em máquinas remotas.     FullKey ROOTKEY \ SubKey     ROOTKEY [HKLM | HKCU | HKCR | HKU | HKCC]     SubKey O nome completo de uma chave de registro sob o ROOTKEY selecionado.

ValueName O nome do valor, sob a chave selecionada, para excluir.              Quando omitido, todas as subchaves e valores da chave são excluídos.

/ ve exclui o valor do nome do valor vazio (padrão).

/ va exclui todos os valores sob essa chave.

/ f Força a exclusão sem prompt.

Exemplos:

REG DELETE HKLM \ Software \ MyCo \ MyApp \ Timeout     Exclui a chave do Registro Timeout e todas as subchaves e valores

REG DELETE \ ZODÍACO \ HKLM \ Software \ MyCo / v MTU     Exclui o valor do registro MTU sob MyCo no ZODIAC

    
por 24.04.2014 / 17:41