使用批处理命令如何从字符串中获取文件夹路径/目录?
例如,如果我有字符串“C:\user\blah\abc.txt”,我该如何拆分字符串以便只获取文件夹部分,即“C:\user\blah\”?
如果在批处理文件的命令行中传递字符串“C:\user\blah\abc.txt”,我如何将该字符串拆分为文件夹部分?
REM // Grab "C:\user\blah\abc.txt" from the command line
SET path="%*"
REM // The following doesn't successfully capture the "C:\user\blah\" part
SET justFolder=%path:~dp1%