本帖最后由 pcl_test 于 2017-4-8 05:03 编辑
vbs 如何把命令结果作为变量的值-
- 想把这句获取前一天日期的值取代下面的"strCopy=的值"
- 'wscript.echo dateadd("d",-1,date)
-
- Dim strCopy
- strCopy="此处为你要输入的文本"
- Call SetClipboardText(strCopy)
- Sub SetClipboardText(Text) '写入信息到剪切板
- Dim wsh
- Set wsh = CreateObject("WScript.Shell")
- wsh.Run "mshta vbscript:ClipboardData.SetData("&chr(34)&"text"&chr(34)&"," &Chr(34)& Text &Chr(34)& ")(close)",0,True
- set wsh=Nothing
- End Sub
-
- '下面的是我依葫芦画瓢,虽能完成粘贴动作,但不知有否欠缺,是否应有什么退出语句.望指点.
- dim wshshell
- set wshshell=createobject("wscript.shell")
- wshshell.Sendkeys("^v")
复制代码
|