Try the snippet below; this will work under the assumption that the only $ sign in the folder will be the one from the share; if this is not the case, holler.
Main Topics
Browse All TopicsHi,
I need some help in a dos script I am writing.
I have strings in this format:
\\was123abcd\c$\Users\tech
\\vaswebunx\f$\Users\fin
I already have a dos script that does some other stuff like creating folders etc. I need to take the above two strings in that dos script and output values like this:
c:\Users\tech
f:\Users\fin
So I am removing the server hostname and converting the admin share to a local share. I do not have the liberty to call other libraries etc.. Can I use some strings functions within DOS to achieve this?
Thanks a bunch for any help.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Can you help me further..
When you do set LocalPath=%%b:%%c, how can I use the LocalPath variable in the rest of my DOS script.
I tried %LocalPath% - that did not seem to work, also is it necessary to make it an environment variable, can I just make it a local variable - local to the script only? Thanks.
Just use %LocalPath%; it's set, otherwise you wouldn't see it in the "echo" output.
Variables in a batch script are always environment variables.
If you want them to only exist in your script, add the line
setlocal
at the beginning of your script; none of the variables set during the script will exists once it ends. I usually start with
@echo off
setlocal
Business Accounts
Answer for Membership
by: Mike_CarrollPosted on 2009-01-28 at 13:59:27ID: 23491858
Here's a good resource on strings in DOS http://www.dostips.com/DtT ipsStringM anipulatio n.php