Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
Hi friends,
In my Project ,I used Batch files.I know how to move Files from One folder to another folder with using Batch files.
This is my Code:
l_oTemp = l_oTemp + Environment.NewLine + "move " + '"' + InputFrom + "\\" +   "*.txt" + '"' + " \"" + OutputTo + "\"" ;

i get the result.But My question is
How to move Rename file to designation folder at Runtime?

For example :
Input path : D:\Software\naraayanan.txt
Out Path :Input path : D:\Software1\naraayanan1.txt at runtime .

Note : I am using batch File .Please how to solve this Problem?

Regards,
Lakshmi Narayanan.S
Posted
Updated 10-Jun-11 19:57pm
v2
Comments
Sergey Alexandrovich Kryukov 11-Jun-11 20:20pm    
Have my big fat 1 for confusing mention of C#. Why would you do that? Another reason: too lazy too look at help or Google...
--SA

Open a Windows command prompt and type in Move /? to get the help for the command.

C:\Documents and Settings\XXXX\desktop>move /?
Moves files and renames files and directories.

To move one or more files:
MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination

To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

  [drive:][path]filename1 Specifies the location and name of the file
                          or files you want to move.
  destination             Specifies the new location of the file. Destination
                          can consist of a drive letter and colon, a
                          directory name, or a combination. If you are moving
                          only one file, you can also include a filename if
                          you want to rename the file when you move it.
  [drive:][path]dirname1  Specifies the directory you want to rename.
  dirname2                Specifies the new name of the directory.

  /Y                      Suppresses prompting to confirm you want to
                          overwrite an existing destination file.
  /-Y                     Causes prompting to confirm you want to overwrite
                          an existing destination file.

The switch /Y may be present in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.  Default is
to prompt on overwrites unless MOVE command is being executed from
within a batch script.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 11-Jun-11 20:16pm    
That's all anyone need.
--SA
naraayanan 21-Jun-11 2:48am    
Hi friends,
Thanks for your posting .
Regards,
Lakshmi Narayanan.S
 
Share this answer
 
Comments
naraayanan 11-Jun-11 2:20am    
Thanks for respond .but i want in Batch file .
Sergey Alexandrovich Kryukov 11-Jun-11 20:18pm    
Why did you create this problem? You did it yourself. Read your own title: "Move File via Batch File in C#.net" (what that supposed to mean?!), the tag C#3.0. Very nice...
--SA
Kim Togo 12-Jun-11 10:20am    
Do you mean a .BAT file ?
If this is true, you have to do a Process.Start with CMD.EXE and as an argument put in the .BAT file.
naraayanan 21-Jun-11 2:48am    
Hi friends,
Thanks for your posting .
Regards,
Lakshmi Narayanan.S

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900