Is it still possible to pass parameters to a .NET application via a shortcut file.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a VB.NET application that is almost ready to deploy. Normally this application is just launched and the user interacts through the application's forms. However, I want to be able to add it to the Windows sheduler to automatically do something once a day but need to specify some parameters that the user would normally enter themselves. Can I still pass append parameters to the target string of a Shortcut and if so how do I then pick them up within my code

thanks.
 
Aeryn said:
I have a VB.NET application that is almost ready to deploy. Normally
this application is just launched and the user interacts through the
application's forms. However, I want to be able to add it to the
Windows sheduler to automatically do something once a day but need to
specify some parameters that the user would normally enter
themselves. Can I still pass append parameters to the target string
of a Shortcut and if so how do I then pick them up within my code?


Yes, it's possible:
http://groups.google.com/groups?selm=#P#[email protected]


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
* "=?Utf-8?B?QWVyeW4=?= said:
I have a VB.NET application that is almost ready to deploy. Normally
this application is just launched and the user interacts through the
application's forms. However, I want to be able to add it to the Windows
sheduler to automatically do something once a day but need to specify
some parameters that the user would normally enter themselves. Can I
still pass append parameters to the target string of a Shortcut and if
so how do I then pick them up within my code?

This code shows you how to get the passed data:

\\\
Public Sub Main(ByVal astrCmdLineArgs() As String)
Dim i As Integer
For i = 0 To astrCmdLineArgs.Length - 1
Console.WriteLine(astrCmdLineArgs(i))
Next i
End Sub
///

- or -

\\\
Public Sub Main()
Dim i As Integer
For i = 0 To Environment.GetCommandLineArgs().Length - 1
Console.WriteLine(Environment.GetCommandLineArgs(i))
Next i
End Sub
///

Notice that the startup object must be set to 'Sub Main'.
 
Back
Top