CMD use a few tips

First, the custom window size initialization

Windows 7 in time before feeling when you open the cmd window initialization size is quite appropriate, but after Windows 10 to open cmd window that is not just a great adaptation ---- course, may be a new computer resolution is relatively large result .

Whatever the reason, we just want to ask there is no way to customize the initialization cmd window size. The answer is yes, in fact, not just cmd, including powershell, git bash, cygwin and other similar type cmd program can customize their initialization window size.

---- open window in the window menu bar, right-click Properties ---- ---- switch to initialize window size (value at this time is the size of the window at this time of the Layout tab, set ---- want, rather than the initial size of the window) and click OK ---- ---- that is, to set a good size window re-opens.

 

 

Second, open cmd in the current directory

In linux, on the desktop or use Explorer to open a directory, that is the right option "in this directory open terminal", which saves work we switched directory is a very useful feature.

However, the Windows default right is no "open cmd in the current directory" like the menu, and when to switch between Windows directory different drive letter, but also lose a letter which is very troublesome, if Windows can also have "in the current directory open cmd "function, it would be great.

In fact, Windows does have this feature: Hold down the shift key, and then click the right mouse button, that is "open cmd window here" option (Windows 10 is powershell, all the same).

 

Third, open a new temporary variable cmd window inheritable

Sometimes we have such a demand: in a cmd window, we configured a number of temporary variables, we would like to open a new cmd with the test, we hope the new cmd window can also have those variables have cmd window settings.

If there is a re-assignment again redefine the variables that are more troublesome in new cmd window, we can have a more convenient approach: using the "start cmd" Create a cmd window in an existing cmd window, new window cmd It is the child of his old cmd cmd window will inherit the existing temporary variables.

其实这也才是我更想说的:cmd窗口中设置临时变量,应当而言各cmd窗口互不影响;但如果是父子窗口,在创建时子窗口会继承父窗口的临时变量(当然创建完后再修改也互不影响)。

另外,如果不用“start cmd”而是直接敲“cmd”,此时也会新建一个cmd进程,只是新的cmd进程借用了父cmd的窗口。当然此时父cmd进程并未消亡,使用exit退出即可返回父cmd;或者直接使用“tasklist | findstr cmd”查看进程列表也可以看到有两个cmd进程。但由于子进程借用了父cmd的窗口所以当杀除父cmd进程时窗口会被关闭,但如果是杀除的是子cmd进程那只会退出父cmd进程窗口不会被关闭。

Guess you like

Origin www.cnblogs.com/lsdb/p/11546270.html