dotws86260
2018-06-06 11:50
浏览 133
已采纳

xcopy通过映射的网络驱动器utf-8文件名。 RET = 4

I'm trying to use xcopy command to copy a file with utf-8 file name from windows server(2008 R2 Standard) machine to another remote server(Windows 10), and I use MapNetworkDrive command to map the network drive.

try{
$WshNetwork = new COM("WScript.Network"); 
$WshNetwork->MapNetworkDrive("k:", SERVER_FOLDER, FALSE, SERVER_USER, SERVER_PASSWORD);
}catch(Exception $ex){}


echo f | xcopy "myFolder\тест.fbx" "k:\myFolder\тест.fbx"   (1)

As an output I get out=0 File(s) copied ret=4.

There are 3 important things I want to mention

  1. When I use the above command with a file named with latin letters it works. For example echo f | xcopy "myFolder\test.fbx" "k:\myFolder\test.fbx" works fine.

  2. When I try to use (1) command to copy the file(with non-latin letters) to another folder located on the same machine, everything successes. For example echo f | xcopy "C:\\myFolder\тест.fbx" "C:\\myFolder\subFolder\тест.fbx" this command also works fine.

  3. When I try to copy via (1) the file from my local machine(windows 10) to the remote server(windows 10), it also works fine.

Why (1) command doesn't do the copy operation?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试使用 xcopy 命令复制带有utf-8文件的文件 从Windows服务器(2008 R2标准)机器到另一台远程服务器(Windows 10)的名称,我使用 MapNetworkDrive 命令映射网络驱动器。

 尝试{
 $ WshNetwork = new COM(“WScript.Network”);  
 $ WshNetwork-> MapNetworkDrive(“k:”,SERVER_FOLDER,FALSE,SERVER_USER,SERVER_PASSWORD); 
} catch(Exception $ ex){} 
 
 
echo f |  xcopy“myFolder \тест.fbx”“k:\ myFolder \тест.fbx”(1)
   
 
 

作为输出我得到 out = 0文件 (s)复制ret = 4

我想提及3件重要事项

  1. 当我使用上面的命令和一个以拉丁字母命名的文件时,它可以工作。 例如 echo f | xcopy“myFolder \ test.fbx”“k:\ myFolder \ test.fbx”工作正常。

  2. 当我尝试使用时( 1)命令将文件(带有非拉丁字母)复制到位于同一台机器上的另一个文件夹,一切都成功。 例如 echo f | xcopy“C:\\ myFolder \тест.fbx”“C:\\ myFolder \ subFolder \тест.fbx” 这个命令也可以正常工作。

  3. < p>当我尝试通过(1)将文件从本地计算机(Windows 10)复制到远程服务器(Windows 10)时,它也可以正常工作。

    为什么(1)命令不执行复制操作?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanliu6083 2018-07-04 15:56
    已采纳

    The problem in my case was php version, I was using php 7.0, which doesn't work with unicode charactes. I don't know are there any other solutions, for earlier versions, but I've upgraded my php to 7.2 and problem was solved. Also I've found in other questions, that the problem disappears with php 7.1 and upper versions.

    点赞 打赏 评论

相关推荐 更多相似问题