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 ...
-
26th January 2012, 01:44 PM #1 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)
-
-
IDG Tech News
-
26th January 2012, 02:18 PM #2 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
-
-
26th January 2012, 02:21 PM #3
- Rep Power
- 2
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!
-
-
26th January 2012, 02:25 PM #4 The only batch file I use deletes the cached local copy of pupils profiles but I do have various VBScript files.
-
-
26th January 2012, 02:42 PM #5 As others have implied - dirty hacks until I do it properly via powershell or python.

Originally Posted by
saundersmatt
Bulk attaching linked documents in SIMS.net to students via simulating keypresses/mouseclicks.
*is intrigued and would like to subscribe to your newsletter*
-
-
26th January 2012, 02:48 PM #6 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.
-
-
26th January 2012, 02:52 PM #7 
Originally Posted by
saundersmatt
simulating keypresses/mouseclicks.
With a batch file? This intrigues me... I was unaware you could do something like that.
-
-
26th January 2012, 02:58 PM #8 
Originally Posted by
saundersmatt
Not batch scripts per-se
*SNIP*
Bulk attaching linked documents in SIMS.net to students via simulating keypresses/mouseclicks.
My money is on VBS
-
-
26th January 2012, 03:07 PM #9 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
-
-
26th January 2012, 03:13 PM #10 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.
-
-
26th January 2012, 03:26 PM #11 
Originally Posted by
Garacesh
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)
-
-
26th January 2012, 03:36 PM #12 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?
-
-
26th January 2012, 03:38 PM #13 Usually for installers to save typing long command lines and previously for login scripts... most of that done via GPP now
-
-
26th January 2012, 04:01 PM #14 
Originally Posted by
Dos_Box
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..
-
-
26th January 2012, 04:05 PM #15 Actually, you did. My bad.
-
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