通过C#.net中的批处理文件移动文件 [英] Move File via Batch File in C#.net
问题描述
朋友们,
在我的项目中,我使用了批处理文件.我知道如何使用批处理文件将文件从一个文件夹移动到另一个文件夹.
这是我的代码:
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 + "\"" ;
我得到了结果.但是我的问题是
如何在运行时将重命名文件移动到指定文件夹?
例如:
输入路径:D:\ Software \ naraayanan.txt
输出路径:输入路径:运行时D:\ Software1 \ naraayanan1.txt.
注意:我正在使用批处理文件.请如何解决此问题?
问候,
Lakshmi Narayanan.S
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
推荐答案
打开Windows命令提示符,然后输入Move/?.以获得命令的帮助.
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.
签出如何:复制,删除和移动文件和文件夹(C#编程指南) [ ^ ]
这篇关于通过C#.net中的批处理文件移动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!