.NET

Reply
Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 1 of 3 (393 Views)
Accepted Solution

passing parameter to batch file problem

393 Views, 2 Replies
11-20-2012 07:05 AM

Hi,

 

I'm new in programming. I need help from expert. I got a problem to pass parameter from VB to batch file. My code is below to run the batch file and to pass parameter.

 

Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click

 

Dim input As String

Dim output AsString

input = "C:\batchFile\test.gds"

output ="C:\batchFile\test.dxf"

Dim batchFile As String = "C:\batchFile\LC_gds2dxf.bat"

Process.Start(batchFile, input & ""& output)

 

EndSub

 

With this code the output is like below:

Capture.JPG

 

If you look at the screen shot you can find out that input and output variable is passing to one variable LC_gdsin. But I want that output file location will be assigned to LC_dxfout. I tried a lot but could not able to do that. Can anybody help me in this regard.

 

I am using VB2010 premium and windows 7 32 bit pc

 

Thanks

Zakir

If your code is as written, you need a space between input and output - your code shows null (change "" to " ").  Or, you could add a leading space to the strings in Dim. Or, you could create a 3rd string that combines strings 1 & 2 with a space in between.

 

Create a test batch file and check (echo) that %1 and %2 are recognized correctly.

Echo %1

Echo %2

Thanks a lot, it is working fine now

Valued Mentor
fieldguy
Posts: 376
Registered: ‎03-31-2005
Message 2 of 3 (379 Views)

Re: passing parameter to batch file problem

11-20-2012 08:20 AM in reply to: mzakiralam

If your code is as written, you need a space between input and output - your code shows null (change "" to " ").  Or, you could add a leading space to the strings in Dim. Or, you could create a 3rd string that combines strings 1 & 2 with a space in between.

 

Create a test batch file and check (echo) that %1 and %2 are recognized correctly.

Echo %1

Echo %2

Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 3 of 3 (374 Views)

Re: passing parameter to batch file problem

11-20-2012 08:24 AM in reply to: fieldguy

Thanks a lot, it is working fine now

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.