I need to start my VB.NET app through a batch file and pass an argument to it. The app uses the argument (a dated directory;Ex: 20120530) to process the data files there, output a CSV and a Log file and then close the app.

The app does not need any human intervention or input.

Can someone tell me how that is done?

Recommended Answers

All 2 Replies

My.Application.CommandLineArgs

returns an array of strings, one string per argument

commented: Good +0

My.Application.CommandLineArgs

Thanks Jim, tried the code below and I 'get it'. I assume that early in my code I'll declare "Public My.Application.CommandLineArgs(0) AS String (or whatever)"

If My.Application.CommandLineArgs.Count > 0 Then
    MessageBox.Show(My.Application.CommandLineArgs(0))
    Else
    MessageBox.Show("No argument provided")
    End If

Appreciate the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.