I am having issues copying files from network drive to local machine using
xcopy. The following code works alright for a console application, but as
soon as i call this code in Form Load event of windows application it does
not work. I am confused here, it copies files in a console application, but
not windows app
ProcessStartInf o info = new ProcessStartInf o("xcopy", "");
info.FileName = "xcopy";
info.Arguments = string.Format(" \"{0}\" \"{1}\" /r/e/c/i/y/d",
@"\\melsrv01\Pu blic\Templates\ Austock Office\.",
@"C:\temp\Te st Images");
info.UseShellEx ecute = false;
info.RedirectSt andardOutput = true;
Process process = Process.Start(i nfo);
string result = process.Standar dOutput.ReadToE nd();
process.WaitFor Exit();
Console.WriteLi ne(result);
//MessageBox.Show (result);
Please help. Thanks 5 5848
"Job Lot" <Jo****@discuss ions.microsoft. comwrote in message
news:BF******** *************** ***********@mic rosoft.com...
>I am having issues copying files from network drive to local machine using
xcopy. The following code works alright for a console application, but as
soon as i call this code in Form Load event of windows application it does
not work. I am confused here, it copies files in a console application,
but
not windows app
What do you mean by "does not work"?
It copies the file from network drive to local machine in the console
application, but does not copy anything when the same code is used in Form
Load event of the windows application.
"John Vottero" wrote:
"Job Lot" <Jo****@discuss ions.microsoft. comwrote in message
news:BF******** *************** ***********@mic rosoft.com...
I am having issues copying files from network drive to local machine using
xcopy. The following code works alright for a console application, but as
soon as i call this code in Form Load event of windows application it does
not work. I am confused here, it copies files in a console application,
but
not windows app
What do you mean by "does not work"?
It's a quirk of xcopy.exe; when you redirect output you have to
redirect input too. If you don't, it immediately (and silently) quits
right after startup.
As a complete aside - can I recommend robocopy as a replacement to
xcopy? You can download from Microsoft, or it is included in Vista; it
does more, does it better, and does it quicker.
Marc
Thanks hp******@gmail. com that did the trick. I didn't find any mention of
that in MSDN !!!
"hp******@gmail .com" wrote:
It's a quirk of xcopy.exe; when you redirect output you have to
redirect input too. If you don't, it immediately (and silently) quits
right after startup.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt Calhoon |
last post by:
Hi there,
I have specified a aspnet user account to run all .net sites. This account
needs access to start a .BAT File (in my global.asax on session start the app
needs to execute this bat file). I have given the aspnet user Read and
execute but the .bat will still not start.
What specific permissions does this user need for other folders to start a
..bat file? Does the user need access to the WINNT\System32 directory or the...
|
by: banz |
last post by:
Hello
I have a problem to resolve: I wrote a Perlscript which caches data from a
server (local on my machine) I would like to have a other connection to a
remote server but I don't know how to define the servername / hostname in
my Perl Progrem..
Here is the code:
|
by: Dave |
last post by:
I need to create an executible that will run on a nightly basis.
The executible is a simple command line statement like:
OSQL -Usa -PmyPasword -n -Q "BACKUP DATABASE msdb TO DISK =
'c:\msdb.dat_bak'"
Is it possible to use C# to create an executible that will run this command
line statement on a scheduled basis?
|
by: Joey Mack |
last post by:
Greetings. I am trying to use the System.Diagnostics.Process class to
perform some actions through the Windows command line. The applicable
code appears below. The code builds the follow command fine, and will
open the command line in the proper working directory, but will not send
the follow-up command to the command line.
The code also catches no errors.
Any assistance would be greatly appreciated.
|
by: wayne hamilton |
last post by:
I'm having a problem Interacting with Command Line programs. I can read and
write anything I want as long as I don't have to interact with a process
once it's started. Originally I had been calling 'test.bat' directly, and in
the latest incarnation (below) I am starting up cmd.exe and then writing the
commands I want to execute to the command line that way.
My problem is that I need to know if a program is waiting for input. In my
batch...
| |
by: David Eadie |
last post by:
G'Day all,
I cant for the God in me work out how to execute the following command
line in vb.net: (watch for the word wrapping also)
Sub(ByVal username As String)
Shell("ECHO Y| cacls h:\finance\" & username & "\" & "+Common /G " &
username & ":R", AppWinStyle.Hide, True)
End Sub
|
by: Patrick A. |
last post by:
Dll written in VB.NET 2003 to start a command remotely.
You can :
- launch the command and wait until it's finished. (Ex. 1)
- launch the command providing a timeout in seconds, it will wait until
it's finished. If the command didn't terminate within the timeout, the
command is killed. (Ex. 2)
- launch the command and continue your processing after the command has
been started remotely (Ex. 3).
|
by: Brad |
last post by:
I have an issue trying to execute commands in a web service. The command
starts under the specified user. However, it never completes its execution. I
can execute simple commands like "echo HELLO" and cmd.exe starts but never
terminates. I'm relatively new to .NET, so I may be forgetting some thing
obvious. Thanks! Here's the code:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
|
by: henrymania |
last post by:
Am writing a code for database backup....by backupservlet is as given below
i get the following exception
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |