I need a batch script that adds a space before the set /p command allowing the user to type but I need the user to type in the middle of the cmd window how would I do this I have tryed echo " " && set /p =
But this puts the input on the next line and I don't want the quotation marks to appear is there any way to do this even if its not pure batch thanks.
Last edited by Batcher (23 Aug 2015 11:28)
#2 23 Aug 2015 03:02
This is one way:
Code: Select all
@echo off :: Define a backspace for /f %%a in ('"prompt $H&for %%b in (1) do rem"') do set "BS=%%a" set /p "var=%bs% > " echo "%var%" pause
#3 23 Aug 2015 03:26
@Batcher, excuse me; I apologize in advance for this post...
The title "change where cursor appears" make me think of a method to: 1. Turn off the cursor, 2. Change the cursor position, and 3. Turn on the cursor again.
If you would wanted to move the cursor from current position to new x,y position, perhaps you would asked for "change cursor position".
However, it seems that you just want to know how to "add spaces before the set /p command" (that have no relation to "moving cursor"), so why you didn't used such title?
I encourage you to change the title of this topic...
PS - A simpler solution to your problem is prepare in advance a text file with the number of required spaces and NO NEW LINE AT END, and just show it with TYPE command before the SET /P:
Code: Select all
type spaces.txt & set /P "var="
#4 23 Aug 2015 11:30
Thank you foxdrive and Antonio
#5 24 Aug 2015 08:04
I don't often get involved in matters of etiquette. However...so why you didn't used such title?
People posting questions here are quite often doing so because they need help doing something they don't entirely understand.
Describing what you want when you don't exactly know what it is you want isn't always an easy thing to do.
As titles go, it was at least in the ballpark; it could have been something much less useful ... such as "Please Help".
Just think for a moment before you get all confrontational about such things.
cmd | *sh | ruby | chef