You are not logged in.
Pages: 1
Ive got a file im workin on which requires user input
but i would like the input sentence for eg
set /p backup_name=Type In The Name For The Backup ?
To not be sat on the left edge for eg
Type In The Name For The Backup ?
so is there a way to space it out maybe 4 or more spaces to make it more visible? for eg
Type In The Name For The Backup ?
Thanks in advance
Last edited by Chimaera (2009-12-27 12:32:38)
Offline
set /p "backup_name=Type In The Name For The Backup ? "Offline
Sorry m8 dosent work for me
I need the spaces at the left hand of the text not the right, i tried..
set /p "backup_name=Type In The Name For The Backup ? "
set /p " backup_name=Type In The Name For The Backup ? "
set /p backup_name=" Type In The Name For The Backup ? "
The text stayed
Type In The Name For The Backup ?
Type In The Name For The Backup ?
^^^^^ This is where i need the spaces
The only way i have found so far is this
______Type In The Name For The Backup ? but this defeats the purpose
Thanks for trying
Last edited by Chimaera (2009-12-28 11:47:58)
Offline
set /p "backup_name= Type In The Name For The Backup ?"
Offline
set /p "backup_name= Type In The Name For The Backup ?"
Sorry dosent work either
would it be possible to add some sort of a margin i wonder?, it would have the same effect and wouldnt matter if it went done the whole sheet.
Offline
echo Type In The Name For The Backup ?
set /p backup_name=though I'm surprised this didn't work for you
set /p backup_name= Type In The Name For The Backup ? there's space hereOffline
thx m8 id sussed i can just make it an echo statement and space it away from the edge of the cmd screen, i just wondered if there was an easy way to do it in one line
set /p backup_name= Type In The Name For The Backup ? there's space here
not sure u guys understand i want the spaces on the left of it not the right
Type In The Name For The Backup ?
^^^^^^^^ Here ^^^^^^ Not Here
At best its a cosmetic thing to make it look better, i even tried to make a spaced parameter and put it first before the text but that didnt work either
Last edited by Chimaera (2009-12-29 14:02:23)
Offline
I did understand what you want, and on my machine, it does in fact leave a bunch of spaces to the left of the prompt -- effectively a left indent margin. Put double quotes around the entire set statement (after the /p, before the variable name, and after the prompt. The = is embedded in the double quoted string.)
set /p "backup_name= Type in the name? "Last edited by avery_larry (2009-12-29 16:08:45)
Offline
thx again i was just making sure i had explained myself right.
Yes a left margin for the displayed text is correct
heres the odd thing for me that dosent work?
I tried a brand new command file with only the command in it and a pause and it dosent put the spaces at the left, the 3 spaces after the ? were present
Im on win 7 64bit would that have anything to do with it?
ill test on my XP machine and report back
[EDIT]
Just checked on Win XP sp3 32bit and works fine??, so what the hell have MS done to stop it working on Win 7?
i captured the output just in case its needed
@echo on
set /p "backup_name= Type in the name? "echo %backup_name%
@pause
which gives..............
C:\Users\***\Desktop>set /p "backup_name= Type in the name? "
Type in the name? testC:\Users\***\Desktop>echo test
test
Press any key to continue . . .
Last edited by Chimaera (2009-12-31 03:22:43)
Offline
Well, can't say I know much about Win 7. (yet)
Offline
Only thing I can think of is a cheat from back in the DOS days, that still works on WinXP.
Character Alt+[2][5][5] was a blank character that didn't behave like a normal space.
Try this:
@echo off
set /p "var=ÿÿÿÿÿÿÿÿÿPrompt: "Don't know if this old trick still works in Win7 though. If CMD is fully unicode enabled, possibly not.
EDIT: Have you tried using a "tab"?
Last edited by bluesxman (2009-12-31 08:29:05)
Online
For something supposedly simple what a pain this has become lol
tried all suggestions on win 7 and no joy
I guess MS has fixed it good so it cant be done
Thanks for your efforts
Offline
I understand now, my bad.
You want the user to type on the left side, and the example to appear on the right side.
So ya, adding a space BEFORE the text won't allow typing on the left side.
Though I dont know why you want that. It's not intuitive.
Offline
For something supposedly simple what a pain this has become lol
tried all suggestions on win 7 and no joy
I guess MS has fixed it good so it cant be done
Thanks for your efforts
No joy from my suggestions?
Online
No joy from my suggestions?
Im afraid not m8
Though I dont know why you want that. It's not intuitive.
Just something i wanted to do thats all, it would have made the user input text easier to read
Thanks anyway
Offline
Never one to shy away from a challenge, I've come up with this:
set /p "var= Prompt: "It works on Win2008 -- which displays the same annoying quirk that you initially raised with Win7 -- so I'm fairly confident it'll work for you.
For what it's worth, these are my failed efforts:
@echo off
echo using "for"
for %%# in (" ") do set /p "var=%%~#Prompt: "
echo alt+255
set /p "var=ÿÿÿÿPrompt: "
echo tab instead
set /p "var= Prompt: "
echo caret escape
set /p var=^ ^ ^ ^ Prompt:
echo using a variable
set "sp= "
set /p "var=%sp%%sp%%sp%%sp%Prompt: "
echo different quotes
set /p var=" Prompt: "
echo desperation
set /p "var= " <nul
set /p "var=Prompt: "
echo success?
set /p "var= Prompt: "
pauseOnline
Never one to shy away from a challenge, I've come up with this:
set /p "var= Prompt: "It works on Win2008 -- which displays the same annoying quirk that you initially raised with Win7 -- so I'm fairly confident it'll work for you.
Yep thats works
:clap:
Thx for your efforts
Offline
Chimaera,
ANSI escape sequences will be useful for this.
@echo off
ansicon -p
echo [1m Type In The Name For The Backup [s
set /P var=[u[32m
echo [0m[1A
Offline
Even simpler;
ansicon -E[ Type In The Name For The Backup: & set /P var=
Offline
Pages: 1