+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 31
Scripts Thread, What do you guys actually use batch files for? in Coding and Web Development; I'm a Linux user myself, but have scripts for all sorts of things, stripping specific elements from large files, bulk ...
  1. #16
    OB1
    OB1 is offline

    OB1's Avatar
    Join Date
    Sep 2011
    Location
    Leeds
    Posts
    520
    Thank Post
    35
    Thanked 164 Times in 139 Posts
    Rep Power
    51
    I'm a Linux user myself, but have scripts for all sorts of things, stripping specific elements from large files, bulk creation/delete (careful with that last!), anything repetitive or involving a lot of information.
    My advice would be learn something like python or perl, both have pretty straightforward file handling and will teach you all the basics of programming quite quickly, which is really all scripting is.
    Most important of all, enjoy it!

  2. #17

    featured_spectre's Avatar
    Join Date
    Nov 2008
    Posts
    12,503
    Thank Post
    1,684
    Thanked 2,054 Times in 1,491 Posts
    Blog Entries
    2
    Rep Power
    464
    Batch files for the following

    Building folder trees for new users (Home drive, English, maths, science etc)
    Adding the user to active directory

    Also do it for bulk users (new year groups).

  3. #18

    sonofsanta's Avatar
    Join Date
    Dec 2009
    Location
    Lincolnshire, UK
    Posts
    5,375
    Thank Post
    958
    Thanked 1,630 Times in 1,103 Posts
    Blog Entries
    47
    Rep Power
    711
    Well I use Powershell to bulk-create new users (year 7s, controlled assessments), but I do that by creating a CSV with all the information in, based on a big Excel sheet with lots of text functions applied to generate paths and usernames. Then I tweak a few lines of powershell code to point at the right CSV and just copy and paste that, so not really a script file.

    In terms of actual BAT files, I think the only one I genuinely use is one that just pings all my servers when I run it so I can quickly check they're all up in the morning when I come in. Which is a pretty pathetic level of scripting tbh :/

  4. #19

    Garacesh's Avatar
    Join Date
    Jan 2012
    Posts
    3,427
    Thank Post
    1,310
    Thanked 503 Times in 369 Posts
    Rep Power
    240
    More useful than a looping (x)+1 script, though.

    Some interesting ideas I wouldn't have thought of.. Creating folders/trees isn't half bad, 'specially if you have to sort lots of things in lots of places by the same methods. As for adding users, well I've been shown how to do that once and it's really just copying another student and changing the values. Hadn't considered batch-adds for at the start of the school year, though..

  5. #20
    Mr.Ben's Avatar
    Join Date
    Jan 2008
    Location
    A Pirate Ship
    Posts
    942
    Thank Post
    182
    Thanked 158 Times in 126 Posts
    Blog Entries
    2
    Rep Power
    66
    I use .bat scripts to create folders and a few other simple tasks. The majority of the scripting that I do is in .vbs now, but this is being replaced by powershell.

    In short - knowing how to do all three is great - you can pick the right tool for the job.

  6. Thanks to Mr.Ben from:

    mac_shinobi (30th March 2012)

  7. #21
    mrbios's Avatar
    Join Date
    Jun 2007
    Location
    Stroud, Gloucestershire
    Posts
    2,659
    Thank Post
    383
    Thanked 273 Times in 225 Posts
    Rep Power
    103
    Used to use batch files for all sorts of things in the windows XP days, since rolling out 7 though i think i've only used batch files for two things and neither are client related.

    I've got one set for changing permissions on home folders, though that was a one time thing i hopefully shouldn't need to do again. I've got another that is attached to a task scheduler and runs setACL.exe to change permissions on a schedule for a particular set of folders to allow students access only at a specific time.

  8. #22
    Rammie's Avatar
    Join Date
    Jan 2007
    Location
    Derby
    Posts
    56
    Thank Post
    9
    Thanked 6 Times in 3 Posts
    Rep Power
    18
    I use MS BATCH all the time, Garacesh, but as already mentioned, you need several different languages - horses for courses. Why BATCH? Well the most candid reason is to admit I spent a long time in the "early days" using DOS, so I'm really good at it. But more to the point, BATCH leverages very many command-line functions in the most apt and direct way. While you can achieve the same thing using VB, PowerShell etc, sometimes the method works out more complicated. Often I can achieve a task in five lines of BATCH that takes 25 in VB, but often it's the other way around too. However, I will say that debugging BATCH is extremely easy once you're familiar with it, because you can see exactly what's happening as it happens. I know the idea of learning several programming methods sounds really intimidating, Garacesh, but once you know one, you understand the methodology and the rest get easier. We've got BATCH scripts for creating users, purging files and profiles, software installs and cleanups, user activity, network device status, creating email groups, loads of things.

  9. #23

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    10,053
    Thank Post
    3,583
    Thanked 1,123 Times in 1,025 Posts
    Rep Power
    377
    Quote Originally Posted by OB1 View Post
    I'm a Linux user myself, but have scripts for all sorts of things, stripping specific elements from large files, bulk creation/delete (careful with that last!), anything repetitive or involving a lot of information.
    My advice would be learn something like python or perl, both have pretty straightforward file handling and will teach you all the basics of programming quite quickly, which is really all scripting is.
    Most important of all, enjoy it!
    i was gonna say vbs or powershell?

    Original question, what do you use bat files for , only things I can think of

    1. using the find and ipconfig command to only show the ip address of said computer
    2. using wmic to show information about a computer i.e. model, make, serial number and other things i.e. computer name etc
    3. using the net use command ( can be used in various ways to achieve different things ) such as starting, stopping services, resetting a password etc
    4. renaming, copying and deletion of files and or directories with relevant switches when required ( sometimes use the RD command with /s and /q switches to fix the recycler issue )
    5. Launching and executing of other utils i.e. for re doing permissions

    Can't think of anything else although they can be used to add printers etc using the relevant rundll32 commands etc
    Last edited by mac_shinobi; 30th March 2012 at 05:51 PM.

  10. #24


    Join Date
    Mar 2009
    Location
    Leeds
    Posts
    7,059
    Thank Post
    232
    Thanked 926 Times in 795 Posts
    Rep Power
    309
    software installs
    file backup / copying (yes you can copy say ini files with gpp/vbs but gpp you have to spec them 1 by 1 as far as i can see and vbs is more code for same result)
    regedit to add/remove settings
    scheduled tasks

  11. #25

    Join Date
    Jan 2009
    Location
    Northants
    Posts
    146
    Thank Post
    5
    Thanked 11 Times in 10 Posts
    Rep Power
    14
    I think most people have hit the nail on the head, you use different scripting languages for different things, we have a lot of VBS for printer mapping and drive mapping, plus some other stuff with environment variables .. but we also do plenty with Batch files and have got some PS stuff but thats a massive learning curve for me.

    The last batch file i remember writing is to make Dameware Utilities available in SafeMode with networking. IT was the easist way to copy a folder and all containing values from one reg branch to another. 2 or 3 lines, in VBS it would have taken loads more.

  12. #26

    Join Date
    Apr 2012
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Interesting

  13. #27
    ADMaster's Avatar
    Join Date
    May 2012
    Posts
    356
    Thank Post
    5
    Thanked 39 Times in 34 Posts
    Rep Power
    25
    Someone once told me if you have to do it more than once script it. I use batch files for trivial repetitive tasks usually in conjunction with PDQ deploy and installers.
    A few examples:
    Somehow one of my images got set to the wrong time zone, I push out a .bat file with PDQ to set the correct time zone.
    VLC media players silent install does not like to upgrade so my batch file uninstalls the old one then installs the new one.
    Most recently I had to setup a lab for testing and there was software to install changes resolution, register the computer on the site, and install their active X controls.
    I wrote a quick batch to install the software, change resolution, and set the publisher as a trusted publisher, and launch IE to their site to be registered.
    For my more advanced scripts I use PowerShell. I used to use VBS for my user creation script but that was a copy and change to my needs job. I wrote my own user creation script in PowerShell without copying anyone and that was good.
    If you manage windows my advice would be to learn PowerShell first because you can run most of the batch commands and it is the direction Microsoft wants to go. Also it is a snap to manage user accounts with the quest AD cmdlets.

    Happy scripting;

  14. #28

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    18,529
    Thank Post
    527
    Thanked 2,648 Times in 2,049 Posts
    Blog Entries
    24
    Rep Power
    925
    I don't often use batch files but I do use VBS a fair amount.

    Our login script handles printer and drive assignments (Simple drive mapping and printer deployment - Script Center - Spiceworks)
    I have a script for staff to do a quick enable/disable of proxy settings
    For remote uninstallation of software based on the name, and then the uninstall key
    Bulk folder creation

    And any other little bits and pieces that crop up.

  15. #29

    Join Date
    Sep 2010
    Posts
    674
    Thank Post
    28
    Thanked 78 Times in 73 Posts
    Rep Power
    23
    use some simple scripts for backups which are run within windows backup.
    recently been setting up a load for changing printers and drivers across the site here. (PrintUI)
    havent used much VBS and no powershell.

    should really get on board with powershell

  16. #30
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,726
    Thank Post
    176
    Thanked 229 Times in 211 Posts
    Rep Power
    69
    Used to use them a lot for logon \ startup scripts to merge registry entries, check for \ create files etc. GPP has put paid to a lot of that.

    Used to use batch for updating our awkward MIS clients but changed over to VBS for that recently as I wanted more variables and clever queries so won't be going back

    One thing I do still use .BAT for is msiexec commands involving transforms and suchlike. Why worry about typing out a long command when a quick double-click can do it for you



SHARE:
+ Post New Thread
Page 2 of 3 FirstFirst 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, 09: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, 04:58 PM
  3. What do you use to backup your File Stores?
    By darknova in forum Hardware
    Replies: 3
    Last Post: 11th November 2008, 10:51 PM
  4. What do you guys think…?
    By Bodsworth in forum Courses and Training
    Replies: 5
    Last Post: 29th May 2008, 11: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
  •