Question please.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
sklub
Posts: 9
Joined: 13 Jan 2017 12:56

Question please.

#1 Post by sklub » 27 Jan 2017 06:42

ok so i ve learned batch the best i can from home and im far from being an expert.
but i have a little problem when writing a script...
when i put in a set /p command i want to have a %symbol% there always at the end of the line.
i want to put in a space instead so i can just set /p command=Abc%space% as my final symbol
right now iam useing
set space=" "
set space=%space:~1,1%
to do that job but my program crashes when i try it so right now iam useing a %symbol% instead wich works fine....
but for the set /p command i just want to enter a spacebar at the end of the line.
and read that ( the %space% )
is this possible?

sklub
Posts: 9
Joined: 13 Jan 2017 12:56

Re: Question please.

#2 Post by sklub » 27 Jan 2017 06:48

Heres the script by the way:
@echo off
:default
set ruimte=.
set draad=0
set kraal=0
set endkral=11
set endraad=11
set midA=6
set midb=6
set moder=0
set mods=1
set mode=dir
set pinga=0
set pingb=0
set nslook=0
set nslookA=0
set clear=0
set colors=0
set setter=0
set loop=:leegmem
set mem=empty
set setterA=0
set setter=0
set helper=0
set echa=0
set echer=0
:monitor
echo ---------
echo :monitor:
echo ---------
if %echer%==1 echo %echeecho%
if %clear%==1 goto :putin
if %mods%==1 %mode%
if %mods%==1 goto :putin
:draad
if %draad%==%endraad% goto :putin
set /a draad=%draad%+1
:kraal
set /a kraal=%kraal%+1
set sym=.
if %kraal%==1 set sym=#
if %draad%==1 set sym=#
if %kraal%==%endkral% set sym=#
if %draad%==%endraad% set sym=#
if %draad%==%midb% if %kraal%==%midA% set sym=x
set screenmemory=%screenmemory%%sym%
if %kraal%==%endkral% goto :echosherm
goto :kraal
:echosherm
set kraal=0
echo %screenmemory%
set screenmemory=
goto :draad
:putin
if %helper%==1 for /f %%y in ( help.info ) do (
echo %%y
)
set helper=0
if %setter%==1 set
set setter=0
if %nslookA%==1 nslookup %nslooker%
set nslookA=0
if %pingb%==1 ping %pinger%
set pingb=0'
echo mem=%mem%
echo -------------
echo Enter Command:
echo -------------
set draad=0
set /p input=
cls
set input=%input%%ruimte%}
if %input%==%ruimte%} set input=0%ruimte%}
:deput
set inA=%input:~0,1%
set input=%input:~1%
if %inA%==%ruimte% goto :run
if %inA%==} goto :monitor
set memory=%memory%%inA%
goto :deput
:run
if %echa%==1 goto :echa
if %memory%==echo set echa=1
if %memory%==help goto :help
if %setterA%==1 goto :setmem
if %memory%==setmem set setterA=1
if %memory%==setlist goto :setlist
if %memory%==debug goto :debug
if %colors%==1 goto :color
if %memory%==color set colors=1
if %memory%==clear set /a clear=%clear%+1
if %clear%==2 set clear=0
if %nslook%==1 goto :nslookup
if %memory%==nslookup set nslook=1
if %pinga%==1 goto :ping
if %memory%==ping set pinga=1
if %moder%==1 goto :mode
if %memory%==mode set moder=1
if %memory%==left set /a midA=%midA%-1
if %memory%==right set /a midA=%midA%+1
if %memory%==up set /a midb=%midb%-1
if %memory%==down set /a midb=%midb%+1
if %midA%==1 set /a midA=%midA%+1
if %midb%==1 set /a midb=%midb%+1
if %midA%==%endkral% set /a midA=%midA%-1
if %midb%==%endraad% set /a midb=%midb%-1
:leegmem
set memory=
goto :deput
:mode
set moder=0
if %memory%==dir set mods=1
if %memory%==dir set mode=dir
if %memory%==dirb set mods=1
if %memory%==dirb set mode=dir /b
if %memory%==net set mods=1
if %memory%==net set mode=netstat
if %memory%==ip set mods=1
if %memory%==ip set mode=ipconfig
if %memory%==tasks set mods=1
if %memory%==tasks set mode=tasklist
if %memory%==graph set mods=0
goto :leegmem
:ping
set pinga=0
set pingb=1
set pinger=%memory%
goto :leegmem
:nslookup
set nslook=0
set nslookA=1
set nslooker=%memory%
goto:leegmem
:color
set colors=0
color %memory%
goto :leegmem
:debug
set /a debug=%debug%+1
if %debug%==2 set debug=0
if %debug%==0 @echo off
if %debug%==1 @echo on
goto %loop%
:setlist
set setter=1
goto %loop%

:setmem
set setterA=0
set mem=%memory%
goto %loop%

:help
set helper=1
goto %loop%

:echa
set echa=0
set echer=1
set echeecho=%memory%
goto %loop%

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: Question please.

#3 Post by Squashman » 27 Jan 2017 07:34

Not going to read that much code to see if you have other syntax errors but if you want a space at the end of your SET /P prompt string then use quotes.

Code: Select all

set /p "var=Space after "

Post Reply