SS64 Discussion Forum

You are not logged in.

#1 2009-12-27 12:32:09

Chimaera
IA-32
Registered: 2009-08-24
Posts: 120

Moving Set /p away from the edge of the screen?

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

#2 2009-12-28 10:15:11

carlos
PDP-11
Registered: 2008-11-03
Posts: 85

Re: Moving Set /p away from the edge of the screen?

set /p "backup_name=Type In The Name For The Backup ?    "

Offline

#3 2009-12-28 11:37:29

Chimaera
IA-32
Registered: 2009-08-24
Posts: 120

Re: Moving Set /p away from the edge of the screen?

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

#4 2009-12-28 13:27:35

avery_larry
IA-32
Registered: 2007-07-11
Posts: 250

Re: Moving Set /p away from the edge of the screen?

set /p "backup_name=       Type In The Name For The Backup ?"

Offline

#5 2009-12-29 03:03:16

Chimaera
IA-32
Registered: 2009-08-24
Posts: 120

Re: Moving Set /p away from the edge of the screen?

avery_larry wrote:

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

#6 2009-12-29 08:08:48

insthink
8088
Registered: 2009-10-24
Posts: 51

Re: Moving Set /p away from the edge of the screen?

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 here

Offline

#7 2009-12-29 13:57:17

Chimaera
IA-32
Registered: 2009-08-24
Posts: 120

Re: Moving Set /p away from the edge of the screen?

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

#8 2009-12-29 16:08:00

avery_larry
IA-32
Registered: 2007-07-11
Posts: 250

Re: Moving Set /p away from the edge of the screen?

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

#9 2009-12-30 06:49:28

Chimaera
IA-32
Registered: 2009-08-24
Posts: 120

Re: Moving Set /p away from the edge of the screen?

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?  test

C:\Users\***\Desktop>echo test
test
Press any key to continue . . .

Last edited by Chimaera (2009-12-31 03:22:43)

Offline

#10 2009-12-30 13:42:29

avery_larry
IA-32
Registered: 2007-07-11
Posts: 250

Re: Moving Set /p away from the edge of the screen?

Well, can't say I know much about Win 7.  (yet)

Offline

#11 2009-12-31 08:27:37

bluesxman
Sun Fire
From: Leeds, UK
Registered: 2006-12-29
Posts: 701

Re: Moving Set /p away from the edge of the screen?

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

#12 2009-12-31 11:43:37

Chimaera
IA-32
Registered: 2009-08-24
Posts: 120

Re: Moving Set /p away from the edge of the screen?

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

#13 2009-12-31 12:51:17

insthink
8088
Registered: 2009-10-24
Posts: 51

Re: Moving Set /p away from the edge of the screen?

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

#14 2010-01-01 06:36:47

bluesxman
Sun Fire
From: Leeds, UK
Registered: 2006-12-29
Posts: 701

Re: Moving Set /p away from the edge of the screen?

Chimaera wrote:

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

#15 2010-01-02 02:46:18

Chimaera
IA-32
Registered: 2009-08-24
Posts: 120

Re: Moving Set /p away from the edge of the screen?

bluesxman wrote:

No joy from my suggestions?

Im afraid not m8

insthink wrote:

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

#16 2010-01-04 06:15:45

bluesxman
Sun Fire
From: Leeds, UK
Registered: 2006-12-29
Posts: 701

Re: Moving Set /p away from the edge of the screen?

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: "

pause

Online

#17 2010-01-04 10:26:54

Chimaera
IA-32
Registered: 2009-08-24
Posts: 120

Re: Moving Set /p away from the edge of the screen?

bluesxman wrote:

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:clap:

Thx for your efforts

Offline

#18 2010-01-11 18:52:47

Drewfus
8088
From: Australia
Registered: 2010-01-10
Posts: 31

Re: Moving Set /p away from the edge of the screen?

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

http://adoxa.110mb.com/ansicon/index.html

Offline

#19 2010-01-11 19:05:13

Drewfus
8088
From: Australia
Registered: 2010-01-10
Posts: 31

Re: Moving Set /p away from the edge of the screen?

Even simpler;

ansicon -E[        Type In The Name For The Backup: & set /P var=

Offline

Board footer

Powered by FluxBB