|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Web Development Archives > FAQs > MS DOS > How to get a filename from a filepath |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|