Need help changing a simple DOS script
Posted: 20 Jan 2017 19:42
I want to know how I strip file names and get JUST the file name from the path and execute code on that.
I have this batch file:
What I do is place in SendTo folder, then I can select multiple files and have the code run.
Problem is this code is run:
Whereas I need this to be run:
Having the full path is causing me problems.
How do I strip the paths and leave JUST the file name?
IMPORTANT: my file will have spaces in them - I so I need to get the paces as well if they exist.
Not sure where to start with this.
Any help would be great.
Thanks.
I have this batch file:
Code: Select all
"F:\dir 1\dir 2\myprogram.exe" %*
What I do is place in SendTo folder, then I can select multiple files and have the code run.
Problem is this code is run:
Code: Select all
"F:\dir 3\dir 2\dir 1\myprogram.exe" "F:\dir 4\dir 5\dir 6\file 1.txt" "F:\dir 4\dir 5\dir 6\file 2.txt" "F:\dir 4\dir 5\dir 6\file 3.txt"
Whereas I need this to be run:
Code: Select all
"F:\dir 3\dir 2\dir 1\myprogram.exe" "file 1.txt" "file 2.txt" "file 3.txt"
Having the full path is causing me problems.
How do I strip the paths and leave JUST the file name?
IMPORTANT: my file will have spaces in them - I so I need to get the paces as well if they exist.
Not sure where to start with this.
Any help would be great.
Thanks.