Tips: Use the bat batch file under windows to realize the one-drag function

One drag:

We often need to use scripts to process files, whether it is hard to write the file name or it is inconvenient to type the file name every time you call

If you drag the file to be processed directly onto the script, you can pass the parameters, and use bat, which is a convenient function.

The following is an example of converting MindManager file .mmap to FreeMind's .mm and .mmap file to introduce this technique


The bat file is written like this, and the rest of the work is left to python.

@echo off
call mm2fm.py %~dp1 %~nx1
pause


The only things to pay attention to here are "%~dp1" and "%~nx1", path and file name

When you drag a file to the bat, windows will pass the path and file name of the file to the bat file and execute the bat.
This enables dragging files to bat, and at the same time calling scripts to process the dragged files. It is very convenient to use.


If you have installed pyton, you can see the example:

http://download.csdn.net/detail/windcao/6357229

Guess you like

Origin blog.csdn.net/windcao/article/details/12319225