-1

i have code when i click the left mouse and move the mouse it will show me white thing i dont know how to explain that just try what i explain and you will see it

second problem is when i have copied text and click the right mouse into the batch file it will paste the text what i have copied

this is the code

@echo off
set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -AsSecureString ; ^
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set password=%%p
echo %password%
pause
user3511783
  • 1
  • 1
  • 3
  • I can say that the code you post works correctly in a .bat file. And I can say that I really don't understand what you are asking for. – CB. Apr 09 '14 at 11:56
  • i know it working but the code had 2 problems 1- try to keep click the left mouse (in cmd) and move the mouse to anywhere (in cmd) you will see white thing 2- when you copied text and click the right mouse into the cmd it will paste the text what you have copied >> can any one fix these problems ? – user3511783 Apr 09 '14 at 12:05
  • This is the third post now for the same thing. I think what you're trying to say is that you can see the password if you highlight it? Use the code MC ND gave you, it's the best one. – Matt Williamson Apr 09 '14 at 12:09
  • ((Matt Williamson)) can you edit this code ? – user3511783 Apr 09 '14 at 12:12
  • Are you talking about the highlighting unmasking the password? Or the general use of the `CMD` screen? – Matt Williamson Apr 09 '14 at 12:14
  • i search for replace password with * and i dont see fast code to write letter, i saw this code and i like it because it fast but have some problems and i need someone to fix this problems – user3511783 Apr 09 '14 at 12:16
  • You have to do @Matt Williamson for me to get a notification that you left a comment here. I can't replicate what you're talking about. The code works just fine for me and others. Like I said, use MC ND's code that he posted earlier. It's faster and is pure batch with no reliance on powershell. – Matt Williamson Apr 09 '14 at 12:17
  • idont know what is "MC ND's" – user3511783 Apr 09 '14 at 12:19
  • "MC ND's" is this: http://stackoverflow.com/a/22959721/520612 – CB. Apr 09 '14 at 12:20
  • i try it ,it is slow not like this code is very fast – user3511783 Apr 09 '14 at 12:21
  • possible duplicate of [batch file to replace the input with \* without external file](http://stackoverflow.com/questions/22957682/batch-file-to-replace-the-input-with-without-external-file) – CB. Apr 09 '14 at 12:30
  • 2
    In my testing that code is very fast. Either way, this can't be updated to what you want. That is the behavior of the environment. – Matt Williamson Apr 09 '14 at 12:32
  • i know it is duplicate because the first post for me someone give my this code but i add comment to his code but he did not answer my for the edit – user3511783 Apr 09 '14 at 12:40

1 Answers1

1

I think this is a question about the Powershell terminal - not the code.

If the "white thing" when you "click the left mouse and move" is this:

Highlighting

that's just how highlighting works within a Powershell terminal window.

For the second question, clicking "right click" on a mouse within a Powershell terminal is equivalent to copy/paste. Highlighting text and right clicking will copy to the clipboard, and right clicking alone will paste what is on the clipboard to the command line.

Kohlbrr
  • 3,661
  • 1
  • 20
  • 24