windows - trying to get absolute file path's from relative path's from CLI -
cd "c:\path\to\directory\" >nul & echo %cd%
say run in c:\dir
. i'd expect output c:\path\to\directory
since that's if run each command individually , in succession. doesn't that. when 2 commands sorta concatenated outputs current path - eg. c:\dir
.
any ideas why? alternatively, ideas how can full path relative path via cli?
if concenate 2 commands act code block , %variables% can't change value. have use delayed expansion:
@echo off & setlocal enabledelayedexpansion cd "c:\path\to\directory\" >nul & echo !cd!
output be:
c:\path\to\directory
Comments
Post a Comment