richrad_mills Posted June 10, 2010 Posted June 10, 2010 (edited) Hi All, I am currently working in a secondary school in Birmingham. I want to learn how to create batch files I have used the internet and learnt the basic commands. Can you please direct me to books or useful websites that I could use to carry out the following task: Reg Key Location: [HKEY_CURRENT_USER\SOFTWARE\XMIND] Value that needs to be changed (current data value): Value Name = Path Value Data = C:\Program Files\XMind I would like to change the value to the following file location: Value Name = Path Value Data = C:\Documents and Settings\All Users\Documents\XMind We are using Windows XP Registry Editor Version is "Windows Registry Editor Version 5.1" The main reason for this is because we have bought new software and we have installed it on various machines and now I need to go back and edit the regedit values for it (i need to change the file location where the temp files will be saved to make sure the softwrae operates correctly). It will be ideal to create a batch file and use it as a startup logon script. But I do not know how to do this as I am a junior ICT Technician in my first job. Can someone please help me out I would really appreciate it. Thanks in advance, Richard Mills Edited June 10, 2010 by richrad_mills
mattx Posted June 10, 2010 Posted June 10, 2010 (edited) If it was me I was use Autoit: AutoIt v3 - Automate and Script Windows Tasks - For Free! or batch wise - the Reg command. Just google 'reg command' http://www.robvanderwoude.com/ Is a good place to start [ if you are a newbie to all this ] Or: http://www.kixtart.org/ Which is what I started out in donkey years ago..... Edited June 10, 2010 by mattx 1
richrad_mills Posted June 10, 2010 Author Posted June 10, 2010 (edited) Thanks Mattx for the advice I really appreciate it. I also wanted to know how I would write the bacth file for this problem. I like learning things like this, I am willing to learn. Thanks once again, Richard Mills Edited June 10, 2010 by richrad_mills
mattx Posted June 10, 2010 Posted June 10, 2010 This is an excellent book if you are starting out: Windows Administration at the Command Line for Windows 2003, Windows XP, and Windows 2000: In the Field Results: Amazon.co.uk: John Mueller: Books It's a little old now but very handy to have - also may be worth looking at. Also check out WSH - I did this book: Sams Teach Yourself Windows Scripting Host in 21 Days: Amazon.co.uk: Charles Williams, Thomas Fredell, Clarence Washington Jr., Michael Morrison, Steve Campbell, Ian Morrish: Books But have never used it as I do most of my stuff in Autoit now. 1
richrad_mills Posted June 10, 2010 Author Posted June 10, 2010 Thanks Again Mattx, I was hoping someone can guide me through the coding because I need to sort this problem out before the summer term ends. I am running the entire school on my own as my manager has gone on paternity leave and he won't be back and the software is needed 3 days before he comes back. Thanks Richard Mills
mattx Posted June 10, 2010 Posted June 10, 2010 One more of my fav sites which may come in handy for you: Dx21
Arthur Posted June 10, 2010 Posted June 10, 2010 Another useful resource I have found is the Batch Function Library on the commandline.co.uk website, especially if you need to work with dates and time in your batch files.
Arthur Posted June 10, 2010 Posted June 10, 2010 (edited) To answer your original question, this is how I would modify that value in a batch file. @echo off REG ADD HKCU\Software\XMind /v Path /t REG_SZ /d "\"C:\Documents and Settings\All Users\Documents\XMind"\" /f Some other good examples for the Reg command can be found here. Edited June 11, 2010 by Arthur 1
richrad_mills Posted June 11, 2010 Author Posted June 11, 2010 (edited) To answer your original question, this is how I would modify that value in a batch file. Thanks Arthur I really appreciate it. Thanks again, Richard Mills Edited June 14, 2010 by ChrisH
BBrian Posted June 14, 2010 Posted June 14, 2010 If you're using Group Policy (and so you're aware of the options) you can write ADM Templates to control registry settings from Group Policy Mangement Console. Here's an example showing how to change the reg key you wanted: ; Custom ADM template for XMind. ; ; Created by Brian Henry. ; www.zooofthenew.com CLASS USER CATEGORY "XMind" POLICY "XMind Options" EXPLAIN !!PolicyDescription KEYNAME "Software\Xind" PART "File location where the temp files will be saved:" EDITTEXT REQUIRED EXPANDABLETEXT DEFAULT "C:\Program Files\XMind" VALUENAME "Path" END PART END POLICY END CATEGORY [strings] PolicyDescription="Changes the file location where the temp files will be saved for XMind." There are instructions for adding it to a Group Policy Object at petri.co.il. I think this is out of date if you're using Server 2008, but i'm not yet so haven't learned about admx files myself. You can also change registry settings using Group Policy Preferences. I would avoid actual batch files as they're well out of date now. VBScripting (Windows Scripting Host) and PowerShell are the current Microsoft ones in use. Batch files won't let you control as much as they can.
Arthur Posted June 14, 2010 Posted June 14, 2010 You can also change registry settings using Group Policy Preferences. For making changes to the registry, Group Policy Preferences seems to be a better choice compared to creating an ADM/ADMX file.
rh91uk Posted June 14, 2010 Posted June 14, 2010 I use this a lot to get the different commands I want: SS64.com Command line reference. does well for me!
ChrisH Posted June 14, 2010 Posted June 14, 2010 As well as making this script in the batch language I would also aim to make this script in VB script as well. They will both do the same thing but this way you can learn 2 different languages at the same time. You can then save it and reference them at a later date. These days most of my scripts are built from copying and pasting from my old scripts as I have usually covered most stuff at one point. AutoIT as already mentioned is a great language as well. I tend to use this mostly for those really awkward software installations that you can't do another way. I also use it when I want a standalone exe.
timeny Posted June 23, 2010 Posted June 23, 2010 If you're interested in learning vbscript, may I recommend this book: "Managing Windows with VBScript and WMI" by Don Jones (ISBN 0-321-21334-3). There may be newer editions out by now, but I write vbscripts all of the time, and I still find myself referring back to that book. Microsoft's Script Center is a pretty good online resource and their "Scriptomatic" tool will help you dig into the bowels of WMI when you're trying to figure out how to script something that you can't find a good example on.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now