Hi.
I have this code:
Dim p As New Process
Dim info As New ProcessStartInfo
Dim sa As New ArrayList
Dim s As String
Try
With info
..FileName = "c:\test.bat"
..RedirectStandardError = True
..UseShellExecute = False
..RedirectStandardOutput = True
End With
p = Process.Start(info)
While Not (p.HasExited)
End While
sa.Add("StandardError: " & p.StandardError.ReadToEnd())
sa.Add("StandardOutput: " & p.StandardOutput.ReadToEnd())
sa.Add("ExitCode: " & p.ExitCode)
sa.Add("ExitTime: " & p.ExitTime)
sa.Add("HasExited: " & p.HasExited)
Catch ex As Exception
sa.Add("Exception: " & ex.Message)
End Try
It works great if the C:\test.bat file contains something like:
copy D:\*.* X:\
But it dows not work if the C:\test.bat file contains somthing including
xcopy like:
xcopy D:\*.* X:\
The data to transfer is not more than ~1 MB in both cases, though xcopy
copies the
sub directories too.
Could anyone please help me.
Thanx a lot.
volker 5 2873
1.
instead of
While Not (p.HasExited)
End While
use
p.WaitForExit ...
2.
what is the output of the process?
--
"I didn't think it was physically possible, but this both sucks and
blows." - Bart Simpson
"Volker Jobst" <bu****@gmx.de> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Hi.
I have this code:
Dim p As New Process Dim info As New ProcessStartInfo Dim sa As New ArrayList Dim s As String Try With info .FileName = "c:\test.bat" .RedirectStandardError = True .UseShellExecute = False .RedirectStandardOutput = True End With p = Process.Start(info) While Not (p.HasExited) End While sa.Add("StandardError: " & p.StandardError.ReadToEnd()) sa.Add("StandardOutput: " & p.StandardOutput.ReadToEnd()) sa.Add("ExitCode: " & p.ExitCode) sa.Add("ExitTime: " & p.ExitTime) sa.Add("HasExited: " & p.HasExited) Catch ex As Exception sa.Add("Exception: " & ex.Message) End Try
It works great if the C:\test.bat file contains something like: copy D:\*.* X:\
But it dows not work if the C:\test.bat file contains somthing including xcopy like: xcopy D:\*.* X:\
The data to transfer is not more than ~1 MB in both cases, though xcopy copies the sub directories too.
Could anyone please help me.
Thanx a lot.
volker
My problem is, that the code behind the p = Process.Start(info) never
starts.
So there is no output and I don't know where to start, but the xcopy must be
involved
because without it the batchfile and the hole program work.
If I change my code from
While Not (p.HasExited)
End While
to
WriteLine("Here1")
p.WaitForExit()
WriteLine("Here2")
there is no "Here2" on the screen, though I have been waiting long enough.
The app just hangs.
If a don't use the /e in the xcopy command, it works, excluding
subdirectories.
When I doubleclick the C:\test.bat, it works fine, even with /e.
So the orror must be in there, but I don't know where to ask.
volker
"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:er**************@TK2MSFTNGP10.phx.gbl... 1. instead of While Not (p.HasExited) End While
use p.WaitForExit ...
2. what is the output of the process? --
"I didn't think it was physically possible, but this both sucks and blows." - Bart Simpson
"Volker Jobst" <bu****@gmx.de> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... Hi.
I have this code:
Dim p As New Process Dim info As New ProcessStartInfo Dim sa As New ArrayList Dim s As String Try With info .FileName = "c:\test.bat" .RedirectStandardError = True .UseShellExecute = False .RedirectStandardOutput = True End With p = Process.Start(info) While Not (p.HasExited) End While sa.Add("StandardError: " & p.StandardError.ReadToEnd()) sa.Add("StandardOutput: " & p.StandardOutput.ReadToEnd()) sa.Add("ExitCode: " & p.ExitCode) sa.Add("ExitTime: " & p.ExitTime) sa.Add("HasExited: " & p.HasExited) Catch ex As Exception sa.Add("Exception: " & ex.Message) End Try
It works great if the C:\test.bat file contains something like: copy D:\*.* X:\
But it dows not work if the C:\test.bat file contains somthing including xcopy like: xcopy D:\*.* X:\
The data to transfer is not more than ~1 MB in both cases, though xcopy copies the sub directories too.
Could anyone please help me.
Thanx a lot.
volker
strange...
isn't the xcopy waiting for some user input?
"Volker Jobst" <bu****@gmx.de> wrote in message
news:Or**************@TK2MSFTNGP09.phx.gbl... My problem is, that the code behind the p = Process.Start(info) never starts.
So there is no output and I don't know where to start, but the xcopy must
be involved because without it the batchfile and the hole program work.
If I change my code from
While Not (p.HasExited) End While
to
WriteLine("Here1") p.WaitForExit() WriteLine("Here2")
there is no "Here2" on the screen, though I have been waiting long enough. The app just hangs.
If a don't use the /e in the xcopy command, it works, excluding subdirectories. When I doubleclick the C:\test.bat, it works fine, even with /e.
So the orror must be in there, but I don't know where to ask.
volker
"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in message news:er**************@TK2MSFTNGP10.phx.gbl... 1. instead of While Not (p.HasExited) End While
use p.WaitForExit ...
2. what is the output of the process? --
"I didn't think it was physically possible, but this both sucks and blows." - Bart Simpson
"Volker Jobst" <bu****@gmx.de> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... Hi.
I have this code:
Dim p As New Process Dim info As New ProcessStartInfo Dim sa As New ArrayList Dim s As String Try With info .FileName = "c:\test.bat" .RedirectStandardError = True .UseShellExecute = False .RedirectStandardOutput = True End With p = Process.Start(info) While Not (p.HasExited) End While sa.Add("StandardError: " & p.StandardError.ReadToEnd()) sa.Add("StandardOutput: " & p.StandardOutput.ReadToEnd()) sa.Add("ExitCode: " & p.ExitCode) sa.Add("ExitTime: " & p.ExitTime) sa.Add("HasExited: " & p.HasExited) Catch ex As Exception sa.Add("Exception: " & ex.Message) End Try
It works great if the C:\test.bat file contains something like: copy D:\*.* X:\
But it dows not work if the C:\test.bat file contains somthing
including xcopy like: xcopy D:\*.* X:\
The data to transfer is not more than ~1 MB in both cases, though
xcopy copies the sub directories too.
Could anyone please help me.
Thanx a lot.
volker
No, there can't be any waiting for input.
Thanx a lot Dominique, but I can't see a solution.
"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in
message news:eg**************@TK2MSFTNGP10.phx.gbl... strange... isn't the xcopy waiting for some user input?
"Volker Jobst" <bu****@gmx.de> wrote in message news:Or**************@TK2MSFTNGP09.phx.gbl... My problem is, that the code behind the p = Process.Start(info) never starts.
So there is no output and I don't know where to start, but the xcopy
must be involved because without it the batchfile and the hole program work.
If I change my code from
While Not (p.HasExited) End While
to
WriteLine("Here1") p.WaitForExit() WriteLine("Here2")
there is no "Here2" on the screen, though I have been waiting long
enough. The app just hangs.
If a don't use the /e in the xcopy command, it works, excluding subdirectories. When I doubleclick the C:\test.bat, it works fine, even with /e.
So the orror must be in there, but I don't know where to ask.
volker
"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in message news:er**************@TK2MSFTNGP10.phx.gbl... 1. instead of While Not (p.HasExited) End While
use p.WaitForExit ...
2. what is the output of the process? --
"I didn't think it was physically possible, but this both sucks and blows." - Bart Simpson
"Volker Jobst" <bu****@gmx.de> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... > Hi. > > I have this code: > > Dim p As New Process > Dim info As New ProcessStartInfo > Dim sa As New ArrayList > Dim s As String > Try > With info > .FileName = "c:\test.bat" > .RedirectStandardError = True > .UseShellExecute = False > .RedirectStandardOutput = True > End With > p = Process.Start(info) > While Not (p.HasExited) > End While > sa.Add("StandardError: " & p.StandardError.ReadToEnd()) > sa.Add("StandardOutput: " & p.StandardOutput.ReadToEnd()) > sa.Add("ExitCode: " & p.ExitCode) > sa.Add("ExitTime: " & p.ExitTime) > sa.Add("HasExited: " & p.HasExited) > Catch ex As Exception > sa.Add("Exception: " & ex.Message) > End Try > > It works great if the C:\test.bat file contains something like: > copy D:\*.* X:\ > > But it dows not work if the C:\test.bat file contains somthing including > xcopy like: > xcopy D:\*.* X:\ > > The data to transfer is not more than ~1 MB in both cases, though xcopy > copies the > sub directories too. > > Could anyone please help me. > > Thanx a lot. > > volker > >
Now I'm just pipelining the output into a text file like:
xcopy D:\*.* X:\ >C:\result.txt
and it works fine now.
"Volker Jobst" <bu****@gmx.de> wrote in message
news:OS**************@TK2MSFTNGP10.phx.gbl... No, there can't be any waiting for input.
Thanx a lot Dominique, but I can't see a solution.
"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote in message news:eg**************@TK2MSFTNGP10.phx.gbl... strange... isn't the xcopy waiting for some user input?
"Volker Jobst" <bu****@gmx.de> wrote in message news:Or**************@TK2MSFTNGP09.phx.gbl... My problem is, that the code behind the p = Process.Start(info) never starts.
So there is no output and I don't know where to start, but the xcopy must be involved because without it the batchfile and the hole program work.
If I change my code from
While Not (p.HasExited) End While
to
WriteLine("Here1") p.WaitForExit() WriteLine("Here2")
there is no "Here2" on the screen, though I have been waiting long enough. The app just hangs.
If a don't use the /e in the xcopy command, it works, excluding subdirectories. When I doubleclick the C:\test.bat, it works fine, even with /e.
So the orror must be in there, but I don't know where to ask.
volker
"Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> wrote
in message news:er**************@TK2MSFTNGP10.phx.gbl... > 1. > instead of > While Not (p.HasExited) > End While > > use > p.WaitForExit ... > > > 2. > what is the output of the process? > > > > -- > > "I didn't think it was physically possible, but this both sucks and > blows." - Bart Simpson > > > "Volker Jobst" <bu****@gmx.de> wrote in message > news:%2****************@TK2MSFTNGP12.phx.gbl... > > Hi. > > > > I have this code: > > > > Dim p As New Process > > Dim info As New ProcessStartInfo > > Dim sa As New ArrayList > > Dim s As String > > Try > > With info > > .FileName = "c:\test.bat" > > .RedirectStandardError = True > > .UseShellExecute = False > > .RedirectStandardOutput = True > > End With > > p = Process.Start(info) > > While Not (p.HasExited) > > End While > > sa.Add("StandardError: " & p.StandardError.ReadToEnd()) > > sa.Add("StandardOutput: " & p.StandardOutput.ReadToEnd()) > > sa.Add("ExitCode: " & p.ExitCode) > > sa.Add("ExitTime: " & p.ExitTime) > > sa.Add("HasExited: " & p.HasExited) > > Catch ex As Exception > > sa.Add("Exception: " & ex.Message) > > End Try > > > > It works great if the C:\test.bat file contains something like: > > copy D:\*.* X:\ > > > > But it dows not work if the C:\test.bat file contains somthing including > > xcopy like: > > xcopy D:\*.* X:\ > > > > The data to transfer is not more than ~1 MB in both cases, though xcopy > > copies the > > sub directories too. > > > > Could anyone please help me. > > > > Thanx a lot. > > > > volker > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: xo55ox |
last post by:
After setting up the linked server connection at the standby server, I
tried to xcopy a file through the sql server 2000 schedule task to the
standby server's shared directory. But it keeps giving...
|
by: Ryno Rijnsburger |
last post by:
I am busy packaging our product as a standard Setup project in VS.NET that
uses
a bunch of merge modules (basically, a merge module for every key
infrastructure
component in our system).
Part...
|
by: Zeya |
last post by:
I am developing a ASP.Net(Web) based deployment tool, which requires
XCOPY functionality.
Here is the code for the method:
public static int ExecuteProcess ( string ProcessName, string...
|
by: Bruce Schechter |
last post by:
Whereas Microsoft highlights the concept of "xcopy deployment" for .NET
applications, I gather that it is not necessarily possible to move an
ASP.NET application from one computer to another via...
|
by: Grigs |
last post by:
Hello,
I am attempting to write a Web Method in my Web Service that starts a
process that runs the XCOPY command with passed in parameters. It is failing
on me through code. However, if I take...
|
by: lizii |
last post by:
At the moment my company have asked me to look into installations. We
use pure .NET applications and although i have looked into installer
programs (installshield...wise..etc) none of them are...
|
by: vinayakkatkam |
last post by:
public bool ProcessXCopy()
{
string XCopyArguments = "C:\\Documents and Settings\\Vinayak.Katkam\\Desktop\\SYNCHRONIZATION\\BASE-VERSION\\SDDS\\*.* " + "C:\\Documents and...
|
by: Dave |
last post by:
I'm trying to do the following xcopy from my Windows installer and it
doesn't work. I even tried running the installer as user with
credentials instead of LocalService. I'm running in 2003Server,...
|
by: Liz |
last post by:
I was intending to use an XCOPY install for a VS2005 C# WinForms app but
when I copied the files and ran the app on a clean machine it failed when it
needed Crystal Reports. Can you not use XCOPY...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |