473,382 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

execute bat file in vb.net

We have an application that is accessed using shared drives, client
executes program from server. We have already coded the program to
create and save the a bat file either locally on the users machine or
on the
server. Our problem is that when we execute the bat file from the
vb code it does not work properly. The bat file is used to connect to
a commnad line service running on the server and update a file in
another system. We can execute the bat properly from our local drives
as well from the server if we use pc anywhere and the system is
updated. If we execute it from within the vb code it fails, we see the
command window come up but the update does not happen. In order to run
properly the bat must be in the same directory as a client executable
and a mapping file I am wondering if when running it from within the
client code we are disassocating it from these. The code we are using
to create and execute the bat is as followd.

Dim strMacNo As String = txtField8.Text

Dim strHelpDeskNo As String = txtField5.Text

Dim strMessage As String = txtField11.Text

Dim srw As StreamWriter = File.CreateText(FILE_NAME)

srw.WriteLine("REM :START")

srw.WriteLine("client AddCallNote.txt ResultsFile.xml uid pwd " &
strHelpDeskNo & " ADMIN MOVE_TEAM PROGRESS_UPDATE " & """" &
strMessage & """" & " " & """" & strMacNo & """")

srw.WriteLine("REM GOTO START")

srw.Close()

Dim p As Process = New Process

Dim s As String

Dim outfile As String = Application.StartupPath & FILE_NAME

Dim sysFolder As String =
System.Environment.GetFolderPath(Environment.Speci alFolder.System.System)

p.StartInfo.FileName = "cmd.exe"

p.StartInfo.Arguments = "/C cd " & _

sysFolder & " && dir *.com >> " & Chr(34) & _

outfile & Chr(34) & " && exit"

p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized

p.StartInfo.CreateNoWindow = False

p.Start()
any ideas?
Jul 21 '05 #1
0 2013

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
3
by: Lyle Fairfield | last post by:
MS-SQL Server utilities Enterprise Manager and Query Analyzer will model almost any MS-SQL object as a simple script file with a default ".sql" extension. But how to "run these files? They are...
1
by: Eric Wood | last post by:
We have an application that is accessed using shared drives, client executes program from server. We have already coded the program to create and save the a bat file either locally on the users...
0
by: Eric Wood | last post by:
We have an application that is accessed using shared drives, client executes program from server. We have already coded the program to create and save the a bat file either locally on the users...
2
by: Sike | last post by:
Hi everyone, I've been browsing this and a few other related newsgroups trying to get my head around this problem, and so far all the trails seem to go cold, without an acceptable solution being...
17
by: =?Utf-8?B?SmltIFJvZGdlcnM=?= | last post by:
I am trying to replace a huge chunck of code that currently I incorporate with an #Include directive. The program rarely has to flow through that code, so I thought it would be better if I used...
3
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
7
by: Service4PC | last post by:
Hi all, I've a problem... I'm writing an extension for php, and i need to execute a file php... but only the content of the file and not the file... Now I better explain: - the extension get the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.