+ Post New Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 31
Scripts Thread, What do you guys actually use batch files for? in Coding and Web Development; Okay, so long-story-short I've recently started an apprenticeship with a school as you might expect, that's involved delving into the ...
  1. #1


    Join Date
    Jan 2012
    Posts
    2,582
    Thank Post
    924
    Thanked 344 Times in 264 Posts
    Rep Power
    207

    What do you guys actually use batch files for?

    Okay, so long-story-short I've recently started an apprenticeship with a school as you might expect, that's involved delving into the Command Line more than I've previously done (the extent of my pre-apprenticeship CLI usage was mostly limited to ipconfig) - which has in turn gotten me somewhat inrigued into scripting.

    I knew batch files existed but never really bothered with them until now, and using a few sites online that list commands, combined with a little intuition (and trial-and-error logic) I've so far coded two batch files..
    One's a script that Y/N promps to back up E:\ drive (usb flash drive), if N is returned, it asks for a separate location to back up. It then creates date-named folders and xcopy's the files over.

    The second's a (useless) script that asks for a number, starts at zero, and keeps adding 1 until it reaches that number. Admittedly I only wrote that one to discover if causing a coding loop was possible.

    So I'm just wondering what more experienced techies might use batch files for, out of interest. I've seen most scripts here are what might as well be Klingon, since (as of yet) I know no programming languages (although I might just give a bash at learning one)

  2. #2

    Join Date
    Jul 2005
    Location
    Rugby
    Posts
    432
    Thank Post
    17
    Thanked 66 Times in 61 Posts
    Rep Power
    35
    Not batch scripts per-se, but two of my more advances scripts are:

    Enumerate staff/student home folders and delete any that are no longer associated with an AD user account, written in Python.

    Bulk attaching linked documents in SIMS.net to students via simulating keypresses/mouseclicks.

    Matt

  3. #3

    Join Date
    Jan 2012
    Location
    Luton
    Posts
    121
    Thank Post
    22
    Thanked 15 Times in 12 Posts
    Rep Power
    8
    I have one batch file that runs all the install files for Reader, Flash etc. so if I'm "cleaning up" a system and it's easier than reaching for PDQ Deploy, I'll run that locally.

    Also have one on login to add printers and shared drives, but I don't like doing that. It's something that was already here.

    Also have our login/logoff logs as batch files. PM me if you'd like a copy of them.

    As for learning a language - DO IT! It's extremely rewarding and useful. It's the equivalent of learning to grow and make your own food, not dependant on other people. Can't find an app to do something? Code it!

  4. #4
    36Degrees's Avatar
    Join Date
    Jan 2010
    Location
    Nottingham
    Posts
    1,057
    Thank Post
    165
    Thanked 152 Times in 123 Posts
    Rep Power
    52
    The only batch file I use deletes the cached local copy of pupils profiles but I do have various VBScript files.

  5. #5


    Join Date
    Dec 2005
    Location
    In the server room, with the lead pipe.
    Posts
    4,630
    Thank Post
    275
    Thanked 777 Times in 604 Posts
    Rep Power
    223
    As others have implied - dirty hacks until I do it properly via powershell or python.


    Quote Originally Posted by saundersmatt View Post
    Bulk attaching linked documents in SIMS.net to students via simulating keypresses/mouseclicks.
    *is intrigued and would like to subscribe to your newsletter*

  6. #6

    jinnantonnixx's Avatar
    Join Date
    Mar 2011
    Location
    In the Calamatorium.
    Posts
    1,954
    Thank Post
    109
    Thanked 482 Times in 331 Posts
    Blog Entries
    2
    Rep Power
    281
    Batch files? Tons of 'em.

    It depends what you want to do. For instance, if you need to create a lot of folders and assign specific security, it makes sense to use batch files as you're staying close to the native commands - e.g. md, icacls.

    If you want to create AD users, you might use LDAP from VBS, or Powershell.

    DOS/Windows batch files are really quite limited though, with flaky logic controls and hacks a plenty. Not so with Linux's Bash, however, you can actually write proper code in Bash.

  7. #7


    Join Date
    Jan 2012
    Posts
    2,582
    Thank Post
    924
    Thanked 344 Times in 264 Posts
    Rep Power
    207
    Quote Originally Posted by saundersmatt View Post
    simulating keypresses/mouseclicks.
    With a batch file? This intrigues me... I was unaware you could do something like that.

  8. #8

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Quote Originally Posted by saundersmatt View Post
    Not batch scripts per-se
    *SNIP*
    Bulk attaching linked documents in SIMS.net to students via simulating keypresses/mouseclicks.
    My money is on VBS

  9. #9
    themightymrp's Avatar
    Join Date
    Dec 2009
    Location
    Leeds, West Yorkshire
    Posts
    1,201
    Thank Post
    211
    Thanked 222 Times in 191 Posts
    Rep Power
    72
    I have various ones lying around but the majority of mine are VB scripts. However .bat files are a great way to ease yourself into scripting. The majority of my batch files tend to be for doing simple software installs based on certain criteria. For example:

    Code:
    if not exist path to reference file goto install
    exit
    :install
    path to install / relevant switches for silent install
    copy \\server\path\reference file to c:\path to reference file
    Just simple stuff really. My more advance scripts - dealing with creating AD accounts and folders - tend to be in VB as I'm not fully confident on Powershell just yet

  10. #10

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    A lot of my scripts (mostly VBS) deal with automating repetitive SIMS tasks, e.g. converting my exported XML to Excel/Word, bulk setting of print options for exported marksheets, automated running of reports etc.

  11. #11

    Join Date
    Jul 2005
    Location
    Rugby
    Posts
    432
    Thank Post
    17
    Thanked 66 Times in 61 Posts
    Rep Power
    35
    Quote Originally Posted by Garacesh View Post
    With a batch file? This intrigues me... I was unaware you could do something like that.
    My apologies, I'd meant to include a note like in the previous line about what language I use.

    For clarification it's an AutoIt script, using a lot of window controls (which was a royal pain to develop but much better than manually linking FFTLive exports to students)

  12. #12

    Dos_Box's Avatar
    Join Date
    Jun 2005
    Location
    Preston, Lancashire
    Posts
    9,843
    Thank Post
    583
    Thanked 2,162 Times in 987 Posts
    Blog Entries
    23
    Rep Power
    627
    Moving to Scripts forums.

    To the OP, have a real good nosy around in here, there are plenty of good examples you can hack apart and do 'stuff' with.

    *Edited to add: OK, which mod beat me to it?

  13. #13
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,650
    Thank Post
    164
    Thanked 217 Times in 200 Posts
    Rep Power
    66
    Usually for installers to save typing long command lines and previously for login scripts... most of that done via GPP now

  14. #14


    Join Date
    Jan 2012
    Posts
    2,582
    Thank Post
    924
    Thanked 344 Times in 264 Posts
    Rep Power
    207
    Quote Originally Posted by Dos_Box View Post
    Moving to Scripts forums.

    To the OP, have a real good nosy around in here, there are plenty of good examples you can hack apart and do 'stuff' with.
    Really? I'm sure I posted it in Scripts.. That's what I get for having multiple tabs open >.> Whoopsie.
    I'll make sure to have a good nosey around, but a lot of the stuff here confuses me as of current xD Possibly because I have no interaction with them before.. or any interaction with the software or setups they're written to work with..

  15. #15

    Dos_Box's Avatar
    Join Date
    Jun 2005
    Location
    Preston, Lancashire
    Posts
    9,843
    Thank Post
    583
    Thanked 2,162 Times in 987 Posts
    Blog Entries
    23
    Rep Power
    627
    Actually, you did. My bad.

SHARE:
+ Post New Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. Media Centre PC - What do you guys do?
    By garethedmondson in forum General Chat
    Replies: 46
    Last Post: 11th December 2011, 08:19 PM
  2. TaskForce CO2 - What do you guys think?
    By sven in forum Network and Classroom Management
    Replies: 13
    Last Post: 24th October 2011, 03:58 PM
  3. What do you use to backup your File Stores?
    By darknova in forum Hardware
    Replies: 3
    Last Post: 11th November 2008, 09:51 PM
  4. What do you guys thinků?
    By Bodsworth in forum Courses and Training
    Replies: 5
    Last Post: 29th May 2008, 10:19 AM

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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