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, 8687🔥, 0💬
Popular Posts:
How to start Apache server manually on Windows systems? If you followed our Apache server installati...
What is the startup program "Intel Graphics Accelerator Helper - igfxtray.exe" on my Windows 8 compu...
What is "Software Protection" in my Windows 7 service list? And how is "Software Protection" service...
How to restore Bluetooth icon in the taskbar (system tray) on Windows 7? I removed it by a mistake. ...
How to unblock a publisher? 1. Open Internet Explorer. 2. Click the Tools button, and then click Int...