Computing.Net > Forums > Disk Operating System > Need to format the variable in .bat

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Need to format the variable in .bat

Reply to Message Icon

Name: dos_user
Date: April 23, 2006 at 17:57:53 Pacific
OS: DOS/ Win XP
CPU/Ram: P4
Product: Intel
Comment:

Hi,
I needs to format a variable. my variable contains number. and i want to achieve some thing like RPAD in oracle. basically i want fix length string which contain data in my variable along with zero padded at right side. Say my variable contains 123 and I want it shown as 0000123. how can I achieve this.

Thanks in advance.



Sponsored Link
Ads by Google

Response Number 1
Name: jboy
Date: April 23, 2006 at 19:50:31 Pacific
Reply:

"This forum is for all Standalone versions of DOS, not the "DOS" prompt contained inside later versions of Windows."

Perhaps the Programming forum would be more suitable?

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true


0

Response Number 2
Name: Mechanix2Go
Date: April 23, 2006 at 20:03:03 Pacific
Reply:

::== padvar.bat
@echo off

set myvar=%1

if %myvar% lss 10 set myvar=000000%myvar% & goto :eof
if %myvar% lss 100 set myvar=00000%myvar% & goto :eof
if %myvar% lss 1000 set myvar=0000%myvar% & goto :eof
if %myvar% lss 10000 set myvar=000%myvar% & goto :eof
if %myvar% lss 100000 set myvar=00%myvar% & goto :eof
if %myvar% lss 1000000 set myvar=0%myvar% & goto :eof
:: DONE



=====================================
If at first you don't succeed, you're about average.

M2Go



0

Response Number 3
Name: Mechanix2Go
Date: April 23, 2006 at 20:05:10 Pacific
Reply:

Hi jboy,

oops, spaced out.

espresso maker is broke.

LOL


=====================================
If at first you don't succeed, you're about average.

M2Go



0

Response Number 4
Name: dos_user
Date: April 23, 2006 at 20:27:59 Pacific
Reply:

Thanks Mechanix2Go,
it's slove my prob. thanks once again


0

Response Number 5
Name: jboy
Date: April 23, 2006 at 20:35:03 Pacific
Reply:

Ah well - their first post was deleted, but I gather if one just keeps on reposting, problem solved.

Me, I don't really care (this forum isn't what it used to be) - sure would be nice to know which particular days of the week (or perhaps cycles of the moon) these rules & warnings are applicable

I suppose consistancy really is 'the hobgoblin of small minds'

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true


0

Related Posts

See More



Response Number 6
Name: Mechanix2Go
Date: April 23, 2006 at 21:11:21 Pacific
Reply:

Yeah, that bat surely won't work in DOS.

The failure to read and heed forum guidelines is, sadly, not confined to this forum.

The bit that most often gets blown off is, "state EXACT OS and hardware".


=====================================
If at first you don't succeed, you're about average.

M2Go



0

Response Number 7
Name: jboy
Date: April 23, 2006 at 23:04:00 Pacific
Reply:

Why, it's "DOS" (of course - heh)

You can even post unrequested HJT logs now too

I won't even mention that nonsense in 9x last Friday...

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true


0

Response Number 8
Name: jessejames
Date: April 24, 2006 at 09:07:38 Pacific
Reply:

I used Slackware Linux, when in Console Mode it has Black Background White Text, it looks like XP DOS !!!!!!!!!!!!!!!!!!!!!!!!!


0

Response Number 9
Name: jboy
Date: April 24, 2006 at 17:11:16 Pacific
Reply:

Yes, well the uninformed from all walks of life seem to feel that any onscreen text (even that generated by the BIOS) is "DOS"

Thanks for the update

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true


0

Response Number 10
Name: Mechanix2Go
Date: April 25, 2006 at 00:42:17 Pacific
Reply:

One of my personal favs was the guy who had [IIRR] an IBM laptop with a BIOS ver 6.23 and he was asking questions about "DOS 6.23" LOL.


=====================================
If at first you don't succeed, you're about average.

M2Go



0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Need to format the variable in .bat

need to format hard drive but i have no reboot disks www.computing.net/answers/dos/need-to-format-hard-drive-but-i-have-no-reboot-disks/2103.html

why do u need to format a disk or a drive? www.computing.net/answers/dos/why-do-u-need-to-format-a-disk-or-a-drive-/3605.html

DOS transfer to floppy www.computing.net/answers/dos/dos-transfer-to-floppy/1184.html