Jump to content

adding a reg file with VBS


Recommended Posts

Hi

I just posted my small script that i would like to run

everything is working fine beside that i dont want that the user will see

the quetion when the reg key is being installed

It ask the user for his permission to add the registry key

Please help

It preety urgent

Thanks

Tzvika

***** VBS ****************

Dim WshShell ' General shell object

Set WshShell = WScript.CreateObject("WScript.Shell")

Const TIMEOUT = 3 ' Time out for popup windows while running logon script

wshShell.Popup "Hello " & UserName & ", your clock is being set...", TIMEOUT

Wshshell.run "1.reg",0, True

******** 1.Reg ***********

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Jerusalem Standard Time]

"Display"="(GMT+02:00) Jerusalem"

"Dlt"=""

"TZI"=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,01,00,00,00,02,00,01,00,00,\

00,00,00,00,00,00,00,03,00,05,00,05,00,02,00,00,00,00,00,00,00

Link to comment
Share on other sites


Or if you want to have the VBS make the reg file then run it then delete the reg file

Dim Act, Fso, RegFile, Ts '''' Varibles For The Script
'''' Object For The Script
Set Act = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
RegFile = Act.ExpandEnvironmentStrings("%SystemDrive%\Set_Time.Reg")
Set Ts = Fso.CreateTextFile(RegFile)
Ts.WriteLine "Windows Registry Editor Version 5.00" & vbCrLf
Ts.WriteLine "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Jerusalem Standard Time]"
Ts.WriteLine """Display""=""(GMT+02:00) Jerusalem"""
Ts.WriteLine """Dlt""="""""
Ts.WriteLine """TZI""=hex:88,ff,ff,ff,00,00,00,00,c4,ff,ff,ff,00,00,01,00,00,00,02,00,01,00,00,\"
Ts.WriteLine "00,00,00,00,00,00,00,03,00,05,00,05,00,02,00,00,00,00,00,00,00"
Act.Popup "Preparing To Change The Time", 3, "Time Change", 0 + 32
Act.Run("regedit /s " & RegFile),0,True
If Fso.FileExists(RegFile) Then Fso.DeleteFile(RegFile) End If

Link to comment
Share on other sites

  • 6 months later...

Is it possible to add or modify a registry file via a vb script or batch file the would grab part of the the data using the %username% variable, I am using folder redirection in our domain, and I have a program that requires a file association of .egp , so when they click on Example.egp it will open \\SERVERNAME\Redirect\KIM HAWS\Easy Grade Pro\egp.exe, and the same for \SERVERNAME\Redirect\tim shay\Easy Grade Pro\egp.exe, ect.. in the registry under classes is the location of where i want to associate a program with the .egp file extension, but the location of the program to execute it changes with each logged in user.. The data path goes to their logged in username, so I can use the %username% variable somewhere, but the registry does not understand that.. Maybe some help on a batch file or .vbs that might grab the info from %username% and put it into the registry or just create a .reg key that I can add to the registry further down the login script after the new data has been created into the reg file.. Thanks for any help anyone can offer..

Link to comment
Share on other sites

@ Stealth111

What about this 'batch file' example:

1: @ECHO OFF
2: REG ADD HKLM\SOFTWARE\Classes\.egp /VE /D "egpfile" /F >NUL
3: REG ADD HKLM\SOFTWARE\Classes\egpfile /VE /D "Easy Grade Pro File" /F >NUL
4: REG ADD HKLM\SOFTWARE\Classes\egpfile\shell\open\command /VE /T REG_EXPAND_SZ /D "\"\\SERVERNAME\Redirect\%%USERNAME%%\Easy Grade Pro\egp.exe\" %%1" /F >NUL

Please remove the line numbers, they are only added to identify wrapped lines.

Edited by Yzöwl
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...