LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Windows native bash-like script language (http://www.linuxquestions.org/questions/programming-9/windows-native-bash-like-script-language-406762/)

koyi 01-22-2006 11:46 PM

Windows native bash-like script language
 
Hi, I am wondering if there are script languages like bash/perl/php that comes with windows?

I know all 3 of the above languages can be used under windows, and they run natively but what I am looking for is something more "native" to windows in the sense that it comes with, or supported by Microsoft directly so that you don't have to install anything to program or to run the scripts.

Regarding the console world in windows, all I know is DOS, but I don't think it is a powerful tool.

Any opinions are welcome.

Thanks.

gilead 01-23-2006 12:36 AM

You can download Cygwin from http://www.cygwin.com/. It takes a while to download all of the packages, but it works just fine (eventually ;) )

cs-cam 01-23-2006 12:44 AM

VBScript? Not sure if it ships with all versions of Windows or not though.

jlliagre 01-23-2006 02:38 AM

Never been there, but that page may be helpful:
http://www.microsoft.com/technet/scr...r/default.mspx

scuzzman 01-23-2006 04:21 AM

Perl is available in a Windows Port: http://www.cpan.org/ports/#win32
ActivePerl I've used and like :)
Also, Java can be used to build console applications, if that helps any.

Hope this helps :)

Edit: Just re-read the post, and that probably doesn't help much...
The closest thing you are going to get without a third-party application is batch scripts... but these pale terribly in comparison to anything listed in your post...

koyi 01-23-2006 08:22 AM

Thanks for the replies guys :)

I will check out about VBscript when I have the time.

Just for your information, The reason why I want it to be available on windows is that I want to write some utilities for my friends. I don't think it is a good idea to ask them to install perl/PHP/cygwin or whatever just to run those little scripts.

Thanks again.

scuzzman 01-23-2006 08:29 AM

There is one more option: HTA files. These work well as primitive GUI programs that can do quite a few complex functions through Javascript and VBScript... http://msdn.microsoft.com/workshop/a...taoverview.asp

carl.waldbieser 01-23-2006 09:23 PM

Quote:

Originally Posted by koyi
Hi, I am wondering if there are script languages like bash/perl/php that comes with windows?

I know all 3 of the above languages can be used under windows, and they run natively but what I am looking for is something more "native" to windows in the sense that it comes with, or supported by Microsoft directly so that you don't have to install anything to program or to run the scripts.

Regarding the console world in windows, all I know is DOS, but I don't think it is a powerful tool.

Any opinions are welcome.

Thanks.

VBScript is what you want to use. Along with WSH (Windows Scripting Host), you can pretty much accomplish most things you would use bash/perl/python to do, though I find you end up writing a bit more code in some cases. VBScript is more like a glue language, in that it doesn't really have many useful libraries build into it (in contrast to perl or python), but with the CreateObject() function, you have access to boatloads of the standard ActiveX objects that come preinstalled on most Windows machines.

It is not a very modular language, though, so it is best for short, administrative type scripts, in my optinion.

KimVette 01-24-2006 11:52 AM

Would you be happy with Korn and C shells? if so then download Microsoft Services for Unix from http://www.microsoft.com/windowsserv...u/default.mspx

xhi 01-24-2006 11:58 AM

Who needs Perl.. I do everything by writing batch files..

:D

scuzzman 01-24-2006 10:06 PM

Because I can do this with Perl... and you cannot with a batch file without installing third-party command-line utilities...
Code:

sub fix_id3 {
  # Here's where the magic is done
  $album = $_[0];
  $artist = $_[1];
  $genre = $_[2];
  $file = $_[3];
  print "What is the track name? ";
  chomp ( $title = <STDIN> );
  # wrap the object constructor call in an eval to
  # make sure we catch any weird errors and object was
  # created ok
  eval {
    $mp3 = MP3::Tag->new($file);    # Creates new object
  };
  # Make sure the object was created OK
  if ($@) {
    die qq{Error creating MP3 object, $@}; # if not, die and tell us why
  }
  unless ( exists $mp3->{ID3v1} ) { # assure ID3v1 is a valid option
    $mp3 -> new_tag("ID3v1");
    $mp3 -> {ID3v1}->write_tag; # otherwise, create it
  }
  $mp3 -> {ID3v1} -> title("$title"); # adds element title
  $mp3 -> {ID3v1} -> artist("$artist"); # adds element artist
  $mp3 -> {ID3v1} -> album("$album"); # adds element album
  $mp3 -> {ID3v1} -> genre("$genre"); # adds element genre
  $mp3 -> {ID3v1} -> write_tag(); # writes the tags
  $mp3 -> close(); # close the file
  # we'll also rename the files
  $oldname = "$file";
  $newname = "${artist} - ${title}.mp3";
  rename $oldname, $newname;

  print "\n";
}


KimVette 01-24-2006 10:12 PM

Oh by the way - perl is available for Windows (in addition to the version bundled with Services for Unix). Check out ActivePerl at http://www.activestate.com/Products/ActivePerl/

koyi 01-24-2006 11:13 PM

Thanks for all of the information.
I will try to choose one from the above suggestions :)

Of course if you have extra information to provide.
Please do so so that other people can take advantage of this post, too :)

xhi 01-24-2006 11:24 PM

>> Because I can do this with Perl... and you cannot with a batch file without installing third-party command-line utilities...

once again sarcasm goes soaring over the head of an intended audience..

i know i should have used <joking> tags.. forgot where i was for a second..


All times are GMT -5. The time now is 06:07 AM.