Usuário com melhor resposta
modificar registro via vbs

Pergunta
-
Gurus da info
Ajudai este pobre mortal....
A situação eh a seguinte: Gostaria de modificar uma chave de registro no Windows atravez de arquivo.vbs
Hoje realizo via arquivo.reg utilizando o seguinte codigo :
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\CIM-Team\E3.series\10.0\]
"Language"="55"Como efetuar esse mesmo registro atraves de script
Desde já agradeço a colaboração!
Respostas
-
Segue script.
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\CIM-Team\E3.series\10.0\"
strValueName = "Language"
strValue = "55"
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValueAbraço.
Gabriel Nascimento MCP / MCSA / CCNA http://gabrielnascimentoit.spaces.live.com -- Se for útil vote.- Marcado como Resposta jovir quarta-feira, 5 de maio de 2010 20:05
Todas as Respostas
-
Faça o seguinte, salve esse seu arquivo como .reg, exemplo Language.Reg e salve esse código abaixo como .vbs.
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "regedit /s \\servidor\share\Language.reg",hiddenSe for útil vote e qualquer dúvida poste.
Abraço.
Gabriel Nascimento MCP / MCSA / CCNA http://gabrielnascimentoit.spaces.live.com -- Se for útil vote. -
-
Só confirme no regedit qual o tipo dessa entrada Language, se é DWORD, REG_SZ.
Mas teste com esse script, deve funcionar.
Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "Software\CIM-Team\E3.series\10.0\"
strValueName = "Language"
strValue = "55"
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValueAbraço.
Gabriel Nascimento MCP / MCSA / CCNA http://gabrielnascimentoit.spaces.live.com -- Se for útil vote. -
-
Cara, esse número hexa decimal está relacionado ao LOCAL_MACHINE, e para no script ficar mais fácil de entender criamos uma constante com o nome mais amigavel.
Teste esse script, tinha esquecido de uma linha.
Const HKEY_LOCAL_MACHINE = &H80000002
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\CIM-Team\E3.series\10.0\"
strValueName = "Language"
strValue = "55"
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValueAbraço.
Gabriel Nascimento MCP / MCSA / CCNA http://gabrielnascimentoit.spaces.live.com -- Se for útil vote. -
-
Segue script.
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\CIM-Team\E3.series\10.0\"
strValueName = "Language"
strValue = "55"
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValueAbraço.
Gabriel Nascimento MCP / MCSA / CCNA http://gabrielnascimentoit.spaces.live.com -- Se for útil vote.- Marcado como Resposta jovir quarta-feira, 5 de maio de 2010 20:05
-
-