我有很多文件名包含 %. 见下文:
c:\temp>
dir /b
114902_T%3A%5CAccounting%5CPayables%5CAPA%5CBoshart Apr 25%5CBII_inv_1489879.pdf
114904_T%3A%5CAccounting%5CPayables%5CAPA%5CBoshart Apr 25%5CBII_inv_1489880.pdf
114906_T%3A%5CAccounting%5CPayables%5CAPA%5CBoshart Apr 25%5CBII_inv_1491058.pdf
114916_T%3A%5CAccounting%5CPayables%5CAPA%5CBoshart Apr 25%5CBII_inv_1491059.pdf
114918_T%3A%5CAccounting%5CPayables%5CAPA%5CBoshart Apr 25%5CBII_inv_1491452.pdf
114920_T%3A%5CAccounting%5CPayables%5CAPA%5CBoshart Apr 25%5CBII_inv_1491453.pdf
114923_T%3A%5CAccounting%5CPayables%5CAPA%5CBoshart Apr 25%5CBII_inv_1491454.pdf
115513_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039292647.pdf
115515_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039295860.pdf
115517_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039296218.pdf
115523_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039308592.pdf
115525_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039308593.pdf
120342_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039328905.pdf
120345_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039337204.pdf
120348_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039337221.pdf
120351_T%3A%5CAccounting%5CPayables%5CAPA%5CABB MAY 15%5C0039337461.pdf
120639_T%3A%5CAccounting%5CPayables%5CAPA%5CAFA MAY 15%5CINV#63168731.pdf
120640_T%3A%5CAccounting%5CPayables%5CAPA%5CAFA MAY 15%5CINV#63168988.pdf
120642_T%3A%5CAccounting%5CPayables%5CAPA%5CAFA MAY 15%5CINV#63168993.pdf
120644_T%3A%5CAccounting%5CPayables%5CAPA%5CAFA MAY 15%5CINV#63169027.pdf
这些 % 实际上是 : (%3A) 和 \ (%5C) 的十六进制代码。我无法解释当它们从另一个系统复制时它们是如何得到这种方式的,但这是我必须使用的。为清楚起见,这就是十六进制代码的样子。
114902_T:\Accounting\Payables\APA\Boshart Apr 25\BII_inv_1489879.pdf
我想要做的是从这里重命名文件:
114902_T%3A%5CAccounting%5CPayables%5CAPA%5CBoshart Apr 25%5CBII_inv_1489879.pdf
对此:
BII_inv_1489879.pdf
我尝试按照其他重命名示例使用 % 作为分隔符,但更复杂的是最后一个分隔符(pdf 文件名)并不总是第 7 个标记。
任何帮助将不胜感激。