@echo off
Set filename=C:\Documents and Settings\All Users\Desktop\Dostips.cmd
For %%A in ("%filename%") do (
Set Folder=%%~dpA
Set Name=%%~nxA
)
echo.Folder is: %Folder%
echo.Name is: %Name%
But I can’t take credit for this; Google found this at http://www.dostips.com/forum/viewtopic.php?f=3&t=409
Related Contents:
- How to read a text file line by line and modify every line using a batch file?
- How can I pass arguments to a batch file?
- Batch file comparison of variable with constant fails
- How to set environment variables with spaces?
- What are the ERRORLEVEL values set by internal cmd.exe commands?
- Assign output of a program to a variable using a MS batch file
- Defining and using a variable in batch file
- How to request Administrator access inside a batch file
- Displaying Windows command prompt output and redirecting it to a file
- Time is set incorrectly after midnight
- Can I mask an input text in a bat file?
- Which cmd.exe internal commands clear the ERRORLEVEL to 0 upon success?
- How Should I Set Default Python Version In Windows?
- How to read and print contents of text file line by line?
- Windows Bat file optional argument parsing
- Error: “is not recognized as an internal or external command, operable program or batch file”
- How to wait in a batch script? [duplicate]
- Logical operators (“and”, “or”) in DOS batch
- What must be taken into account on executing a batch file as scheduled task?
- Adding the current directory to Windows path permanently
- Debugging non-working batch file or command executed from Inno Setup installer
- How do I make a batch file terminate upon encountering an error?
- How do you loop in a Windows batch file?
- What is the current directory in a batch file?
- Run Batch File On Start-up
- How do I get the IP address into a batch-file variable?
- How to run multiple DOS commands in parallel?
- How do I write a Windows batch script to copy the newest file from a directory?
- How to search and replace a string in environment variable PATH?
- creating a shortcut for a exe from a batch file
- How to use if – else structure in a batch file?
- What does “&&” do in this batch file?
- How to make .BAT file delete it self after completion?
- batch file – counting number of files in folder and storing in a variable
- Drag and drop batch file for multiple files?
- How to search and replace a string that have an equal-to sign “=” inside
- ERRORLEVEL inside IF
- Why does the command XCOPY in batch file ask for file or folder?
- Floating point division in a batch file
- How to set PATH environment variable in batch file only once on Windows?
- Comparing two number in batch script
- Batch Files – Error Handling
- Waiting for parallel batch scripts
- Multiple choices menu on batch file?
- Arithmetic operations with HH:MM:SS times in batch file
- Batch file to copy files from one folder to another folder
- What’s the relative order with which Windows search for executable files in PATH?
- How to call Run() with parameters
- Batch File: Typewriter Effect
- How to set a timeout for a process under Windows 7?