+ Post New Thread
Results 1 to 9 of 9
Scripts Thread, bat versus vbs in Coding and Web Development; is there any speed benefit that i can gain by converting my login batch files to vbs if so where ...
  1. #1

    Join Date
    Oct 2006
    Location
    uk
    Posts
    494
    Thank Post
    19
    Thanked 3 Times in 2 Posts
    Rep Power
    17

    bat versus vbs

    is there any speed benefit that i can gain by converting my login batch files to vbs if so where can i get some good syntax examples for mapping drives, printers based on location etc.
    I have a fairly good grasp on batch file syntax but none at all on many other scripting launguages.

  2. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,987
    Thank Post
    120
    Thanked 283 Times in 261 Posts
    Rep Power
    107

    Re: bat versus vbs

    If you have a look at the stick theres a few scriptomatics and such that will give you examples.
    You arent going to notice any performance increase/decrease I would have said.
    At the end of the day it depends how complex you login script is. Alot of the time you can do the same thing with one line of a batch scipt than three lines of VBS.
    There are ofc more complicated things you can do with VBS though.

  3. #3

    Join Date
    Oct 2006
    Location
    uk
    Posts
    494
    Thank Post
    19
    Thanked 3 Times in 2 Posts
    Rep Power
    17

    Re: bat versus vbs

    okey dokey chrish thanks mate i think i'll stick with the bat files then.

  4. #4
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,547
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    22

    Re: bat versus vbs

    We stopped using .bat files ages ago and now use only .vbs.

  5. #5

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124

    Re: bat versus vbs

    uraken - it's worth getting familiar with vbscript; there's so much you can't easily do with batch files (and when you can do it, no-one else will understand it :-))

    For example, there's been discussion about recording user logons and examples of how to do this with a batch file creating a text logfile. This can work on a small scale but it doesn't scale well and reporting on it is hard work. If you use vbscript then you can log the data directly to a SQL database (SQL 2005 Express is free and more than adequate) which you can then report from easily (we use .asp pages so that anyone can quickly find stuff)

  6. #6

    Join Date
    Jan 2007
    Posts
    66
    Thank Post
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: bat versus vbs

    Quote Originally Posted by tosca925
    We stopped using .bat files ages ago and now use only .vbs.
    Ok that's all well and good, but why?

  7. #7
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,547
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    22

    Re: bat versus vbs

    After reading this and other posts ona similar subject

    http://www.edugeek.net/index.php?nam...ewtopic&t=5257

  8. #8

    Join Date
    Feb 2006
    Posts
    1,187
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: bat versus vbs

    I think the FOR /<x> command is an area where bat/cmd wins over VBS.

    In VBS there's no easy way of enumerating an entire folder tree unless you dabble in recursion. This would of course mean some overhead in translation and procedure call setup.

    Isn't it just much simpler to do something like
    Code:
     FOR /R  %a in (.) do @echo  %a
    Try doing the equivalent of the following but in VBS

    Code:
    FOR /F (tokens=1,2 delims=,) %%a IN (userlist.txt) DO @ECHO User name is %%a. Full name is %%b
    Command subsitution is another area. You could shell out and pipe to a file but it's just so much easier to do
    Code:
    FOR /F %%a IN  ('dir /b') DO @ECHO %%a
    These are really trivial examples but to do the same thing in VBS would take lots of lines, especially the file management (texts treams, arrays, read line, split, manip, join, write line, blah, blah, blah.... do me a favour!)

    My challenge to VBS coders. Write a script to archive all the INI files on the C: drive using NT Backup which will be the only external program you are allowed to call.

    Now I'm not saying there should be an exclusive choice between BAT/CMD and VBS( or JS for that matter). VBS offers more control but in some situations it can be qutie cumbersome.

  9. #9

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

    Re: bat versus vbs

    I'd leave the logon BAT alone. I have nothing for logon, but looking at the stuff I've written recently for my toolkit:

    Batch: For making a long series of CL calls, maybe with a few "if exists".. to save typing complex command lines I use a lot... or to remember rarely used and forgettable command lines. FOR is indeed an occasionally useful exception (my last use appended).

    Script [JS]: Things that need a lot of string manipulation or serious functions. Things that need to talk to the registry or AD or WMI. None of mine launch other processes.

    dotNet [JS, C#]: Things that are impossible or a zillion times easier than normal script courtesy of some everso handy dotNet Framework class or other.

    Don't overlook dotNet. If you don't have it installed everywhere yet, you will and you can code-tweak anywhere because it installs compilers for JS, C# and (if you must) VB.

    Code:
    for /d %%I in ("*") do (call :fn01 "%%~I")
    goto :eof
    
    :fn01
    rem point a few CL utils at sub-dir in %1
    goto :eof

SHARE:
+ Post New Thread

Similar Threads

  1. Licensing: Select versus Schools Agreement
    By ITWombat in forum Budgets and Expenditure
    Replies: 11
    Last Post: 29th June 2009, 02:22 PM
  2. Yahoo versus Google
    By AnnDroyd in forum Web Development
    Replies: 29
    Last Post: 20th December 2007, 03:09 PM
  3. Prining versus Photocopying
    By witch in forum General Chat
    Replies: 5
    Last Post: 6th June 2007, 08:58 AM
  4. Broadband connection: RBC NAT versus Public IP addresses
    By NetworkGeezer in forum Wireless Networks
    Replies: 23
    Last Post: 1st December 2006, 09:34 AM
  5. HP Notebooks: AMD versus Intel
    By thom in forum Hardware
    Replies: 5
    Last Post: 13th June 2006, 07:07 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
  •