Solved

command prompt dail string formating Windows OS

Posted on 2014-12-11
4
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 24

Accepted Solution

by:
NVIT earned 500 total points
ID: 40494361
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
ID: 40494793
that is briliant. excelent work thank you very much
0
 

Author Closing Comment

by:leop1212
ID: 40494794
true expert. for sure
0
 
LVL 24

Expert Comment

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

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

733 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