flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > Windows bat save clip text to file.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 04 Jun 2022, 16:03
I create bat file
Code:
echo 1.txt|clip    


After run I get text "1.txt" in windows clipboard.

I want save this text(from clipboard) in file a.txt
How do this in bat file ?
Post 04 Jun 2022, 16:03
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1042
Location: Russia
macomics 04 Jun 2022, 16:30
There are reverse examples of working with the clipboard in powershell, but something was not found in Windows Batch. Maybe you'll have better luck.

Code:
echo 1.txt > a.txt    
Post 04 Jun 2022, 16:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 04 Jun 2022, 16:36
You want something like:
Code:
paste > a.txt    
You can write your own small paste.asm app to simulate CTRL-V, or perhaps someone has already written it in C?
Post 04 Jun 2022, 16:36
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1042
Location: Russia
macomics 04 Jun 2022, 16:39
Code:
 echo 1.txt | clip
powershell "[Windows.Clipboard]::GetText()" > a.txt    
Post 04 Jun 2022, 16:39
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 04 Jun 2022, 19:11
Write error in my file:

Unable to find type [Windows.Clipboard].
At line:1 char:1
+ [Windows.Clipboard]::GetText()

+ CategoryInfo : InvalidOperation: (Windows.Clipboard:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound


Last edited by Roman on 04 Jun 2022, 23:44; edited 1 time in total
Post 04 Jun 2022, 19:11
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 04 Jun 2022, 19:12
Fine work this
Code:
echo 1.txt|clip
powershell gcb >>1.txt    
Post 04 Jun 2022, 19:12
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.