How to SET a variable to the path of parent directory on windows?

前端 未结 3 1168
日久生厌
日久生厌 2020-12-30 02:59

Struggling with command line again, I have figure out that I can store the current working directory in a variable like so:

SET current=%cd%
<
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 03:34

    Move up a directory, remembering the current, set the parent, and then pop down a directory, back to where you started

    @echo off
    set current=%cd%
    pushd ..
    set parent=%cd%
    popd
    
    echo current %current%
    echo parent %parent%
    

提交回复
热议问题