Re: what kind of scripting is this ?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello Pegasus (MVP),

I agree - VBScript definitely wins for anything but the most simple tasks.

Batch does have the FOR command which allows looping, the CALL :LABEL that sort of gives you subroutines, and the SET command allows some rudimentary string parsing. It works OK if you need to talk to a command line utility like DSMOD or Robocopy. Batch becomes hard to deal with if your script has more than a couple dozen lines.



Batch files have no looping facilities other than a "goto" statement.
On the other hand they do have if/then/else constructs:

set name=%UserName%
if /i "%name%"=="Hassan" (
echo Good morning %name%
) else (
echo You're not %name%!
)
There are some string handling functions that are fully explained in
set /?. Here is an example:

set Name=Hassan the Programmer
echo Hassan is a %Name:~11%
Batch files have nothing in common with VB Scripting. VB Scripting
is far more powerful than batch file programming. It is also a lot
more verbose. Your initial request for archiving some files required
about four lines of batch file programming. In VB Scripting it would
require maybe 30 to 40 lines. Everyday file manipulation tasks can
often be performed with just a few lines of batch code. More
complex tasks are best performed with VB Scripts.
"Hassan" <hassan@xxxxxxxx> wrote in message
news:OlY1MpUQIHA.4752@xxxxxxxxxxxxxxxxxxxxxxx

Pegasus,

Im aware of finding how to use copy and robocopy, but what im not
aware of is assigning variables to them. Looks like you've given me a
clue with those echo and set.

So with that, are there any other commands from a logic perspective,
if then else, while ,etc.. what about string parsing ,etc. ?

Now does that get into vb scripting or can i still do it in a batch
file as such ?

Thanks

"Pegasus (MVP)" <I.can@xxxxxxx> wrote in message
news:eIUb1dUQIHA.1208@xxxxxxxxxxxxxxxxxxxxxxx

"Hassan" <hassan@xxxxxxxx> wrote in message
news:esHKRLUQIHA.4136@xxxxxxxxxxxxxxxxxxxxxxx

Pegasus helped me in a previous message with a script as below:

@echo off
set Age=7
set Source=c:\Home\Hassan
set Target=c:\Home\Hassan\Archive
robocopy /mov /minage:%Age% "%Source%" "%Target%" *.txt
My question is , is the above kind of programming called vb
scripting or just windows scripting ?

Where can i learn more about it ? As Id like to learn the basics of
the above language that i can use to do some basic stuff on a day
to day basis on my windows machines

Thanks

It is a batch file. A batch file consists of a collection of
commands
that you type at the Command Prompt. You can learn about the
commands by typing this at the Command Prompt:
echo /?
set /?
copy /?
robocopy /?


.



Relevant Pages

  • Re: Multi-zip files -- Windows server
    ... native DOS versions). ... TO BATCH OR NOT TO BATCH ... and using a batch file to try and solve the problem... ... The IBM PC operating system command line is a most ...
    (comp.sys.cbm)
  • Re: Windows "Scheduled Task Wizard..."
    ... Do you know any links at Microsoft documents related to the batch file ... command name to get started. ... VB Script and any other Microsoft scripting languages have nice ...
    (microsoft.public.windows.server.general)
  • Re: Windows "Scheduled Task Wizard..."
    ... type help at the command prompt. ... Do you know any links at Microsoft documents related to the batch file ... type help at the command prompt. ...
    (microsoft.public.windows.server.general)
  • Re: Command Line / Batch File set permissions for folders / files
    ... > the Command Line (or in a batch file)? ... Windows XP Service Pack 2 Support Tools ... FILEACL.exe - NTFS Permissions command line tool ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Robocopy - not providing destination in log output
    ... command line tool to be a part of that. ... working script (Batch file) servicing a large ... People who post questions in a *scripting* newsgroup ... Function pad ...
    (microsoft.public.windows.server.scripting)