473,763 Members | 7,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XCopy not performing process - need help

1 New Member
public bool ProcessXCopy()
{
string XCopyArguments = "C:\\Docume nts and Settings\\Vinay ak.Katkam\\Desk top\\SYNCHRONIZ ATION\\BASE-VERSION\\SDDS\\ *.* " + "C:\\Docume nts and Settings\\Vinay ak.Katkam\\Desk top\\SYNCHRONIZ ATIONBACKUP\\BA CKUP";
Process XCopyProcess = new Process();
ProcessStartInf o XCopyStartInfo = new ProcessStartInf o();

XCopyStartInfo. FileName = "CMD.exe ";

XCopyStartInfo. RedirectStandar dError = false;
XCopyStartInfo. RedirectStandar dOutput = false;
XCopyStartInfo. RedirectStandar dInput = false;

XCopyStartInfo. UseShellExecute = false;
//Dont show a command window
XCopyStartInfo. CreateNoWindow = true;

//XCopyStartInfo. CreateNoWindow = false;

XCopyStartInfo. Arguments = "XCOPY " + XCopyArguments ;

XCopyProcess.En ableRaisingEven ts = true;
XCopyProcess.St artInfo = XCopyStartInfo;

//start cmd.exe & the XCOPY process
XCopyProcess.St art();

//set the wait period for exiting the process
XCopyProcess.Wa itForExit(); //or the wait time you want

int ExitCode = XCopyProcess.Ex itCode;
bool XCopySuccessful = true;

//Now we need to see if the process was successful
if (ExitCode > 0 & !XCopyProcess.H asExited)
{
XCopyProcess.Ki ll();
XCopySuccessful = false;
}

//now clean up after ourselves
XCopyProcess.Di spose();
XCopyStartInfo = null;
return XCopySuccessful ;


// XCopyStartInfo. Arguments = " XCOPY " + @"'C:\Docume nts and Settings\Vinaya k.Katkam\Deskto p\SYNCHRONIZATI ON\BASE-VERSION\SDDS'" + " " + @"'C:\Docume nts and Settings\Vinaya k.Katkam\Deskto p\SYNCHRONIZATI ONBACKUP\BACKUP ' /D /E /c ";
//XCopyStartInfo. Arguments = "/D /c /E /-Y XCOPY " + XCopyArguments;
//
}

I took this code from another discussion and made minor modifications. Looks like it worked for everybody. Can any one help me with this. Thanks
Aug 22 '07 #1
1 1871
Plater
7,872 Recognized Expert Expert
Well if it matters, this section will never be true since you are already doing a blocking call until exiting.
Expand|Select|Wrap|Line Numbers
  1. //Now we need to see if the process was successful
  2. if (ExitCode > 0 & !XCopyProcess.HasExited)
  3. {
  4. XCopyProcess.Kill();
  5. XCopySuccessful = false;
  6. }
  7.  
What is the problem you have? are there any error messages? Are you sure it's understanding your path and everything correctly?
Try actualling looking at it's StandardOut and StandardError streams to see what messages you are being given.

Also, in general, you would usually want to make the command be "XCOPY" and not "CMD.exe", as that seems a bit redundant and could be the cause of the error.
Aug 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
8789
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 me the error message with 'Invalid Drive Specification'. My whole process includes 1) set up linked server connection on the standby server 2) set up job to xcopy file as operating system commend in sql server from the production box(xcopy...
2
6456
by: Brian Link | last post by:
Is there a Platform way to grab an entire directory and copy it? Or will I have to iterate through the files and binary write them? Thanks BLink Brian Link in St. Paul ---------------------- "Just because we have chiseled abs and stunning features, doesn't mean that we too can't not die in a freak gasoline fight
1
1633
by: UJ | last post by:
I have a process that will automatically update programs on client computers. The thing I want to check though is when I 'install' the program, is it really just as easy as copying the file to the appropriate directory? I don't need to worry about shortcuts or registry items. TIA - Jeff.
1
2525
by: Sriram | last post by:
Hi. Following code works fine on XP, but not on W2K+SP4. When I run it on W2K, it does not give me any error, exception. I have tried setting StartInfo.ErrorDialog = True, ErrorDialogParentHandle, CreateNoWindow = False, but in vain... The xcopy is available in the path set in system environment variable of W2k box...
6
22509
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 ProcessArguments ) { string ErrorStream = ""; Process DOSProcess = new Process();
2
3252
by: Matthew Lee | last post by:
I am using a C# / ASP.NET application to fire an XCOPY job from the webserver to a UNC share. This setup works fine when copying to a local machine but refuses to work on the remote copy. The process executes correctly, but XCOPY returns "invalid drive specification", which I'm guessing actually means that the current user context (ASP.NET application) can't access the share (e.g. \\someserver\c$\mydir\) Anyway, here's where I'm at...
2
2207
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 the exact same string it is passing and past it into a Command prompt, it works perfectly. That told me it may be a permissions/impersonation issue. I am now running it as a special ServiceAccount I have created that is a Domain Admin. It...
5
2891
by: Volker Jobst | last post by:
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
1
1996
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, so its not a vista issue. Any ideas why i cannot do this xcopy from my installer, yet it works fine from console program? Process kafInstallProcess = new Process();
0
9563
marktang
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...
0
10144
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
jinu1996
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...
0
8821
agi2029
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...
1
7366
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
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();...
0
5270
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...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.