从 Windows 7 中的 php 命令行脚本复制到剪贴板 [英] Copy to clipboard from php command line script in Windows 7

查看:32
本文介绍了从 Windows 7 中的 php 命令行脚本复制到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 php (5.5) 脚本,我在 Windows 7 中从命令行运行它.像这样:

I have a php (5.5) script which I run from the command line in Windows 7. Something like this:

C:\php-5.5.5\php.exe C:\scripts\putString.php

我的问题是,是否可以从脚本中将某些内容复制到 Windows 剪贴板?我希望用户在从命令行运行此脚本后在剪贴板中有一些可用的文本.怎么办?

My question is, is it possible to copy something to windows clipboard from the script? I want users to have some text available in the clipboard after running this script from the command line. How can it be done?

推荐答案

如果你想添加一些中间结果到剪贴板,而不是整个脚本的输出

If you want to add some intermediate result to the clipboard, instead of the output of the entire script

//...your script...
$someVar="value";
shell_exec("echo " . escapeshellarg($someVar) . " | clip");
//rest of script...

这篇关于从 Windows 7 中的 php 命令行脚本复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆