.cmd file get relative path when running file on a server -
i have cmd file contains following command:
start h:\applications\mystoreapp\application.exe
the file location in h drive (this mapped shared drive) in folder mystoreapp. want make cmd resolve it's location relatively this:
start .\application.exe
i'm getting error since cannot resolve on remote host.
is there anyway solve without having enter specific location of file including mapped network drive?
%~dp0
path actual script directory (%0
script itself).
considering h:\applications\mystore\app\launcher.cmd
@echo "%~dp0application.exe" "h:\applications\mystoreapp\application.exe"
or, heavy use :
@set $root=%~dp0 @rem remove last backslash @set $root=%$root:~0,-1% @start "app" "%$root%\app.exe" /config "%$root%\app.ini" /log "%$root%\app.log"
quotes required in case of spaces in folder name.
for more information parameter extensions, see ss64.com.
Comments
Post a Comment