JayDogg Posted December 13, 2008 Posted December 13, 2008 Ok here is the deal my boss asked me if I could make it so people can not change the theme's on our work computer cause we have a custom made theme for our company with is on every pc. I know how to edit the reg to set a defult theme and how to take away the display properties theme and desktop tabs. But want I wanted to do to make this easy to put on the many computers we have is have a batch script run or add the keys silent.so here are my 3 keys and their file names which I madedefult_theme.regno_theme_tab.regno_background.reglet say they live at C:\ (so when you help me you know the path to where they are)So can anyone help me write the code to the batch script? It should add each one of those reg files to the registry silentlyOnce I have got help with that I would also like to know(cause I made those reg files in regedit.exe and exported them)if there is away to write to the registry useing a batch script with out having .reg files made or using any other file then the batchscript itsselfThe first reg file lives hereHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Systemthe Value name isSetVisualStyle the Value data is C:\WINDOWS\Resources\Themes\whatever theme.msstylesWell thats what I want to do so any help would be great Thanks Jay Dogg
JayDogg Posted December 13, 2008 Author Posted December 13, 2008 Ok well that first part was easy all I needed was REGEDIT /S no_background_tab.regbut I would still like to know if there is away to write to the registry using a batch script with out having .reg files made or using any other file then the batch script itsselfhere are the 3 I would like add to the reg with just a batch scriptReg keyHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Systemstring valueValue name SetVisualStyleValue dataC:\WINDOWS\Resources\Themes\whatever theme.msstylesHere is the second oneReg KeyHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\SystemDWORD valueValue nameNoDispBackgroundPageValue data1and the last one Reg KeyHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ExplorerDWORD valueValue name NoThemesTabValue data 1
jaclaz Posted December 13, 2008 Posted December 13, 2008 REG.EXE:http://www.ss64.com/nt/reg.htmlThere are a great number of examples on the board about it's use, expecially by Yzöwl , IcemanND and me.http://www.google.com/search?q=site:www.msfn.org+REG.EXEjaclaz
gunsmokingman Posted December 13, 2008 Posted December 13, 2008 If you want to try a VBS script for your Reg, this is using the values you provided.Save As CustomTheme.vbsDim Act :Set Act = CreateObject("Wscript.Shell")Dim Key :Key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies" Act.RegWrite Key & "\System\SetVisualStyle", "C:\WINDOWS\Resources\Themes\whatever theme.msstyles", "REG_EXPAND_SZ" Act.RegWrite Key & "\NoDispBackgroundPage", 1, "REG_DWORD" Act.RegWrite Key & "\Explorer\NoThemesTab", 1, "REG_DWORD"
JayDogg Posted January 2, 2009 Author Posted January 2, 2009 Well I need a little more help So I wanted to add ResHacker to the rightclick on all filesI have it working but I would like to use reg add in a batch script to add it to the reghere is what I did I went to HKEY_CLASSES_ROOT\*\shelland added a key call ResHacker which left me with HKEY_CLASSES_ROOT\*\shell\ResHackerI then added a key call command with a data value of C:\\Program Files\\ResHacker\\ResHacker.exe \"%1\"And that worked just great so I exported the key and named it ResHacker.regwhich looks like this in notepad Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\*\shell\ResHacker\command]@="C:\\Program Files\\ResHacker\\ResHacker.exe \"%1\""So I made a batch script which looks like thisREGEDIT /s Reshacker.regbut it does nothingI know the Reshacker.reg works cause when I double click itit ask's if I want to add it to the reg and when I click yes it does So can any one show me how to make this work and even better if someone could show me how to do it with reg add (which I tried but couldnt get to work)Here is what I had reg add HKEY_CLASSES_ROOT\*\shell\ResHacker /v command /t REG_SZ /d C:\\Program Files\\ResHacker\\ResHacker.exe \"%1\"So please help me make a .cmd or .bat file that add this to the reg without promt Thanks Jay Dogg
Yzöwl Posted January 2, 2009 Posted January 2, 2009 reshack.cmd@Reg add "HKLM\SOFTWARE\Classes\*\shell\Open with ResHacker\command" /ve /d "\"C:\Program Files\ResHacker\ResHacker.exe\" \"%%1\"" /f>NulThis is a single line so replace any carriage return with a single space if wrapping occurs.
JayDogg Posted January 2, 2009 Author Posted January 2, 2009 Im sorry but that does not work anyone else an idea?I upload the reg key so take a look
JayDogg Posted January 2, 2009 Author Posted January 2, 2009 (edited) Im sorry but that does not work anyone else have an idea?I upload the reg key so take a lookreshacker.reg Edited January 2, 2009 by JayDogg
Yzöwl Posted January 2, 2009 Posted January 2, 2009 It may not work for you, but it works on all of my systems running three different Operating Systems.Did you try rebooting or restarting explorer.exe in order for the context menu entry to be added. If you are running Vista you will need to run the batch file as administrator too because you will not have access to that branch of the registry.There is a common theme here, your 'working' exported reg file isn't working and my '100% definitely working' script isn't either. If the above advice doesn't work for you, then I'd suggest you start to provide us with a lot more information to work with.
JayDogg Posted January 2, 2009 Author Posted January 2, 2009 Just to do a little test would you mind uploading your cmd file, so I can download it and run it to see if it works for me. If it doesnt I guess I will be giving up a lot of info for you guys Thanks Jay Dogg
Yzöwl Posted January 2, 2009 Posted January 2, 2009 This one has been tested to add the appropriate entry too!yourtest.zip
JayDogg Posted January 3, 2009 Author Posted January 3, 2009 well thank you for the up loaded cmd file, but it still didnt work =( Im going to try it on my other pc. But this make me wonder why it will not work on my pc. What info do you need to help me get this thing working? In the end this is going into windows xp disk I made using nlite but if I cant get it working I will just drop the reg files on the desktop or C drive and run them myself and by the way thanks for all the help. P.S. I guess I will test the batch and cmd files I made on my other pc to see if they work
Scr1ptW1zard Posted January 3, 2009 Posted January 3, 2009 Just checked the script submitted by Yzöwl on my systems, works fine (No reboot required).Please explain in more detail as to what is not working.Does the right-click menu have the "Open with ResHacker" item listed?Does the registry have the "Open with ResHacker" key under:"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\"?And the command subkey with the proper default value?Note: Your original registry file was using "HKEY_CLASSES_ROOT\*\shell\ResHacker"...
JayDogg Posted January 3, 2009 Author Posted January 3, 2009 (edited) ok like I said I was going to do I just tested your cmd file on my work laptop and it worked just fine and so did my batch file so I guess it just my pc.Now here is what was happend on my pc when I ran it, I would double click it and it appears to run. A cmd.exe box would flash open really fast and close.Then I check the reg before and after reboot and nothing at all gets writen to the reg so Im really not sure what is going on. But it shouldnt really matter cause im going to at it to my xp disk so it should work just fine. I just thought I wasnt writing the code right but like I said my batch file with the .reg file worked just fine. and Yzöwl's cmd worked too. So I guess I will just add it to my disk and do a test install and see if they get writen into the reg. Hey Yzöwl thanks for all the help. And if you wouldnt mind doing a break down of your cmd file for me cause when I made my cmd file it looked like this reg add HKEY_CLASSES_ROOT\*\shell\ResHacker /v command /t REG_SZ /d C:\\Program Files\\ResHacker\\ResHacker.exe \"%1\" and your's looked like this @Reg add "HKLM\SOFTWARE\Classes\*\shell\Open with ResHacker\command" /ve /d "\"C:\Program Files\ResHackerW\ResHacker.exe\" \"%%1\"" /f>Nul What is the @ do and what is /ve and does it have to be in "" and what is the "\" before C:\Program Files and you have 2 % before the number 1 and so on. Dont trip if you dont have time to explain everything but hey if you do have the time Im always down to learn something new Thanks Jay Edited January 3, 2009 by JayDogg
Yzöwl Posted January 3, 2009 Posted January 3, 2009 Technically you shouldn't add things directly to HKEY_CLASSES_ROOT, this key is mapped from HKEY_LOCAL_MACHINE\SOFTWARE\Classes, so you should add it there as a rule.If it makes it easier for the explanation then we'll use this:@Reg add "HKCR\*\shell\Open with ResHacker\command" /ve /d "\"C:\Program Files\ResHacker\ResHacker.exe\" \"%%1\"" /f>NulThe preceding @ is there to prevent the following command from being echoed to the console window.The key name is in double quotes because I used one or more spaces in its name./ve is used to add a blank/default value name which is what you're afterthis is shown as @ in a reg file and (Default) directly in the Registry EditorBackslashes are used to escape the internal double quotes.Because the value data string is contained within double quotes we need to make sure that those containing quotes are maintained and read correctly by reg.exe/d "\"C:\Program Files\ResHacker\ResHacker.exe\" \"%%1\""The additional percent, (%), is used to to escape a single percent as required in batch files.You'll note it usually in a For loop, when you'll require a single one directly in the console [For %A In (], but in a batch file doubling up is required. [For %%A In (]I hope this helps you a little.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now