批處理將字串輸出到Windows剪貼簿

來源:互聯網
上載者:User

標籤:details   參數   fork   blank   repo   lin   其他   assets   class   

 批處理將字串輸出到Windows剪貼簿2016-06-30 23:29 339人閱讀 評論(0) 收藏 舉報

著作權聲明:N3verL4nd 出處:http://blog.csdn.net/x_iya

藉助於clip.exe(C:\Windows\System32\clip.exe)

 

[cpp] view plain copy  
  1. C:\Windows\System32>clip /?  
  2.   
  3. CLIP  
  4.   
  5. 描述:  
  6.     將命令列工具的輸出重新導向到 Windows 剪貼簿。這個文本輸出可以被粘貼  
  7.     到其他程式中。  
  8.   
  9. 參數列表:  
  10.     /?                  顯示此協助訊息。  
  11.   
  12. 樣本:  
  13.     DIR | CLIP          將一份目前的目錄列表的副本放入 Windows 剪貼簿。  
  14.   
  15.     CLIP < README.TXT   將 readme.txt 的一份文本放入 Windows 剪貼簿。  
  16.   
  17. C:\Windows\System32>  


 

方法一:

 

[cpp] view plain copy  
  1. echo I am a student |clip  
此時字串多一個斷行符號換行

 

 

方法二:

 

[cpp] view plain copy  
  1. set/p="I am a student"<nul | clip  

例如將當前日期存放在剪貼簿:

 

 

[cpp] view plain copy  
  1. set/p="%date%"<nul | clip  

 

 

方法三:(vbs)

 

[cpp] view plain copy  
  1. mshta vbscript:clipboarddata.setdata("text","I am a student")(close)

批處理將字串輸出到Windows剪貼簿

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.