本文介绍了如何在php exec()中执行外部Windows软件命令行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了一个复制软件名称fastcopy,它提供了一个命令行来执行复制文件.命令:

I download a copy software name fastcopy, and it gives a command line to execute copy files.The command :

fastcopy.exe [/options] file1 file2 ... [/to = dest_dir]

fastcopy.exe [/options] file1 file2 ... [/to=dest_dir]

请使用空格字符('')作为 分隔符(非分号).如果文件名 请包含空格字符 用圆括号引号引起来. 例如)fastopy.exe C:\ Windows"C:\ Program 文件"/to ="D:\ Backup Folder \"

Please use space character(' ') as separator(not semicolon). If filename contains space character, please enclose with dobule quotation marks. Ex) fastopy.exe C:\Windows "C:\Program Files" /to="D:\Backup Folder\"

支持的选项如下. (请不要使用空格字符 之前和之后的"=")

Supported options are as follows. (Please don't put space characters before and behind "=")

/cmd =(noexist_only | diff | update | sync | force_copy | move |删除) ...指定操作模式. (经过 默认情况下,使用差异模式.如果删除 指定模式,然后使用"/to ="选项 不使用.)

/cmd=(noexist_only|diff|update|sync|force_copy|move|delete) ... Specify operation mode. (By default, diff mode is used. If delete mode is specified, then "/to=" option isn't used.)

因此,我执行fastcopy.exe的原始代码是:

So, my original code to execute the fastcopy.exe was:

// fastcopy the software folder
$cmd = 'D:\\fastcopy\\fastcopy.exe d:\\files.rar /to="e:\\"';
exec( $cmd,$result)

但是似乎没有用.

那么,如何执行呢?

fastcopy 网页

仅直接300kb链接到直接下载的链接

link to direct download only 300kb

非常感谢您!

推荐答案

可能是因为在不应该使用双反斜杠的情况下.单引号字符串不需要转义反斜杠,除非它是字符串中的最后一个字符.

Probably because you're using double-backslashes when you shouldn't be. Single quotes strings don't need your backslashes escaping unless it's the very last character in the string.

这篇关于如何在php exec()中执行外部Windows软件命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 15:34