+ Post New Thread
Results 1 to 14 of 14
Windows Thread, Need help with batch files please! in Technical; Hi All, I am currently working in a secondary school in Birmingham. I want to learn how to create batch ...
  1. #1

    Join Date
    Apr 2010
    Location
    London
    Posts
    12
    Thank Post
    16
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Need help with batch files please!

    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
    Last edited by richrad_mills; 10th June 2010 at 10:15 PM.

  2. #2

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,249
    Thank Post
    1,061
    Thanked 1,070 Times in 626 Posts
    Rep Power
    741
    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.....
    Last edited by mattx; 10th June 2010 at 10:18 PM.

  3. Thanks to mattx from:

    richrad_mills (10th June 2010)

  4. #3

    Join Date
    Apr 2010
    Location
    London
    Posts
    12
    Thank Post
    16
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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
    Last edited by richrad_mills; 10th June 2010 at 10:27 PM.

  5. #4

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,249
    Thank Post
    1,061
    Thanked 1,070 Times in 626 Posts
    Rep Power
    741
    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.

  6. Thanks to mattx from:

    richrad_mills (10th June 2010)

  7. #5

    Join Date
    Apr 2010
    Location
    London
    Posts
    12
    Thank Post
    16
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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

  8. #6

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,249
    Thank Post
    1,061
    Thanked 1,070 Times in 626 Posts
    Rep Power
    741
    One more of my fav sites which may come in handy for you:

    Dx21

  9. #7


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    9,807
    Thank Post
    262
    Thanked 2,968 Times in 2,183 Posts
    Rep Power
    847
    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.

  10. #8


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    9,807
    Thank Post
    262
    Thanked 2,968 Times in 2,183 Posts
    Rep Power
    847
    To answer your original question, this is how I would modify that value in a batch file.

    Code:
    @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.
    Last edited by Arthur; 11th June 2010 at 09:47 AM.

  11. Thanks to Arthur from:

    richrad_mills (11th June 2010)

  12. #9

    Join Date
    Apr 2010
    Location
    London
    Posts
    12
    Thank Post
    16
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by Arthur View Post
    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
    Last edited by ChrisH; 14th June 2010 at 08:05 PM.

  13. #10

    Join Date
    Apr 2008
    Location
    Dublin
    Posts
    62
    Thank Post
    18
    Thanked 7 Times in 7 Posts
    Rep Power
    15
    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:

    Code:
    ; 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.

  14. #11


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    9,807
    Thank Post
    262
    Thanked 2,968 Times in 2,183 Posts
    Rep Power
    847
    Quote Originally Posted by BBrian View Post
    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.

  15. #12
    rh91uk's Avatar
    Join Date
    Sep 2008
    Location
    UK
    Posts
    877
    Thank Post
    137
    Thanked 132 Times in 114 Posts
    Rep Power
    36
    I use this a lot to get the different commands I want: SS64.com Command line reference. does well for me!

  16. #13
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    5,007
    Thank Post
    124
    Thanked 286 Times in 263 Posts
    Rep Power
    109
    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.

  17. #14

    Join Date
    Jun 2010
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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.



SHARE:
+ Post New Thread

Similar Threads

  1. CMD and batch files
    By Aaron in forum Windows Server 2008
    Replies: 6
    Last Post: 1st February 2010, 04:18 PM
  2. Rename a batch of files all at once.
    By Kyle in forum How do you do....it?
    Replies: 10
    Last Post: 19th November 2009, 07:31 AM
  3. Batch files for ssh/linux...
    By boomam in forum *nix
    Replies: 4
    Last Post: 13th November 2008, 12:25 PM
  4. Running batch files in vista
    By Kained in forum Windows Vista
    Replies: 6
    Last Post: 4th September 2007, 03:25 PM
  5. numbers and batch files
    By russdev in forum Windows
    Replies: 4
    Last Post: 19th November 2005, 10:51 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •