Hi all, I am trying to execute a batch file to copy over files from one
server to another. The batch file is using robocopy to copy over the files.
============
private void CopyFiles()
{// Use the process name space to copy over the files
System.Diagnost ics.Process oProc = new System.Diagnost ics.Process();
oProc.StartInfo .FileName ="c:\CopyFiles. bat" ;
oProc.Start();
}
============
When I run the above routine nothing gets copied and I get no error message
whatsoever.
When I manually run the batch file the copy works fine so it is not the
batch file.
Batch file is shown below..
robocopy c:\images \\remoteserver\ c$\images /e
robocopy c:\documents \\remoteserver\ c$\documents /e
I am assumming that it might be something to do with user permission
settings, ASPNET user has full rights on both the local machine as well as
the remote machine.
Any help appreciated.
Thanks in advance
Mark 5 8357
Hi Mark,
If the problem is permissions (and like you I'd suspect this also),
you won't get an exception. Instead, the process is probably
displaying an error message in the output stream.
Use the StartInfo property to setup StandardOutput and StandardError
for reading from your code:
Process p = new Process();
p.StartInfo.Use ShellExecute = false;
p.StartInfo.Red irectStandardOu tput = true;
p.RedirectStand ardError = true;
Start the process then wait for the process to finish:
p.WaitForExit() ;
Then read the streams and look at what appears. Hopefully you'll find
an access denied message with some additional information.
If you need help tracking down who is getting an access denied message
on what, enable auditing and watch the security log: http://www.pluralsight.com/keith/boo...ileaccess.html
HTH,
--
Scott http://www.OdeToCode.com
On Fri, 16 Jul 2004 15:11:36 +1200, "Mark"
<ma*******@n0Sp 8mTAIRAWHITIdot AC.NZ> wrote: Hi all, I am trying to execute a batch file to copy over files from one server to another. The batch file is using robocopy to copy over the files. ============ private void CopyFiles() {// Use the process name space to copy over the files System.Diagnos tics.Process oProc = new System.Diagnost ics.Process();
oProc.StartInf o.FileName ="c:\CopyFiles. bat" ;
oProc.Start( );
}
============ When I run the above routine nothing gets copied and I get no error message whatsoever. When I manually run the batch file the copy works fine so it is not the batch file.
Batch file is shown below..
robocopy c:\images \\remoteserver\ c$\images /e robocopy c:\documents \\remoteserver\ c$\documents /e
I am assumming that it might be something to do with user permission settings, ASPNET user has full rights on both the local machine as well as the remote machine.
Any help appreciated.
Thanks in advance Mark
Hi Scott, thanks for that. I will give it a whirl and see how I get on
Thanks again
Mark
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:8f******** *************** *********@4ax.c om... Hi Mark,
If the problem is permissions (and like you I'd suspect this also), you won't get an exception. Instead, the process is probably displaying an error message in the output stream.
Use the StartInfo property to setup StandardOutput and StandardError for reading from your code:
Process p = new Process(); p.StartInfo.Use ShellExecute = false; p.StartInfo.Red irectStandardOu tput = true; p.RedirectStand ardError = true;
Start the process then wait for the process to finish:
p.WaitForExit() ;
Then read the streams and look at what appears. Hopefully you'll find an access denied message with some additional information.
If you need help tracking down who is getting an access denied message on what, enable auditing and watch the security log:
http://www.pluralsight.com/keith/boo...ileaccess.html
HTH,
-- Scott http://www.OdeToCode.com
On Fri, 16 Jul 2004 15:11:36 +1200, "Mark" <ma*******@n0Sp 8mTAIRAWHITIdot AC.NZ> wrote:
Hi all, I am trying to execute a batch file to copy over files from one server to another. The batch file is using robocopy to copy over the
files.============ private void CopyFiles() {// Use the process name space to copy over the files System.Diagnos tics.Process oProc = new System.Diagnost ics.Process();
oProc.StartInf o.FileName ="c:\CopyFiles. bat" ;
oProc.Start( );
}
============ When I run the above routine nothing gets copied and I get no error
messagewhatsoever. When I manually run the batch file the copy works fine so it is not the batch file.
Batch file is shown below..
robocopy c:\images \\remoteserver\ c$\images /e robocopy c:\documents \\remoteserver\ c$\documents /e
I am assumming that it might be something to do with user permission settings, ASPNET user has full rights on both the local machine as well
asthe remote machine.
Any help appreciated.
Thanks in advance Mark
I was able to do this in a window form but not in an asp.net form.
Perhaps the "user" that run the asp.net doesn't have permission to run
the process?
Robert
On Fri, 16 Jul 2004 16:27:45 +1200, "Mark"
<ma*******@n0Sp 8mTAIRAWHITIdot AC.NZ> wrote: Hi Scott, thanks for that. I will give it a whirl and see how I get on
Thanks again Mark "Scott Allen" <bitmask@[nospam].fred.net> wrote in message news:8f******* *************** **********@4ax. com... Hi Mark,
If the problem is permissions (and like you I'd suspect this also), you won't get an exception. Instead, the process is probably displaying an error message in the output stream.
Use the StartInfo property to setup StandardOutput and StandardError for reading from your code:
Process p = new Process(); p.StartInfo.Use ShellExecute = false; p.StartInfo.Red irectStandardOu tput = true; p.RedirectStand ardError = true;
Start the process then wait for the process to finish:
p.WaitForExit() ;
Then read the streams and look at what appears. Hopefully you'll find an access denied message with some additional information.
If you need help tracking down who is getting an access denied message on what, enable auditing and watch the security log:
http://www.pluralsight.com/keith/boo...ileaccess.html
HTH,
-- Scott http://www.OdeToCode.com
On Fri, 16 Jul 2004 15:11:36 +1200, "Mark" <ma*******@n0Sp 8mTAIRAWHITIdot AC.NZ> wrote:
>Hi all, I am trying to execute a batch file to copy over files from one >server to another. The batch file is using robocopy to copy over thefiles. >============ >private void CopyFiles() >{// Use the process name space to copy over the files >System.Diagnos tics.Process oProc = new System.Diagnost ics.Process(); > >oProc.StartInf o.FileName ="c:\CopyFiles. bat" ; > >oProc.Start( ); > >} > >============ >When I run the above routine nothing gets copied and I get no errormessage >whatsoever. >When I manually run the batch file the copy works fine so it is not the >batch file. > >Batch file is shown below.. > > >robocopy c:\images \\remoteserver\ c$\images /e >robocopy c:\documents \\remoteserver\ c$\documents /e > >I am assumming that it might be something to do with user permission >settings, ASPNET user has full rights on both the local machine as wellas >the remote machine. > >Any help appreciated. > >Thanks in advance >Mark > > > > >
Bank of America defines chintzy IMHO.
Email for details.
Robert Megee
Hi Robert:
Nine times out of ten it is a permission issue.
--
Scott http://www.OdeToCode.com
On Wed, 28 Jul 2004 07:43:45 GMT, Dies Deambulo <rm*****@attbi. com>
wrote: I was able to do this in a window form but not in an asp.net form. Perhaps the "user" that run the asp.net doesn't have permission to run the process?
Robert
Hi Scott,
Today I made the asp.net user an administrator. Still didn't run.
I'm beginning to believe that it just won't.
I'm working on doint this with tcpclient/tcplistener instead. I was
a bit afraid of it at first but now that I dove in, it may actually be
a better way to move data.
Robert
On Wed, 28 Jul 2004 10:20:32 -0400, Scott Allen
<bitmask@[nospam].fred.net> wrote: Hi Robert:
Nine times out of ten it is a permission issue.
Bank of America defines chintzy IMHO.
Email for details.
Robert Megee This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert Tarantino |
last post by:
Hello,
I am trying to find a way to create a scheduled task or
service that will copy my local profile folders
under "Documents and settings" to a network drive. This
would allow me to restore my settings if my profile became
tampered with or corrupt. Is there any sample code
available out there?
-Robert
|
by: pooja |
last post by:
Suppose i have created a class c1 with f1()in c1.cpp
and included this c1.cpp in file1.cpp file , which is also having
main() by giving the statement #include "c1.cpp".
the same i can do by using header file. i can create a class c1 with
f1() in c1.h and include this c1.h in file1.cpp by giving the statement
#include "c1.h"
tell me that what exactly is the difference between c1.h and c1.cpp?
Since they both are doing the same things.
|
by: David |
last post by:
Hi all,
I am fairly new to C#. so go easy on me :-)
Anyhow, I have a class file that I have set up properties and a method.
I am calling this class file directly from and aspx.cs file. So far, it
works great (after having a bit of heartache about .Dispose() ).
Now, I need a certain part of the class file to run through many times and
|
by: Martin Ho |
last post by:
I am running into one really big problem.
I wrote a script in vb.net to make a copy of folders and subfolder to
another destination:
- in 'from.txt' I specify which folders to copy
- in 'to.txt' I specify where to copy it
- After I read content of 'to.txt' I create one more subfolder named
by current date and thats where everything gets to be copied
|
by: Jim Heavey |
last post by:
I have written a little application which copies files from one location to
another location.
Before it copies the file, it ensure the directory for both the from and to
locations is valid. It also ensures that the from file exists.
All that being successful, it attempts to copy the file, but each time I get
an exception in which the text of the message says "The process can not copy
the file XXXXXXXXX because it is being used by...
| |
by: Jerad Rose |
last post by:
I have a fairly simple C# console app which copies files from a network
folder to a local folder. When the app resides on my local C: drive, it
runs just fine. However, when the app resides on a network drive, copying
the same files from the same source drive and to the same destination drive,
it gives me the following exception:
System.Security.SecurityException: Request for the permission of type...
|
by: kimiraikkonen |
last post by:
Hi,
I use system.io.file class to copy files but i have a difficulty about
implementing a basic / XP-like progress bar indicator during copying
process.
My code is this with no progress bar, or i couldn't find sth which
give totalbytes/written bytes class. And does system.io.file class
provide awaring of the chunks / bytes of the files bytes which are
written?
|
by: writeson |
last post by:
Hi all,
I'm writing some code that monitors a directory for the appearance of
files from a workflow. When those files appear I write a command file
to a device that tells the device how to process the file. The
appearance of the command file triggers the device to grab the
original file. My problem is I don't want to write the command file to
the device until the original file from the workflow has been copied
completely. Since these...
|
by: raylopez99 |
last post by:
Beware newbies: I spent a day before I figured this out: copying a
bitmap (image) file to file is not quite like copying a text file--you
have to do some tricks (see below), like using a "Graphics" object to
wrap around the image (!). It's not so simple as shown in most
examples (where they have a simple image file and hard copy it into a
harddrive along the lines of : image.Save(@"C:\\temp\\myimage.pgn");
That will work, but it's a...
|
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: 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...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |