Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using "command" to get a console command line parameter

Status
Not open for further replies.

gacaccia

Technical User
May 15, 2002
258
US
hi all,

i've made a simple console application that is designed to read some text files, find instances of a string, and replace it with something else. i wanted a user to be able to specify command line parameters for passing in the target text and the replacement text. to this end, i used the "command" method as follows...

Code:
    Function getParameters(ByRef oldPath As String, ByRef newPath As String) As Boolean
        Dim sText As String
        Dim arPaths() As String
        Dim srReader As System.IO.StreamReader
        sText = Command()
        If sText = "" Then
            printInstructions()
            Return False
        Else
            ...
[\code]

the program runs aok, i thought, until i took it into work, copied to a remote location via a mapped drive and tried to run it.  i got an immediate crash with the following (condensed) error message.

An unhandled exception of type System.Security.SecurityException occurred in MSCORLIB.DLL

i also had a mapped drive to a shared folder on my local drive.  i found that if i tried to run the program through the mapped drive to my local folder, the program crashed.  if i ran it directly from the local folder, it ran aok.

i got home and created a mapped drive to a local folder with the same results.  the debugger indicates that the program crashes on the line "sText = Command()", where it tries to read any command line options.

any ideas why?

thanks,

glenn
 
I know this is not an answer, because it is microsofts new security initiative. We put the executables on the users machine that had mapped the drive and had rights and copied out to the map with our data. No problem then.

That doesnt work if you want everyone to be able to hit it from the network though as an exe.


Go Canucks! (rabid Vancouver Canucks Fan)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top