Horje
windows environment variables home directory Code Example
windows environment variables home directory
@echo off

set dirname=""
set dirname=%*
set orig_dirname=%*

:: remove quotes - will re-attach later.
set dirname=%dirname:\"=%
set dirname=%dirname:/"=%
set dirname=%dirname:"=%

:: restore dirnames that contained only "/"
if "%dirname%"=="" set dirname=%orig_dirname:"=%

:: strip trailing slash, if longer than 3
if defined dirname if NOT "%dirname:~3%"==""  (
    if "%dirname:~-1%"=="\" set dirname="%dirname:~0,-1%"
    if "%dirname:~-1%"=="/" set dirname="%dirname:~0,-1%"
)

set dirname=%dirname:"=%

:: if starts with ~, then replace ~ with userprofile path
if %dirname:~0,1%==~ (
    set dirname="%USERPROFILE%%dirname:~1%"
)
set dirname=%dirname:"=%

:: replace forward-slashes with back-slashes
set dirname="%dirname:/=\%"
set dirname=%dirname:"=%

chdir /D "%dirname%"




Shell

Related
ssh file transfer putty Code Example ssh file transfer putty Code Example
copy files between servers Code Example copy files between servers Code Example
How to add a pycharm project to github Code Example How to add a pycharm project to github Code Example
upgrade powershell Code Example upgrade powershell Code Example
git clone single branch Code Example git clone single branch Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11