thanks for the reply
i know how to the variables will work
but i am not sure how to pass the command line to a variable ??
Main Topics
Browse All TopicsI have an application that passes command line parameters to an exe or a batch file. I want to create a batch file that takes this command line input and does an operation (copy and paste a file) and then execute an exe passing the same command line variables.
The problem that I am having is that I am not quite sure how to get the command line inputs from the batch file.
For Example: I run the batch file like this (on start>run) c:\mybatch.bat cl1 cl2 cl3
now i want to be able to take this input i.e. cl1 cl2 cl3 and pass it to a exe like:
c:\myexe.exe cl1 cl2 cl3
to do this i will have to push this command line into a variable.. how will i do that?
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Ok...you are asking how to get the cl value inside the exe then? Based on your previous questions, I assume you are working with VB:
Option Explicit
Private firstValue As String
Private secondValue As String
Private thirdValue As String
Private Sub Form_Load()
Dim parameter As Variant
parameter = Split(Command())
firstValue = parameter(0)
secondValue = parameter(1)
thirdValue = parameter(2)
' etc....
End Sub
And you already said you understood how variables in a batch file work:
>> i know how to the variables will work
Which is why I thought maybe you needed VB code instead.
If you call your batch file like this:
c:\mybatch.bat cl
The inside mybatch.bat, you can reference the value cl using the %1 variable.
If this is the contents of mybatch.bat:
@echo Your variable is %1
Then calling it as shown above will result in:
Your variable is cl
~IM
Oh. ok..
i knew that variables were needed..and i knew how to output variables..but i didn't know that the variables are essentially the same as the command line inputs..
But it still doesnt work..heres why
My batch looks like the following:
"\\NetworkLocation\Folder\
and so it should essentially open "my.exe" and and pass the same command line.. right?
but it gives me this error: "The system cannot find the path specified."
I know that the path exists and i have tried running this batch to open the same file when it is not on the network path with a command line (and it runs). like this:
"c:\my.exe %1"
So I thought that the problem is with a batch file opening a network location.. so i put a different exe in the network location and opened it like this (with no command line):
"\\NetworkLocation\Folder\
But this seems to work as well..
So the only thing that i can deduce is the fact that opening a file in a network location with a command line is causing a problem??
how about running this in .NET:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
System.Diagnostics.Process
End Sub
do i have to get any permissions for the asp.net process in the network location?
How can i send 2 parameter for calling an exe file from System.diagnostic.process.
I tried the following way
1. System.Diagnostics.Process
Error : Comma,')', or a valid expression continuation expected.
2. System.Diagnostics.Process
Error : Overload resolution failed because no accissible 'Start' accepts this number of arguments.
Manish Kaushik
Business Accounts
Answer for Membership
by: Idle_MindPosted on 2004-12-06 at 06:41:36ID: 12754314
The parameters will be put into the variables %1 ---> %3 where %1 is the first command line parameter, %2 is the second command line parameter, etc....
So you should be able to pass the parameters to the secod app like this:
c:\myexe.exe %1 %2 %3
~IM