The Console dir command displays the full path of each file

Source: Internet
Author: User
Tags extend
Sometimes we need to output all the file list to a text file through the console dir command, and then process it, but the dir command gets the file name under each directory, without the full path, how can you follow the full path of a directory after the file name? I looked it up on the internet, This can be done through the bat batch:
@echo off
for/f "delims="%%i in (' dir/a-d/b/s/od ') do echo%%~ti%%~dpnxi
For example, to output the full path name list in a directory to A.txt, save the above code to B.bat, and then enter it at the command line:
B>a.txt
Can.
If you are using it directly in the console, you can add the last line in the bat file
Pause
Prompt to press any key to continue after full screen at execution time.
Above is just the intermediate result, you can set the parameters of the dir command further to get the desired result.

~i-Remove any quotation marks ("), Extend%I
%~fi-Will%I Extend to a fully qualified path name
%~di-will only%I Extend to a drive letter
%~PI-will only%I Extend to a path
%~ni-will only%I Extend to a file name
%~xi-will only%I Extend to a file name extension
%~si-The extended path contains only short names
%~ai-Will%I File attributes extended to file
%~ti-Will%I Date/Time extended to file
%~zi-Will%I Size of extension to file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.