Solved

How best to re-write vbs script code wscript

Posted on 2013-11-14
3
343 Views
Last Modified: 2013-11-14
I need to try to get this to work in a vs 2012 project, I have the following segments.  I'm not sure I understand what wscript does, here are the example pieces.

objArgs = wscript.Arguments
        If (objArgs.Count = 2) Then
            DirName = CStr(objArgs(0))
            ReadingDate = CDate(objArgs(1))
        ElseIf (objArgs.Count = 1) Then
... code here

    FileSys = wscript.CreateObject("Scripting.FileSystemObject")

Open in new window

0
Comment
Question by:UnderSeven
3 Comments
 
LVL 24

Expert Comment

by:chaau
ID: 39649698
What is your question?
0
 
LVL 5

Accepted Solution

by:
Dontmilkthis earned 500 total points
ID: 39649737
If you're asking what the 'wscript' object is within vbscript, you can read a little about it on MSDN - http://msdn.microsoft.com/en-us/library/at5ydy31(v=vs.84).aspx

It is basically a global variable that's used interact with the scripting engine.

The most useful things wscript can do is:
Provide access to the arguments/parameters used when calling the script
Output to the console
initialise various system level object types

I don't know of a related object in VB.net. the functionality is split throughout the .Net libray.

for the two uses in your snippet.
arguments can be obtained from
My.Application.CommandLineArgs

Open in new window


the file system object (Scripting.FileSystemObject) functionality can be found within the System.IO namespace.
0
 

Author Closing Comment

by:UnderSeven
ID: 39649782
Yep.  This is what I was looking for. Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Send secure, cloud-based, encrypted alerts and maintain HIPAA compliant messaging. Integrates priority & secure messaging into one application. Ensures IT, emergency respondents and healthcare professionals that their critical messages are never mis…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now