Solved

command prompt dail string formating Windows OS

Posted on 2014-12-11
4
169 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

729 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