I have written a small app that basicly builds a file that is then required to be processed by a dos app. I have used the following code to call the app:
dim opsi as new processStartInfo(exepath)
dim oprocess as New Process
opsi.useshellexecute = false
opsi.redirectstandardinput = true
opsi.workingdirectory = IO.Path.GetdirectoryName(exepath)
oprocess = process.start(opsi)
oprocess.standardinput.writeline(inpfile)
oprocess.waitforexit()
Now when I run this in Visual Studio, all is well and the file gets processed, however, now I have come to distribute the app I run into the following problems:
* When using any of the .exe files created in the bin directory it appears that the Dos program either isn't called ( a dos box appears briefly then shuts down) or the dos box doesn't receive the file name I am sending. This happens if I also run my programs exe from obj/debug and obj/release directories.
* If I change the redirectstandardinput to use shellexecute then the dos program is called and appears on screen waiting for the name of the file to be processed, but I can't seem to work out how to send the filename this way as the dos program doesn't accept arguments.
Initially I thought it was a problem with the machine I am passing the executable to but it also does the same on my development machine. What am I doing wrong?
regards,
Matt
dim opsi as new processStartInfo(exepath)
dim oprocess as New Process
opsi.useshellexecute = false
opsi.redirectstandardinput = true
opsi.workingdirectory = IO.Path.GetdirectoryName(exepath)
oprocess = process.start(opsi)
oprocess.standardinput.writeline(inpfile)
oprocess.waitforexit()
Now when I run this in Visual Studio, all is well and the file gets processed, however, now I have come to distribute the app I run into the following problems:
* When using any of the .exe files created in the bin directory it appears that the Dos program either isn't called ( a dos box appears briefly then shuts down) or the dos box doesn't receive the file name I am sending. This happens if I also run my programs exe from obj/debug and obj/release directories.
* If I change the redirectstandardinput to use shellexecute then the dos program is called and appears on screen waiting for the name of the file to be processed, but I can't seem to work out how to send the filename this way as the dos program doesn't accept arguments.
Initially I thought it was a problem with the machine I am passing the executable to but it also does the same on my development machine. What am I doing wrong?
regards,
Matt