473,538 Members | 16,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xcopy using System.Diagnostics.Process doesnt work on W2k with SP4

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...

Dim objProcess As New Process
Try
Me.Cursor = Cursors.WaitCursor
objProcess.StartInfo.FileName = "xcopy.exe"
objProcess.StartInfo.Arguments = QUOTE & TEMPLATEFOLDER &
QUOTE & " " & QUOTE & m_strQuotePath & QUOTE & " /e /c /q /g /h /r /y /i"
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.StartInfo.CreateNoWindow = False
objProcess.StartInfo.ErrorDialog = True
objProcess.StartInfo.ErrorDialogParentHandle = Me.Handle
objProcess.Start()
objProcess.WaitForExit()
blnPhysicalFolderCreated = True
'2. Create an entry in the database for the new quote
objBO.CreateQuote(m_strQuote, Environment.UserName,
txtJob.Text.Trim)
Catch ex As Exception
If (blnPhysicalFolderCreated) Then 'Exception occured,
remove the folder from network drive
Directory.Delete(m_strQuotePath, True)
End If
MsgBox("exception:" & ex.StackTrace)
Throw ex
Finally
objProcess.Close()
Me.Cursor = Cursors.Default
End Try

Any ideas are greatly appreciated.

TIA
Sriram.
rsriram22 at hotmail

Nov 23 '05 #1
1 1195
I think I found out the problem - It was with "/g" option. This is not
supported in W2K's XCopy.

Yet, I think an error saying the same could have been shown ..

"Sriram" wrote:
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...

Dim objProcess As New Process
Try
Me.Cursor = Cursors.WaitCursor
objProcess.StartInfo.FileName = "xcopy.exe"
objProcess.StartInfo.Arguments = QUOTE & TEMPLATEFOLDER &
QUOTE & " " & QUOTE & m_strQuotePath & QUOTE & " /e /c /q /g /h /r /y /i"
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.StartInfo.CreateNoWindow = False
objProcess.StartInfo.ErrorDialog = True
objProcess.StartInfo.ErrorDialogParentHandle = Me.Handle
objProcess.Start()
objProcess.WaitForExit()
blnPhysicalFolderCreated = True
'2. Create an entry in the database for the new quote
objBO.CreateQuote(m_strQuote, Environment.UserName,
txtJob.Text.Trim)
Catch ex As Exception
If (blnPhysicalFolderCreated) Then 'Exception occured,
remove the folder from network drive
Directory.Delete(m_strQuotePath, True)
End If
MsgBox("exception:" & ex.StackTrace)
Throw ex
Finally
objProcess.Close()
Me.Cursor = Cursors.Default
End Try

Any ideas are greatly appreciated.

TIA
Sriram.
rsriram22 at hotmail

Nov 23 '05 #2

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

Similar topics

0
8346
by: grutta | last post by:
I am writing a windows service that will recieve notification when a USB Device is insterted into the machine. I have used the RegisterDeviceNotification and the RegisterServiceCtrlHandlerEx with a handler. The handler portion seems to fail indicating that my parameters are invalid. I am getting an error code 126 when i try to register the...
2
6443
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
2473
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...
3
6894
by: vbMark | last post by:
Here is my C# code in the ASP.NET page. public static void DoConvert ( string sFile ) { string cmd = "foo.exe" ; string param = " /bar.txt" ; Process myproc ; // <-- Error here ProcessStartInfo startInfo = new ProcessStartInfo ( cmd , param ) ; startInfo.CreateNoWindow = true ; startInfo.WindowStyle = ProcessWindowStyle.Hidden ;
2
3233
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...
2
2193
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...
5
2878
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
13
39846
by: Chris Johnson | last post by:
I have what seems to be such a simple thing yet I cannot figure out how to do it. I am using a streamwriter to build a text file. At the end of the process I want to open that same text file in notepad so the user can see what was built. I cannot for the life of me figure out how to get the text file to open up in notepad on the screen....
11
9211
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS 2005, ,.net 2 for C# windows application. I'm using Process to run a C application and redirecting its standard output so I can read it with StreamReader.ReadToEnd. It's only reading the 1st 5 lines or so when there is about 30 lines of data. I also tried using the Process.BeginOutputReadlin and a DataReceivedEvntHandler to...
5
1548
by: Bremanand | last post by:
Hi my asp.net web application having one button which has the following code in its click event to open an .exe.... System.Diagnostics.Process pro = new System.Diagnostics.Process(); pro.StartInfo.WorkingDirectory = "./"; pro.StartInfo.FileName = "windraw1.1.exe"; pro.Start(); its is working fine if it is file system project. But in http...
0
7537
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. ...
1
7291
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5832
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...
1
5227
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...
0
3360
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...
0
3357
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1764
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
1
934
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
596
bsmnconsultancy
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...

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.