MS DOS
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives FAQs MS DOS

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old March 12th, 2008, 09:06 AM
joejag joejag is offline
Registered User
Dev Archives Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 1 joejag User rank is Just a Lowly Private (1 - 20 Reputation Level)  
Time spent in forums: 3 m 48 sec
Reputation Power: 0
How to get a filename from a filepath

Hello everyone,

I've made a batch script which I drag and drop files onto as parameters. I'd like to be able to get the filename of a file given a file path.

For example:
Parameter: C:\dev\some_dir\iwantthisfilename.doc
I need as a variable: iwantthisfilename.doc

In unix I'd use the basename command. How would you achieve this in a batch script on XP?

Thanks,
Joe Wright.

Reply With Quote
  #2  
Old May 2nd, 2008, 10:14 PM
wwjdcsk wwjdcsk is offline
Registered User
Dev Archives Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 6 wwjdcsk User rank is Just a Lowly Private (1 - 20 Reputation Level)  
Time spent in forums: 1 h 32 m 50 sec
Reputation Power: 0
Instead of just using a parameter %1 you can use %~nx1 to get the file name plus the extension.

see Microsoft's Gude: Using Batch Parameters for more options

Reply With Quote
Reply

Viewing: Web Development Archives FAQs MS DOS > How to get a filename from a filepath


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT