1.

Solve : How to get part of the string from parameter?

Answer»

How to get part of the string from parameter?

I run a batch file which requried parameter like
abc.cmd query\check\test
In my abc.com i would like to create a directory like c:\query\check.
What will be command You didn't mention your OS, but this will work on some of them:

Code: [Select]
set dir=%1
md c:\%dir:~0,11%


I wish to run this command in Win 2000, Win 2003 and Win XP.

I had try the command but is not what been expected. .

With your code, let said I save it as test.cmd.

I run your command like below:

test.cmd abc\cde\XYZ

it create the abc, cde and xyz folder.

What I wish to get is

abc and cde folder only as xyz is my filename.

thank you.The response to your first post (which works by the WAY) was specific to the situation you PRESENTED. Now, not only have the delimiters changed but so have the lengths of the arguments.

Type set /? or for /? at any command prompt to see what your options are.

Using batch files with WIN2000, 2003, and XP is so 20TH century. Check out Script for more generic solutions.

Hope this helps. is there any substring, left, right, reverse or position function in dos? None whatsever. Did you check out your options with set /? and for /?. I apologize for my last post, it should have had a link to the Script Center where you can find tools and solutions for your needs.

Good luck.



Discussion

No Comment Found