How to escape both comma and closing parenthesis in WHERE clause of WMIC?

后端 未结 3 1387
一向
一向 2020-12-04 00:53

I am trying to retrieve the modification date of a file in a locale-independent manner, using the following wmic command:

wmic DataFile WHERE Na         


        
3条回答
  •  悲哀的现实
    2020-12-04 01:23

    Solution:

    D:\>mklink /H "1.jpg" "D:\p\a\t\h\fi,le.jpg"
    Hardlink created for 1.jpg <<===>> D:\p\a\t\h\fi,le.jpg
    
    D:\>wmic datafile where Name="D:\\1.jpg" list /format:list
    

    I understand not wanting to rename a file, view its metadata, then rename it back to its original filename. I re-tried @JosefZ solutions and they didn't work. I also tried JosefZ's Powershell solution and that didn't work. @aschipfl - Windows 10 didn't show the 8.3 filenames of files in an NTFS external HDD when I ran dir/x in cmd. (Windows 7 did show such filenames, and running fsutil behavior set disable8dot3 0 didn't fix it for Windows 10.)

    It's not a perfect solution, for wmic is not a perfect program. Users who also had trouble escaping commas: Escaping strings when using wmic

提交回复
热议问题