Collections:
Other Resources:
Get Batch File Path Name Components
How to Get Batch File Path Name Components? I want to know the path name of the directory where the batch file is located.
✍: FYIcenter.com
To get different components of the batch file path name,
you can use batch parameter modifiers on %0, which
represents the batch file name.
Here is a batch file, Batch-File-Name.bat, that dumps the %0 parameter with different modifiers:
@echo off rem Batch-File-Name.bat - Show components of the batch file name echo 0 = %0 echo ~0 = %~0 echo ~f0 = %~f0 echo ~d0 = %~d0 echo ~p0 = %~p0 echo ~n0 = %~n0 echo ~x0 = %~x0 echo ~s0 = %~s0 echo ~a0 = %~a0 echo ~t0 = %~t0 echo ~z0 = %~z0 echo ~$PATH:0 = %~$PATH:0 echo ~dp0 = %~dp0 echo ~pd0 = %~pd0 echo ~nx0 = %~nx0 echo ~dp$PATH:0 = %~dp$PATH:0 echo ~ftza0 = %~ftza0
If you run the above batch file located at C:\fyicenter\Batch-File-Name.bat, you get the following output:
C:\fyicenter>Batch-File-Name.bat 0 = Batch-File-Name.bat ~0 = Batch-File-Name.bat ~f0 = C:\fyicenter\Batch-File-Name.bat ~d0 = C: ~p0 = \fyicenter\ ~n0 = Batch-File-Name ~x0 = .bat ~s0 = C:\FYICEN~1\BATCH-~2.BAT ~a0 = --a------ ~t0 = 11/22/2033 10:20 PM ~z0 = 552 ~$PATH:0 = C:\fyicenter\Batch-File-Name.bat ~dp0 = C:\fyicenter\ ~pd0 = C:\fyicenter\ ~nx0 = Batch-File-Name.bat ~dp$PATH:0 = C:\fyicenter\ ~ftza0 = --a------ 11/22/2033 10:20 PM 552 C:\fyicenter\Batch-File-Name.bat
⇒ Get Batch Parameter as File Path
2022-02-19, ∼9355🔥, 0💬
Popular Posts:
Where to find tutorials on using Windows Server 2012? I want to learn how to use Windows Server 2012...
What is "User Profile Service" in my Windows XP service list? And how is "User Profile Service" serv...
How set up "live tv" in Windows Media Center on Windows 7? If you have TV tuner installed on your co...
How to download and install JDK (Java SE Development Kit) 6? If you want to download and install JDK...
Downloading and Installing vStrip "vStrip" is one the most powerful DVD ripper and VOB file processi...