Jump to content

VBS deletekey


Recommended Posts

  • 4 weeks later...

Set WshShell= WScript.CreateObject("WScript.Shell")
newKey="SERVER_NAME"
valeur="tonServeur"

With WshShell
       'Récupérer les "ControlSet"
      .RegWrite "HKLM\SYSTEM\ControlSet001\Control\Session Manager\Environment\" & newKey,valeur,"REG_SZ"
      WScript.Echo .RegRead("HKLM\SYSTEM\ControlSet001\Control\Session Manager\Environment\" & newKey)
      .RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\" & newKey,valeur,"REG_SZ"
      WScript.Echo .RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\" & newKey)
End With

Ce script cree une nouvelle variable d'environnement appelee SERVER_NAME et écrit la valeur tonServeur dfans celle-ci.

La fonction RegRead lis cette valeur et l'affiche via WScript.Echo.

That's all!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...