process.start(filename), shell(filename) weird behavior

  • Thread starter Thread starter Peter Proost
  • Start date Start date
P

Peter Proost

Hi group,

I've got a program that creates a bat and a sql file and then executes the
bat file

the bat file is called temp.bat
and looks like this:

osql -U"user" -P"password" -S"pcname\instance" -i temp.sql -o temp.txt

the temp.sql file that's called as input in the bat file looks like this:
use pfd
drop table ea005temp
select * into ea005temp from ea005
delete from ea005temp

now the problem is when I call the bat file from my program with
shell(filename) or process.start(filename) or process.start("osql",
"-U"user" -P"password" -S"pcname\instance" -i temp.sql -o temp.txt") I see
the dos window open but the bat file doesn't get executed, but when I double
click the bat file it runs just fine.
Anyone knows what could be the problem?

Greetz Peter
 
Hi group I've found the answer myself, when I call the shell it starts the
cmd at c:\ and there it doesn't find the files temp.sql and temp.txt because
they're created in the application.startuppath just like the bat file and
that's why it didn't work but it did when I double clicked the bat because
then it starts the cmd at the correct path

greetz Peter
 
Peter,

I had no answer however a nice method to install msde

I assumed that you did look already if ProcessStartInfo could help you?

:-)

Cor
 
Peter Proost said:
now the problem is when I call the bat file from my program with
shell(filename) or process.start(filename) or process.start("osql",
"-U"user" -P"password" -S"pcname\instance" -i temp.sql -o temp.txt") I see
the dos window open but the bat file doesn't get executed, but when I
double
click the bat file it runs just fine.
Anyone knows what could be the problem?

Try to set the working directory:

\\\
Imports System.Diagnostics
..
..
..
Dim psi As New ProcessStartInfo()
With psi
.FileName = "osql"
.Arguments = ...
.WorkingDirectory = "C:\MySQLScripts"
End With
Process.Start(psi)
///
 
Thnx, for your answer Herfried, I had already found out myself that that was
the problem (see my previous post) But thnx again

greetz Peter
 
Cor,

I don't actualy use it to install msde, but I've written a sort of msde
manager, because my program will be installed with our company distributors
in Belgium/France and the Netherlands and to make my colleague, who has to
go and install the program and perfrom database updates, his work easier
I've written a .net program to view/export/import and update the tables and
backup and restore the msde database. So if you or anyone else ever needs
anything like this.

Greetz Peter
 
Peter, would be interested in seeing how you worked with the MSDE database. I have another project that I will be working on (
once I get thru the mess I'm working on now) that will probably involve MSDE.
If you are willing to share the code that would be nice.
james

email: jjames700 AT earthlink DOT net
(maybe that will slow up the spammers! )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top