Showing posts with label DOS. Show all posts
Showing posts with label DOS. Show all posts

Sunday, September 24, 2017

Windows 의 cmd 에서 drive 변경 없이 cd 하는 법

Command line 에서 D 드라이브로 chdir 하려면

> d:
> cd D:\myfolder

와 같이 하는데 이걸 한줄로 하려면

> cd /D D:\myfolder

와 같이 하면 된다.

Saturday, September 23, 2017

Windows 10 의 cmd 에서 network 상의 다른 컴퓨터로 cd 하려면

윈도우의 command line 에서 같은 네트워크 상의 다른 컴퓨터의 폴더로 들어가려면
cd 대신 pushd 를 쓰면 된다.

예: pushd \\mycomputer\john\myfolder

(pushd 를 쓸때마다 E: F: G: .. 이렇게 네트워크 드라이브가 하나씩 늘어나기 때문에,
Z: 까지 만들어지면 더이상 pushd 를 쓸수 없으므로 기존 네트워크 드라이브의 연결을 끊어주어야
pushd 를 계속 사용할 수 있다. 본래 pushd 의 용도는 나중에 popd 를 해서 원래 current directory 로
돌아가도록 하는 용도라 네트워크에 사용하면 이런 현상이 생기는 것임)

검색어 : chdir, change directory, folder, LAN
출처 : How do I change to a mapped network drive at the command line?

Monday, March 28, 2011

DOS Command Line Batch File 문법

%0 is the program name as it was called,
%1 is the first command line parameter,
%2 is the second command line parameter,
and so on till %9.

%CmdCmdLine% will return the entire command line as passed to CMD.EXE
%* will return the remainder of the command line starting at the first command line argument (in Windows NT 4, %* also includes all leading spaces)
%~dn will return the drive letter of %n (n can range from 0 to 9) if %n is a valid path or file name (no UNC)
%~pn will return the directory of %n if %n is a valid path or file name (no UNC)
%~nn will return the file name only of %n if %n is a valid file name
%~xn will return the file extension only of %n if %n is a valid file name
%~fn will return the fully qualified path of %n if %n is a valid file name or directory

예제 : Gnomonology Rendering Zbrush Displacement Maps 를 만든 Scott Spenser 의 배치 파일

:convertfile
@IF %1 == "" GOTO end
imf_copy -p %1 "%~d1%~p1%~n1.map"
@SHIFT
@GOTO convertfile
:end
@ECHO.
@ECHO Done!
@pause

출처 : http://www.robvanderwoude.com/parameters.php
키워드 : Command line parameters
미러 : Dos Batch File Parameters