Computing.Net > Forums > Disk Operating System > Batch: Find and delete a substring

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch: Find and delete a substring

Reply to Message Icon

Name: shuser
Date: February 23, 2004 at 18:50:08 Pacific
OS: Win XP
CPU/Ram: x86 256MB
Comment:

I need to find a substring in the passed in argument (%1) and delete it.

For example, when I do this (batch file is dotest.bat):
C:>dotest test_file.txt
In dotest.bat, I need to delete .txt if it exists. So if they pass in only test_file for 1st arg, I don't want to do anything. But if they pass in test_file.txt for 1st arg, I need to extract only test_file (delete .txt from 1st arg).

I would really appreciate if anyone you help me...

Thanks in advance!



Sponsored Link
Ads by Google

Response Number 1
Name: Wengier
Date: February 23, 2004 at 19:21:18 Pacific
Reply:

http://computing.net/dos/wwwboard/forum/14518.html


0

Response Number 2
Name: jconner
Date: February 25, 2004 at 18:16:51 Pacific
Reply:

%~n1 -- expands %I to a file name only(no extension)


0

Response Number 3
Name: Wengier
Date: February 29, 2004 at 20:27:57 Pacific
Reply:

This thread has been redirected to the Windows NT Forum:

http://www.computing.net/windowsnt/wwwboard/forum/22153.html


0

Response Number 4
Name: shuser
Date: March 17, 2004 at 10:39:03 Pacific
Reply:

Thanks a lot JCONNER!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch: Find and delete a substring

How to find and replace a string www.computing.net/answers/dos/how-to-find-and-replace-a-string/7591.html

xcopy and delete a group of files. www.computing.net/answers/dos/xcopy-and-delete-a-group-of-files/12032.html

Find the oldest version and delete www.computing.net/answers/dos/find-the-oldest-version-and-delete/9386.html