473,326 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Weird problem with DOS Command

153 100+
I am developign one application where i copy one file to other location using
System.Diagnostics.Process.Start

In developement the command is just running fine .
The command is

/c copy C:\app\mainstructure.mdb C:\traffic\trafficmanagement\trafficmanagement\bin \Debug

/c rename C:\traffic\trafficmanagement\trafficmanagement\bin \Debug\mainstructure.mdb 1999fine.mdb

But when i create setup package of it and run the application it can not copy and rename the file.
I had used the application.path to get a general software.

the exact command running are

/c copy C:\app\mainstructure.mdb C:\Program Files\Bell Solutions\TrafficLedger


/c rename C:\Program Files\Bell Solutions\TrafficLedger\mainstructure.mdb 2008fine.mdb

Even when i run these commands in Comamnd window it gives invalid syntax error.

I can see the file infront of me and everything is ok.

I know it's a silly question but it's realy killing me.

Please help me guys.

Thanks !
Aug 20 '08 #1
5 1125
Plater
7,872 Expert 4TB
So you are really running cmd.exe and applying those strings as arguments?
Frequently it is the case that you would need to surround the path and filenames with quotes, since they (could) have spaces in them. And be sure to end directories with a "\" otherwise how would it know you didn't want to copy the file to the name "Debug".
Which leads me to another thing, that operation can be done in one step, no need for two.

/c copy "C:\app\mainstructure.mdb" "C:\traffic\trafficmanagement\trafficmanagement\bi n\Debug\1999fine.mdb"
Aug 20 '08 #2
Curtis Rutland
3,256 Expert 2GB
But the real question is, why? Why do you need to use the shell copy command, when you have classes like FileInfo and DirectoryInfo that let you do that in managed code?
Aug 20 '08 #3
akshaycjoshi
153 100+
Thanks a zillion times Plater !

BTW insertAlias i wanted to embed one blank database to my project so that at the begining of each year i will just copy the embeded blank database and rename it to current year.SO that i have a seperate database for each year.


Guys , I cold have started a new thread but I think it's unncesary to do that so i am asking it here.

Which is the best book for SQL server , i am a beginer and wanted to learn SQL server 2006 from scratch.
Aug 20 '08 #4
Curtis Rutland
3,256 Expert 2GB
I understand what you want to do, I'm saying that you can copy and rename files from within .NET. You don't have to use shell commands. If you look up System.IO.FileInfo, there are methods for renaming, moving and copying, along with several other useful tools for file manipulation.

As to the new question, that's called hijacking threads, even if they are your own. Please start a new one. But this forum is for technical QA only, so if you do start one, start it in Misc Questions.

Thanks.
Aug 20 '08 #5
akshaycjoshi
153 100+
Ohh i am sorry I used those shell commands coz i dont know about .NET I/O.
As far as highjacking is concerned , i didn't know hat either.
Will start a new thread.

Thanks !
Aug 21 '08 #6

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

Similar topics

2
by: Me | last post by:
I'm looking for some insight to the following code. I don't understand why when I uncomment the #$command="/usr/local/apache/cgi-bin/port-reset.exp $portnumber"; and comment the ls command it does...
0
by: LRW | last post by:
I manage our mySQL database through putty (SSH terminal client). And whenever I do a select * from the table that contains ENCODEd passwords, the funky characters do funky things with the display....
2
by: jwbeaty | last post by:
Here's a weird one. I'm running SQL Server 7 and when I run a backup something weird happens. When I perform the backup via Enterprise Manager by right clicking on the database I want to...
1
by: Chris Mantoulidis | last post by:
PROBLEM: I'm having some weird problems with string::find() (in ParamGenerate()), but since I'm not sure if that is the source of all bad output in my program, I'm posting least code that's...
1
by: Jeffrey Melloy | last post by:
I recently noticed that in my web app, a \n wasn't getting converted to a <br />. (The problem turned out to be that for this particular record, it was a \r). When I checked out the record in...
4
by: bbembi_de | last post by:
Hello everyone, I have a C# program that runs a batch from the command line. I use the following code for that: String arguments = "/C CALL batchfile.bat"; ProcessStartInfo startInfo = new...
6
by: kwest | last post by:
I just setup a new server with PHP 5 and ran into a problem with includes. Everytime I call something like require_once './includes/test.inc' I get a permissions message like this: Warning:...
0
by: P Pulkkinen | last post by:
Dear all, sorry, i know this code is far little too long to debug here, but there is really annoying logical error. If someone debugs this, I really offer warm virtual handshake. What this...
0
by: mvsguy | last post by:
I'm running a script from the PC Command Center to a z/OS DB2 at v8.1.5. In mid script, the schema changes, despite my setting it explicitly at the start of the script. Does anyone know what...
5
by: Gangreen | last post by:
I'm trying to send bytes to a server, but I always get an exception at the send command saying: the socket should not be connected (line 26 in the code below). This is weird right? cause I don't...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.