Computing.Net > Forums > Programming > Batch file pasting text

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Batch file pasting text

Reply to Message Icon

Name: prestoward
Date: April 24, 2009 at 02:21:46 Pacific
OS: Windows Vista
Subcategory: Batch
Comment:

I want to make a batch file paste text into programs like a word document. Is there an easy way to do this?




Response Number 1
Name: IVO
Date: April 24, 2009 at 03:10:51 Pacific
+1
Reply:

NO



Response Number 2
Name: ghostdog
Date: April 24, 2009 at 11:21:42 Pacific
+1
Reply:

you can use SendKeys with vbscript. eg

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad c:\test\file.txt"
WScript.Sleep 100
WshShell.AppActivate "Notepad"
WScript.Sleep 100
WshShell.SendKeys "^{a}"
WScript.Sleep 500
WshShell.SendKeys "^{c}"
WScript.Sleep 500
WshShell.SendKeys "%{F4}"
WScript.Sleep 500
WshShell.Run "write c:\test\file2.txt"
WScript.Sleep 500
WshShell.AppActivate "Writer"
WScript.Sleep 500
WshShell.SendKeys "^{a}"
WScript.Sleep 500
WshShell.SendKeys "^{v}"
WScript.Sleep 500
WshShell.SendKeys "^{s}"
WScript.Sleep 500

alternatively, if you know Perl, you can use the module Win32::Clipboard where it lets you manipulate the clipboard programatically.

Unix Win32 tools | Gawk for Windows



Reply to Message Icon

Related Posts

See More


Where can i find best c++... VB6 - input file!



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Google Ads



Results for: Batch file pasting text

Batch file adding text to file also www.computing.net/answers/programming/batch-file-adding-text-to-file-also/16756.html

make batch file edit text file www.computing.net/answers/programming/make-batch-file-edit-text-file/15584.html

Batch file for text replacement www.computing.net/answers/programming/batch-file-for-text-replacement/12883.html