Author Topic: Question about command prompt and $CONSOLE  (Read 2742 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Question about command prompt and $CONSOLE
« on: September 03, 2021, 01:53:13 pm »
I found a way to pass my ftp username and password automatically through cURL, and connect with my server, but before that, I was dealing with a password prompt at the command line, which seemed like a minor issue, until I noticed I was not able to type to the console! I tried it in a straight command prompt window, too, with no shell call, and again, no way to type it into the command prompt, either. Both the QB64 generated console and the command prompt would accept the Enter key and the usual ctrl + c to break the connection, but no typed characters would appear above the input cursor. Even though I won't be needing this "enter password" method anymore, I'm still curious if there was something I missed that would have allowed me to type or paste the password to the screen.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Question about command prompt and $CONSOLE
« Reply #1 on: September 03, 2021, 01:56:47 pm »
_DEST _CONSOLE and _SOURCE _CONSOLE
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Question about command prompt and $CONSOLE
« Reply #2 on: September 03, 2021, 02:31:12 pm »
Well, that works as in the wiki for input:

Code: QB64: [Select]
  1. _CONSOLE OFF 'close original console
  2. _CONSOLE ON 'place console above program window
  3.  
  4. INPUT "Enter your name: ", nme$ 'get program input
  5. _CONSOLE OFF 'close console
  6.  
  7. _DEST 0 'destination program window
  8. PRINT nme$
  9. END  
  10.  

But if you replace the INPUT statement with...

SHELL "wget --user=myurl --ask-password ftp://myurl@www.myurl.com"

The program prompts for a password, but won't allow typed characters. When you press Enter, it advances, but naturally returns an error 530, password incorrect.

Besides, the same thing happens with just using the command prompt as an administrator. The password prompt appears in the command prompt window, but won't accept typed characters, just ctrl + c to break or Enter.

Weird...

Pete

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Question about command prompt and $CONSOLE
« Reply #3 on: September 04, 2021, 09:16:36 am »
Pete, what's wrong with this ?
Code: QB64: [Select]
  1. Input "Enter your name: ", nme$ 'get program input
  2. Print nme$
  3.  

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Question about command prompt and $CONSOLE
« Reply #4 on: September 04, 2021, 11:18:59 am »
HI JACK! - Hey, let me go!... Argh, that's the last time I switch on mobile speech to text while flying commercial. Anyway...

Check the thread again, and you'll see I mentioned nothing is wrong with typing when using the INPUT statement, but when I use SHELL and get prompted for my password, the console refuses to accept typed characters. Enter works and ctrl + c (for break) are accepted, but absolutely nothing shows when typing characters.

Example:

Code: QB64: [Select]
  1. out$ = "c:\wget\wget --user=mywebsite --ask-password ftp://mywebsite@www.mywebsite.com"
  2.  
 

It's the same with cURL, so it's not just wget, and it's the same problem if I input...

c:\wget\wget --user=mywebsite --ask-password ftp://mywebsite@www.mywebsite.com

...directly into the command window, running as administrator.

Thankfully, I found the correct syntax to automatically connect with my user name and password, and I did successfully upload a file. So while I don't need a solution for this situation, I'm still curious as to why a password prompt that shows: password for user 'mysite.com': _ won't accept typed characters to the input line.

Anyone who has wget, just change the path to wget in the code, and give it a try.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/