Valery Mayer
asked on
simple small DOS batch file
I would like a batch file to copy, lets say the word : magic. After I double click on the batch file on my desktop, all I need to do is CTRL V anywhere for the word "magic" to be typed out.
Anyone knows how to do this? Please assist.
Thank you !
Anyone knows how to do this? Please assist.
Thank you !
I believe all you need to do is echo magic| clip
This puts the word magic into the clipboard and you can paste it anywhere.
This way will add a new line at the end so if you don't want that then you'll need to do something like this.
echo|set /p=magic|clip
This puts the word magic into the clipboard and you can paste it anywhere.
This way will add a new line at the end so if you don't want that then you'll need to do something like this.
echo|set /p=magic|clip
ASKER
Sounds great to try out - can you please provide me with the previous steps that would insert the command into a double click shortcut on my desktop ?
THANK YOU
THANK YOU
save the following line as a text document on your desktop:
C:\>echo|set/p=magic|clip
then change the extension (right click > rename) from .txt to .bat
Then you will be able to double click
C:\>echo|set/p=magic|clip
then change the extension (right click > rename) from .txt to .bat
Then you will be able to double click
ASKER
forgot: I have Windows 10.
save
echo|set /p=magic|clip
to a text file and name it magic.bat. Just as CES IT said but don't have the C:\> in there.
echo|set /p=magic|clip
to a text file and name it magic.bat. Just as CES IT said but don't have the C:\> in there.
You should use
@set /p=magic<nul|clip
or@echo.|set /p=magic|clip
The above posted works, but is not correct. echo without anything creates some unwanted but dismissed output.
ASKER
Mmm does not work. What I did:
1- Opened Word 2016
2- Copied/pasted : C:\>echo|set/p=magic|clip
3- Saved file on desktop as: test.docx
4- Close the document and the Word software
5- Right clicked on the saved file test.docx and renamed test.bat
6- Double clicked on the renamed file (no error message or other...)
7- Created new email and pressed CTRL V in the text area and got: C:\>echo|set/p=magic|clip
Help, pls... what am I doing wrong? TY
1- Opened Word 2016
2- Copied/pasted : C:\>echo|set/p=magic|clip
3- Saved file on desktop as: test.docx
4- Close the document and the Word software
5- Right clicked on the saved file test.docx and renamed test.bat
6- Double clicked on the renamed file (no error message or other...)
7- Created new email and pressed CTRL V in the text area and got: C:\>echo|set/p=magic|clip
Help, pls... what am I doing wrong? TY
get rid of the C:\> so that the only text is :
echo|set/p=magic|clip
echo|set/p=magic|clip
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@echo.|set /p=magic|clip DOES NOT WORK either. I get @echo.|set /p=magic|clip pasted as if nothing was saved to clipboard (Mmm ??)
As Sean said, redo it using notepad. I tested myself on a Win 10 machine and this will indeed work.
I opened notepad and saved the following as a .txt file:
echo|set/p=magic|clip
I then renamed the file to have a .bat extension. Clicking the file briefly opens a cmd window which disappears. I opened another notepad and did CRTL+V and the word "magic" appears as expected
I opened notepad and saved the following as a .txt file:
echo|set/p=magic|clip
I then renamed the file to have a .bat extension. Clicking the file briefly opens a cmd window which disappears. I opened another notepad and did CRTL+V and the word "magic" appears as expected
ASKER
Used NotePad - renaming the extenton from txt to bat worked!!
Thank you all! :)
Thank you all! :)
C:\>echo|set/p=texttosave|