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 ...
-
26th January 2012, 04:34 PM #16 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!
-
-
IDG Tech News
-
26th January 2012, 04:55 PM #17 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).
-
-
26th January 2012, 05:13 PM #18 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 :/
-
-
27th January 2012, 09:36 AM #19 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..
-
-
27th January 2012, 09:47 AM #20 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.
-
Thanks to Mr.Ben from:
mac_shinobi (30th March 2012)
-
27th January 2012, 11:07 AM #21 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.
-
-
30th March 2012, 04:14 PM #22 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.
-
-
30th March 2012, 04:21 PM #23 
Originally Posted by
OB1
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 04:51 PM.
-
-
30th March 2012, 06:38 PM #24 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
-
-
23rd April 2012, 01:24 PM #25
- Rep Power
- 7
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.
-
-
25th April 2012, 12:18 PM #26
- Rep Power
- 0
-
-
14th May 2012, 12:47 PM #27
- Rep Power
- 0
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;
-
-
14th May 2012, 12:57 PM #28 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.
-
-
14th May 2012, 01:05 PM #29
- Rep Power
- 6
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
-
-
14th May 2012, 01:41 PM #30 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:
Similar Threads
-
By garethedmondson in forum General Chat
Replies: 46
Last Post: 11th December 2011, 09:19 PM
-
By sven in forum Network and Classroom Management
Replies: 13
Last Post: 24th October 2011, 03:58 PM
-
By darknova in forum Hardware
Replies: 3
Last Post: 11th November 2008, 10:51 PM
-
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
-
Forum Rules