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
Solved

command prompt dail string formating Windows OS

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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

860 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