Solved

How best to re-write vbs script code wscript

Posted on 2013-11-14
3
350 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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