Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 390371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:57:29+00:00 2026-05-12T15:57:29+00:00

I need to write some scripts for WinXP to support some of the analysts

  • 0

I need to write some scripts for WinXP to support some of the analysts here at Big Financial Corp. I need to decide which type of Windows scripting best fits my needs.

My needs seem pretty simple (to me anyway)

  1. run on WinXP Pro SP2 (version 2002)
  2. not require my users to install anything (so PowerShell is out. Likewise Perl, Python, and other common suggestions for these types of questions on Stack Overflow)
  3. written in a non-compiled language (so users have a chance to modify them in the future)
  4. reasonably complete language features (especially date/time manipulation functions. I would like to also have modern concepts like subroutines, recursion, etc)
  5. ability to launch and control other programs (at the command line)

From my hurried review of my options, it looks like my choices are

  1. VBScript
  2. WScript
  3. JScript

I don’t have time to learn or do an in-depth review of these (or whatever else a standard install of WinXP has available). I need to pick on and hack something together as quickly as possible.

(Current crisis is the need to run a given application, passing several date parameters).

Once the current crisis is over, there will be more requests like this.

Edit

My current skill set includes Perl, JavaScript, and Java so I’m most comfortable using something similar to these

Edit

OK. I’ll try writing a WSH file in JScript. I’ll let you know how it goes (and figure out accepting an answer) once things settle down around here a bit.

Edit

It all worked out in the end. Thanks for the quick responses folks. Here’s what I gave my user:

<job id="main">
    <script language="JScript">
// ----- Do not change anything above this line ----- //

var template = "c:\\path\\to\\program -##PARAM## --start ##date1## --end ##date2## --output F:\\path\\to\\whereever\\ouput_file_##date1##.mdb";

// Handle dates
// first, figure out what they should be
dt = new Date();
var date1 = stringFromDate(dt, 1);
var date2 = stringFromDate(dt, 2);

// then insert them into the template
template = template.replace(new RegExp("##date1##", "g"), date1);
template = template.replace(new RegExp("##date2##", "g"), date2);

// This application needs to run twice, the only difference is a single parameter
var params = ["r", "i"]; // here are the params.

// set up a shell object to run the command for us
var shellObj = new ActiveXObject("WScript.Shell");

// now run the program once for each of the above parameters
for ( var index in params )
{
    var runString = template; // set up the string we'll pass to the wondows console
    runString = runString.replace(new RegExp("##PARAM##", "g"), params[index]); // replace the parameter
    WScript.Echo(runString);

    var execObj = shellObj.Exec( runString ); 
    while( execObj.Status == 0 )
    {
        WScript.Sleep(1000); //time in milliseconds
    }
    WScript.Echo("Finished with status: " + execObj.Status + "\n");
}


// ----- supporting functions ----- //

// Given a date, return a string of that date in the format yyyy-m-d
// If given an offset, it first adjusts the date by that number of days
function stringFromDate(dateObj, offsetDays){
    if (typeof(offsetDays) == "undefined"){
        offsetDays = 0;
    }
    dateObj.setDate( dateObj.getDate() + offsetDays );

    var s = dateObj.getYear() + "-";     //Year
    s += (dateObj.getMonth() + 1) + "-"; //Month (zero-based)
    s += dateObj.getDate();              //Day

    return(s);
}

// ----- Do not change anything below this line ----- //
    </script>
</job>

Clearly it could be better… but it got the job done and is easy enough for my user to understand and extend himself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:57:29+00:00Added an answer on May 12, 2026 at 3:57 pm

    These are all technically the same thing with different syntax. Actually WScript/CScript is the engine, VBScript and JScript are the languages.

    Personal opinion only follows: My personal recommendation is JScript because it reminds me more of a real programming language, and makes me want to punch myself in the face less often than VBScript. And given your familiarity with javascript, your best bet is JScript.

    Going into a bit more detail about the difference between WScript and CScript as others have: these are your execution platforms for your scripts for the Windows Script Host. They are essentially the same thing, whereas WScript is more GUI oriented, and CScript is more console oriented. If you start the script with CScript, you will see a console window, but you still have access to GUI functionality, whereas if you start with WScript, there is no console window, and many of the default output methods display as windowed objects rather than a line in the console.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write some scripts to carry out some tasks on my server
I'm very new with ssh so I need some help to write some scripts.
I need to write some methods for loading/saving some classes to and from a
I need to write some Prolog programs for a class. Any recommendations?
I need to write some javascript to strip the hostname:port part from a url,
Hallo, i need to write some javascript that gets the contents of a userfield
Lets say I need to write several functions processing some data. These functions are
Let's say that for some reason you need to write a macro: MACRO(X,Y) .
I need some help calculating Pi. I am trying to write a python program
I need write an update statement that used multiple tables to determine which rows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.