简体   繁体   English

Windows上的正则表达式,获取当前文件夹UP的文件夹路径

[英]Regex on Windows, get the folder path of the folder UP the current one

I'm using a Winautomation robot to execute some task, and I need to get the path of the folder path of the previous folder. 我正在使用Winautomation机器人执行某些任务,并且需要获取上一个文件夹的文件夹路径的路径。 I can easyly have the current folder of execution of my robot. 我可以轻松拥有执行机器人的当前文件夹。

To illustrate what I want : 为了说明我想要的:

In my variable, I have the current directory : 在我的变量中,我有当前目录:

X:\\Memento\\InventairesDistrib\\VerificationsInventairesDistributeurs X:\\ Memento \\ InventairesDistrib \\ VerificationsInventairesDistributeurs

I want a regex to get the previous directory, so : 我想要一个正则表达式来获取先前的目录,所以:

X:\\Memento\\InventairesDistrib\\ X:\\ Memento \\ InventairesDistrib \\

Note that I could hardcode this directory in my robot, but I would like to have a more robust program, who will work even if I move my robot and folder hierarchy somewhere else. 请注意,我可以在机器人中对该目录进行硬编码,但是我想拥有一个更强大的程序,即使我将机器人和文件夹层次结构移动到其他位置,该程序也可以工作。

Thank you ! 谢谢 !

OK I did find how to do this within Winautomation scripting langage, no need of regex finally. 好的,我确实找到了如何在Winautomation脚本语言中执行此操作,最终不需要使用正则表达式。

Have a nice day ! 祝你今天愉快 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM