Questions tagged [prompt]

prompt is a command-line or graphical interface which presents the user with a line editor or modal dialog and suspends execution until input is returned

Filter by
Sorted by
Tagged with
1180 votes
8 answers
1.9m views

List all environment variables from the command line

Is it possible to list all environment variables from a Windows' command prompt? Something equivalent to PowerShell's gci env: (or ls env: or dir env:).
Nicola Cossu's user avatar
  • 55.5k
774 votes
17 answers
1.4m views

Run Command Prompt Commands

Is there any way to run command prompt commands from within a C# application? If so how would I do the following: copy /b Image1.jpg + Archive.rar Image2.jpg This basically embeds an RAR file ...
NateShoffner's user avatar
  • 16.7k
514 votes
14 answers
1.5m views

In Windows cmd, how do I prompt for user input and use the result in another command?

I have a Windows .bat file which I would like to accept user input and then use the results of that input as part of the call to additional commands. For example, I'd like to accept a process ID from ...
user avatar
237 votes
12 answers
343k views

How can I change the color of my prompt in zsh (different from normal text)?

To recognize better the start and the end of output on a commandline, I want to change the color of my prompt, so that it is visibly different from the programs output. As I use zsh, can anyone give ...
Mnementh's user avatar
  • 51k
188 votes
2 answers
81k views

Read password from stdin [duplicate]

Scenario: An interactive CLI Python program, that is in need for a password. That means also, there's no GUI solution possible. In bash I could get a password read in without re-prompting it on ...
Boldewyn's user avatar
  • 82.1k
169 votes
6 answers
248k views

Have bash script answer interactive prompts [duplicate]

Is it possible to have a bash script automatically handle prompts that would normally be presented to the user with default actions? Currently I am using a bash script to call an in-house tool that ...
TJ L's user avatar
  • 24.2k
152 votes
7 answers
65k views

What is the difference between PS1 and PROMPT_COMMAND?

While taking a look at this awesome thread I noticed that some examples use PS1="Blah Blah Blah" and some use PROMPT_COMMAND="Blah Blah Blah" (and some use both) when setting the ...
Jed Daniels's user avatar
  • 24.9k
152 votes
4 answers
79k views

Why doesn't "total" from ls -l add up to total file sizes listed? [closed]

Why is the total in the output of ls -l printed as 64 and not 26078 which is the total of all files listed? $ ls -l ~/test/ls total 64 -rw-r--r-- 1 root root 15276 Oct 5 2004 a2ps....
Sanket Sahu's user avatar
  • 8,518
141 votes
11 answers
255k views

Prompt Dialog in Windows Forms

I am using System.Windows.Forms but strangely enough don't have the ability to create them. How can I get something like a javascript prompt dialog, without javascript? MessageBox is nice, but there ...
user420667's user avatar
  • 6,632
137 votes
5 answers
293k views

OpenAI API error 429: "You exceeded your current quota, please check your plan and billing details" [closed]

I'm making a Python script to use OpenAI via its API. However, I'm getting this error: openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details My ...
Unix's user avatar
  • 2,210
124 votes
9 answers
24k views

Different bash prompt for different vi editing mode?

When using vi mode (set -o vi) with Bash, it would be nice to have a prompt that depends on the mode you are currently in (insert or command). How does one find out this editing mode? B.t.w, this ...
user avatar
109 votes
16 answers
124k views

ZSH: Hide computer name in terminal

How would I hide the computer name in the prompt while using the terminal? At the moment it shows both username and computer name like so: It would save some space by removing anwarchoukah@anwars-...
achoukah's user avatar
  • 1,385
97 votes
17 answers
105k views

Detecting Unsaved Changes

I have a requirement to implement an "Unsaved Changes" prompt in an ASP .Net application. If a user modifies controls on a web form, and attempts to navigate away before saving, a prompt should ...
tbreffni's user avatar
  • 5,112
96 votes
10 answers
44k views

Bash prompt with the last exit code

I've been trying to customize my Bash prompt so that it will look like [feralin@localhost ~]$ _ with colors. I managed to get constant colors (the same colors every time I see the prompt), but I want ...
feralin's user avatar
  • 3,348
94 votes
9 answers
99k views

To get a prompt which indicates Git-branch in Zsh

I run the following codes separately as my prompt unsuccessfully in .zshrc. This suggests me that apparently I do not have a program called __git_ps1. It is not in MacPorts. #1 PROMPT="$(__git_ps1 " ...
Léo Léopold Hertz 준영's user avatar
92 votes
4 answers
136k views

WPF: Create a dialog / prompt

I need to create a Dialog / Prompt including TextBox for user input. My problem is, how to get the text after having confirmed the dialog? Usually I would make a class for this which would save the ...
me.at.coding's user avatar
  • 16.4k
72 votes
4 answers
25k views

Don't make me manually abort a LaTeX compile when there's an error

As suggested here, latexmk is a handy way to continually compile your document whenever the source changes. But often when you're working on a document you'll end up with errors and then latex will ...
dreeves's user avatar
  • 26.7k
69 votes
14 answers
15k views

How can the last command's wall time be put in the Bash prompt?

Is there a way to embed the last command's elapsed wall time in a Bash prompt? I'm hoping for something that would look like this: [last: 0s][/my/dir]$ sleep 10 [last: 10s][/my/dir]$ Background I ...
Mr Fooz's user avatar
  • 110k
69 votes
8 answers
102k views

How do I change the command-line prompt in Windows?

How do I change the command-line prompt into a console? I've been looking in the console functions API, but I could not find anything for it.
user avatar
55 votes
6 answers
127k views

Javascript prompt() - cancel button to terminate the function

I'm calling a Javascript window.prompt() and prompting the user to submit a variable which I compare to another variable (a very basic password protection). The function works great, however, if you ...
Justin Ward's user avatar
51 votes
8 answers
325k views

Anaconda / Python: Change Anaconda Prompt User Path

I want to change my Anaconda Prompt User file path. Currently it is as follows: I want it to change to: C:\Users\u354590 How do I do this? The current version of anaconda I have is: Python 3.6.3 ...
PineNuts0's user avatar
  • 5,104
49 votes
4 answers
45k views

Python/python3 executes in Command Prompt, but does not run correctly

I've solved the issue and am posting to save others from my hours of pain. Problem On Windows 10, Python is installed in C:\Python and added to Environment Variables, but will not properly run ...
Spencer DaCoder's user avatar
48 votes
4 answers
27k views

How can I prompt for yes/no style confirmation in a zsh script?

Using zsh, I'm trying to put a step in my ~/.zprofile where I interactively ask a yes/no style question. At first I tried this bash-style approach, but I saw errors of this form: read: -p: no ...
Andrew Ferrier's user avatar
45 votes
5 answers
485k views

Command to run a .bat file

I'm trying to make my Visual Studio build script execute a .bat file that does something important. Here is what I'm want to do right now: cd "F:\- Big Packets -\kitterengine\Common\" Template.bat ...
BingBang32's user avatar
44 votes
6 answers
17k views

zsh: update prompt with current time when a command is started

I have a zsh prompt I rather like: it evaluates the current time in precmd and displays that on the right side of the prompt: [Floatie:~] ^_^ cbowns% [9:28:31 on 2012-10-29] ...
cbowns's user avatar
  • 6,355
44 votes
4 answers
130k views

Is there any way to create prompt with two input fields?

Is there any way to create prompt in JavaScript with two input fields ? I tried that code, but it didn't help me : var a = prompt("A : ", ""); var b = prompt("B : ", ""); alert(a + "\n" + b);
TN888's user avatar
  • 7,723
41 votes
9 answers
32k views

Shell Prompt Line Wrapping Issue

I've done something to break my Bash Shell Prompt in OS X (10.5.7) Terminal. This is the PS1 that I had configured: PS1='\[\e[1;32m\]\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ ' As far as I can tell I ...
Rob's user avatar
  • 3,736
37 votes
4 answers
3k views

Randomly change the prompt in the Python interpreter

It's kind of boring to always see the >>> prompt in Python. What would be the best way to go about randomly changing the prompt prefix? I imagine an interaction like: This is a tobbaconist!...
mircealungu's user avatar
  • 6,911
36 votes
4 answers
24k views

How can I shorten the path of a DOS prompt?

My path on my DOS prompt is ridiculously long. How can I shorten this? C:\RUBY\Ruby_Practice\prep-work-master\coding-test-2\practice-problems\spec>
jingyang81's user avatar
35 votes
3 answers
66k views

Suppress the passphrase prompt in GPG command

Edited Version I have a question about GPG, but I write all of the process, maybe it will help someone. I want to: Suppress the passphrase prompt in GPG command. I don't want to: use -c option (--...
Malus Jan's user avatar
  • 2,028
34 votes
5 answers
128k views

how to show current directory in ipython prompt

Is there is way to show the current directory in IPython prompt? Instead of this: In [1]: Something like this: In<~/user/src/proj1>[1]:
motam79's user avatar
  • 3,714
32 votes
2 answers
17k views

How to insert an environment variable inside the bash prompt

I can set an environment variable inside the bash prompt like this: export PS1="[\u@\H/$FOO \W]\$ " The prompt does not change when I change the environment variable: $FOO because the $FOO variable ...
Bernd's user avatar
  • 1,241
31 votes
4 answers
13k views

Where exactly Git Bash for Windows' prompt is defined?

Both my office and home computers have Git Bash for Windows from the very same source (Git for Windows, that came with TortoiseGit), but Git Bash's prompt differs on both machines: on office computer ...
trejder's user avatar
  • 17.3k
30 votes
6 answers
232k views

CMD command to check connected USB devices

I would like to obtain by a command prompt a list of all USB devices connected to my computer (O.S. Windows 10). I've googled to find such a command, but all results seems useless to me or worse ...
Luca's user avatar
  • 303
29 votes
3 answers
14k views

JavaScript dialogs alert(), confirm() and prompt() in cross origin iframe does not work any longer

Apps script web app works in <iframe>. It seems Chrome is no longer supporting alert(), confirm(), Promote these functions on the web app. Any workaround to this? Chrome Version 92.0.4515.107 (...
JFtyv_85StvsDpDn's user avatar
26 votes
3 answers
48k views

How can I make an expect script prompt for a password?

I have an expect script that connects to a few routers through ssh. All these routers have the same password (I know, it's wrong), and the script needs to know that password in order to be able to ...
MiniQuark's user avatar
  • 47.6k
26 votes
6 answers
19k views

Color for the PROMPT (just the PROMPT proper) in cmd.exe and PowerShell?

So in Bash you just configure PS1 to add colors to your prompt. I'm talking about the prompt proper, not the color of the foreground (text) or the background. And it's really easy in Bash and it helps ...
Lumi's user avatar
  • 15k
25 votes
16 answers
119k views

SweetAlert prompt with two input fields

Currently working on a personal project. I want the user to click a button and a SweetAlert prompt would be presented for the user to verify their credential. However, the code I see on the SweetAlert ...
ballerz's user avatar
  • 477
23 votes
1 answer
29k views

javascript prompt - adding variable in default text

For javascript prompt: prompt("Message", "default value in the text field"); is it possible to add a variable into the default value? For example: var default = 'default value'; prompt("Message", ...
user avatar
23 votes
6 answers
25k views

How to print current bash prompt?

The question is simple. I want to evaluate current value of PS1 in my bash script. All materials on google point to tutorials on pimping it up, but I want to evaluate to see how would it be rendered ...
Piotr Zierhoffer's user avatar
22 votes
5 answers
24k views

kill iOS Simulator from terminal

I'm trying to terminate the iOS Simulator from the terminal console (needed for integrating automatic UI Testing in Jenkins),but every time I try the command: killall SimulatorBridge a prompt ...
Claus's user avatar
  • 5,692
22 votes
3 answers
11k views

Constantly updated clock in zsh prompt?

I know that I can exec a date command in my zsh prompt. However, it shows the old time; to see the current time, I have to hit <return> and get a new prompt with the current time. Is there a ...
anon's user avatar
  • 41.8k
21 votes
5 answers
8k views

Code challenge: Bash prompt path shortener

I implemented a prompt path shortener for bash to be included in the PS1 environment variable, which shortens the working directory into something more compact but still descriptive. I'm curious what ...
20 votes
4 answers
28k views

ChatGPT Token Limit

I want ChatGPT to remember past conversations and have a consistent (stateful) conversation. I have seen several code of ChatGPT prompt engineering. There were two ways to design the prompt shown ...
Joohyun Lee's user avatar
20 votes
3 answers
54k views

JavaScript - multi-line textbox in prompt()?

Is there anyway to make the textbox/input box in prompt multiline?
kazinix's user avatar
  • 29.7k
20 votes
1 answer
54k views

Search for a string in command line output

I want to search for the string "virtual" in "system model" attribute of 'sysinfo' command. The command should be successful if 'virtual' is found in the 'system model: -------------------------' i.e. ...
Ramesh's user avatar
  • 509
19 votes
6 answers
75k views

Oh-my-posh themes not working correctly with Powerline font and ConEmu

I use PowerShell as my shell on Windows 7. I find that ConEmu is a really good terminal. Since I am not on Windows 10, I cannot use Windows Terminal but ConEmu is not bad at all. I found out about ...
Arafat Khan's user avatar
19 votes
3 answers
6k views

Configure shell to always print prompt on new line, like zsh

If a command's output does not end with a \n, the next prompt appears, awkwardly, immediately afterwards: $ echo -n hai hai$ I just noticed a colleague whose shell (zsh, for what it's worth) is ...
davidchambers's user avatar
18 votes
1 answer
5k views

zsh prompt - checking if there are any background jobs

I'm customizing my zsh prompt and have found the following to check if there are any background jobs: if [[ $(jobs | wc -l) -gt 0 ]]; then # has background job(s) number_jobs='J:${cyan}%j${...
Chauncey Garrett's user avatar
17 votes
6 answers
22k views

Python: Using getpass with argparse

I've had a look around, but couldn't find anything. Basically I was wondering if it was possible to use getpass.getpass() with argparse. At the moment I have the following as a work around, I was ...
MHibbin's user avatar
  • 1,155

1
2 3 4 5
48