Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 如何制作将文件移动到网络驱动器的批处理脚本_Batch File - Fatal编程技术网

Batch file 如何制作将文件移动到网络驱动器的批处理脚本

Batch file 如何制作将文件移动到网络驱动器的批处理脚本,batch-file,Batch File,我已经编写了一个脚本,可以将文件从本地计算机上的文件夹移动到网络驱动器,但我似乎无法让它工作 move c:\Sourcefoldernam\*.* \\homeserver\e 我是否缺少文件移动到网络驱动器的内容?可能缺少反斜杠 试一试 移动c:\Sourcefoldername\*.\\homeserver\e 以下是我们如何在我的工作中为我们的网络位置做到这一点 REM Do a net use command just to see what's mapped net use

我已经编写了一个脚本,可以将文件从本地计算机上的文件夹移动到网络驱动器,但我似乎无法让它工作

move c:\Sourcefoldernam\*.* \\homeserver\e 

我是否缺少文件移动到网络驱动器的内容?

可能缺少反斜杠

试一试

移动c:\Sourcefoldername\*.\\homeserver\e


以下是我们如何在我的工作中为我们的网络位置做到这一点

REM Do a net use command just to see what's mapped
net use



REM Delete all network connections before we start
net use * /del /yes




REM Do another net use to make sure the connections are gone
net use

REM Map network connections to use in the script
net use S: \\folder\dir password /USER:user /persistent:no
net use T: \\folder\dir /persistent:no

REM Run the net use command to make sure everything is mapped correctly
net use

REM set the sourcedir variable to point to the directory you want to send it to
set sourcedir=S:

REM set the destdir variable to point to the mapped directory
set destdir=T:\folder\sub-folder\directory

move %sourcedir%\W* %destdir%\


REM Clean up by deleting all network connections before ending
net use * /del /yes

REM Run the net use command to make sure everything is disconnected
net use

你需要把整个路径,用*就足够了

move [source folder] [destination folder]

move C:\sourcefolder\* Y:\sourceDestination

你的意思是移动c:\Sourcefoldername**\\homeserver\eyes,我以为我输入了“\\”,奇怪。。我想知道反斜杠是否是此处的转义字符。如果Sourcefoldername后面缺少斜杠,请尝试此移动c:\Sourcefoldername*\\homeserver\e移动c:\sourcefolder*Y:\sourceDestination命令无效。Jakepens71我尝试了你的选择,但似乎无法通过设置sourcedir和destdir。我现在正在CMD中运行这一切,以确保在将其放入.bat文件之前它能正常工作。我确实设置了sourcedir=C:\completed,然后设置了destdir=E:\。。。然后我移动了%sourcedir%\%destdir%\此时它表示系统找不到指定的文件@JakePens71我相信你不需要在那里的车道上写字母。只需移动%sourcedir%\W*%destdir%\