Solved

command prompt dail string formating Windows OS

Posted on 2014-12-11
4
158 Views
Last Modified: 2014-12-11
How to format parameter passed to the bat file.
I batch file to start an application from command line with %1 parameter.
Say batch file string looks like one below
Mytest.bat
C:\path\myprog.exe %1
I My case %1 is a caller ID passed from another application where I don’t have any control over to change the format of the telephone number supplied to me.
Phone number passed from the source will look like
 xxxxxxxxx for example 18527956430
While the phone number in the data I want it to compare with is written in format below.
xxx/xxx-xxxx 852/795-6430
 I don’t access or (don’t want to change formatting in the target and I don’t have any control   on the source of %1)
I am looking for the way to break down %1 by characters so I can make original xxxxxxxxxx to look like in the target data set.
So it should look logically something like the string below, but a working script.
C:\path\myprog.exe %1(chars 2,3,4)+ ”/” +%1(chars 5,6,7) +”-“ %(chars 8,9,10,11)
I only have access to the bat file syntax and neither source (ShoreTel easy pop see screenshot attached)  of %1, nor target data cannot be changed. Batch file is started by EasyPop program which is passing caller id.

I only modify  the batch file and don’t have access to Easy Pop or the target data source
easypop.jpg
0
Comment
Question by:leop1212
  • 2
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
NVIT earned 500 total points
Comment Utility
Does something like this help?
set src=%1
set tgt=%src:~1,3%/%src:~4,3%-%src:~7,4%
echo tgt=%tgt%

Open in new window

0
 

Author Comment

by:leop1212
Comment Utility
that is briliant. excelent work thank you very much
0
 

Author Closing Comment

by:leop1212
Comment Utility
true expert. for sure
0
 
LVL 23

Expert Comment

by:NVIT
Comment Utility
You're welcome, Leop1212. I am glad I could help. Thanks for the points.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now