First let me insist on the fact that I am completely new to batch coding, I have seen some code over the years and am used to using cmd, but never really delved into trying to accomplish complex tasks in a batch by myself.
So, basically I would like to copy some text to the clipboard (usernames, so will never exceed one line), then simply double clicking on a batch file to create a folder with that username and a few other tasks that aren't relevant here.
Anyway, I've got that second part down (with the username in question hardcoded in the batch), but not the clipboard to variable part.
I have read this thread : Access clipboard in Windows batch file
And especially rojo's answer which is very interesting. The solution I'm interested in is the "Update 2" one, with one line of code using Powershell:
powershell -sta "add-type -as System.Windows.Forms; [windows.forms.clipboard]::GetText()"
However, there are a few issues with me using it:
- I learned the existence of powershell reading this, so I don't really know how to decipher the code, and turning it into a variable that I could use later in other lines.
- I'm using Windows 10 so I believe powershell is on my computer, however I have no idea if using that line would be allowed in a normal batch file?
Anyway, first I want to thank rojo for his solutions, they are great and I will continue searching for a way to resolve my problem, and also thanks to anyone that would be willing to help me understand and hopefully resolve this!