首页 \ 问答 \ 批处理文件:相对路径出错,从当前目录向上一级(Batch File: Error in relative path , one level up from the current directory)

批处理文件:相对路径出错,从当前目录向上一级(Batch File: Error in relative path , one level up from the current directory)

我是批处理脚本编程的新手。如果给出相对路径,执行批处理文件时出现错误。 我有以下文件夹结构

Script folder - C:\batch\script\ServiceRegister.bat
Bin path - C:\batch\bin\ERecruitGenerateReportsWindowsService.exe

ServiceRegister.bat批处理文件 -

%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe %~dp0%~1\bin\ERecruitGenerateReportsWindowsService.exe

当我执行ServiceRegister.bat文件时出现错误:

Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\batch\script\bin\ERecruitGenerateReportsWindowsService.exe' or one of its dependencies. The system cannot find the file specified.

我正在使用“%〜dp0%〜1”在目录中上升一级,但它仍然获得当前路径。

%~dp0%~1 - C:\batch\script\  

我需要C:\ batch \路径。 我如何才能获得这条道路? 它工作正常如果我给绝对路径 -

%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe C:\batch\bin\ERecruitGenerateReportsWindowsService.exe

I am new to the batch script programming.Getting error while executing batch file if I give the relative path. I have following folder structure

Script folder - C:\batch\script\ServiceRegister.bat
Bin path - C:\batch\bin\ERecruitGenerateReportsWindowsService.exe

ServiceRegister.bat Batch file –

%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe %~dp0%~1\bin\ERecruitGenerateReportsWindowsService.exe

When I execute ServiceRegister.bat file I got the error:

Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\batch\script\bin\ERecruitGenerateReportsWindowsService.exe' or one of its dependencies. The system cannot find the file specified.

I am using “%~dp0%~1” to go one level up in the directory still it gets its current path.

%~dp0%~1 - C:\batch\script\  

I need the C:\batch\ path. How I can get this path? It works fine If I give the absolute path -

%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe C:\batch\bin\ERecruitGenerateReportsWindowsService.exe

原文:https://stackoverflow.com/questions/16960880
更新时间:2022-05-11 18:05

最满意答案

你是对的--Mandrill将每个电子邮件收件人视为一封电子邮件。 为每个收件人单独跟踪打开,点击,退回和其他活动,为此,必须向每个收件人发送单独的特定电子邮件。 当您向每个收件人发送相同的内容时,基于​​每个收件人的跟踪必然要求为每个收件人创建单独的电子邮件。

您有几个选项 - 无论如何,您可能希望使用webhooks将开放,点击等数据传回给您,而不是每次要显示有关消息的信息时都查找该数据。 Webhooks允许您获取数据,添加计数并缓存该数据,除非/直到有额外的打开/点击记录。 在不添加任何元数据的情况下,您可以将一个收件人的唯一邮件ID或系统中的特定“消息”用于递增计数器。

如果您愿意,还可以使用Mandrill中的自定义元数据字段,在发送邮件时传递一些唯一标识符,以便将这100个电子邮件/收件人与系统中的单个邮件相关联。 元数据被存储/跟踪30天,并且也包含在webhook中,因此您也可以以这种方式引用回系统。


You're correct - Mandrill treats each email recipient as a single email. Opens, clicks, bounces, and other activity are tracked individually for each recipient, and in order to do that, an individual, specific email must be sent to each recipient. While you're sending the same content to each recipient, tracking on a per-recipient basis necessarily requires that an individual email be created for each recipient.

You have a few options - regardless, you probably want to use webhooks to have open, click, etc. data passed back to you rather than looking up that data each and every time you want to display information about messages. Webhooks would allow you to get the data, add to your counts, and cache that data unless/until there are additional opens/clicks to record. Without adding any metadata, you can use that unique message id for a series of recipients or a specific "message" from your system to increment your counters.

If you wanted to, you could also use a custom metadata field in Mandrill, to pass some unique identifier when you send a message to associate these 100 emails/recipients with a single message in your system. Metadata is stored/tracked for 30 days, and is included in webhooks, as well, so you can reference back to your system in that way, too.

相关问答

更多
  • 如果您希望两个收件人都能够看到对方,则可以在“收件人”选项中传递一系列电子邮件。 如果您不希望其中任何一个看到对方,您可以在用户循环中发送所述电子邮件。 如果使用ActionMailer ,可以这样做: mail( to: ['person1@gmail.com', 'person2@gmail.com'] ) 或者循环: [user1, user2].each do |user| UserMailer.some_email(user).deliver_now end mail( to: u ...
  • 您无法设置默认的from_address。 每次通过API调用都必须包含它。 您的域名是其他内容,通过添加域名,您可以将其添加到可以通过API与您的Mandrill帐户对话的域名白名单中。 You can't set a default from_address. You will have to include it each time via your API call. Your domain is something else, by adding a domain you add it to th ...
  • 你是对的--Mandrill将每个电子邮件收件人视为一封电子邮件。 为每个收件人单独跟踪打开,点击,退回和其他活动,为此,必须向每个收件人发送单独的特定电子邮件。 当您向每个收件人发送相同的内容时,基于每个收件人的跟踪必然要求为每个收件人创建单独的电子邮件。 您有几个选项 - 无论如何,您可能希望使用webhooks将开放,点击等数据传回给您,而不是每次要显示有关消息的信息时都查找该数据。 Webhooks允许您获取数据,添加计数并缓存该数据,除非/直到有额外的打开/点击记录。 在不添加任何元数据的情况下, ...
  • 以下代码示例显示如何指定两个收件人,构造一个电子邮件对象并使用该电子邮件对象执行SendSheet操作。 用于指定收件人和构造电子邮件对象的相同技术可以应用于其他发送操作(例如, SendReport , SendRow等)。 // Specify recipients Recipient[] recipients = new Recipient[] { new Recipient { Email = "john.doe@smartsheet.com" }, new Recipient { Emai ...
  • 确保重新启动delayed_job守护程序以获取任何代码更改。 它不会像Rails开发环境那样自动重新加载。 Make sure to restart the delayed_job daemon to pick up any code changes. It does not auto-reload like the Rails development environment does.
  • 看看sendwithus吧 。 它们在Mandrill之上提供模板管理和发送API,我知道它们支持动态主题行。 文件在这里。 Take a look at sendwithus. They provide a template management and sending API on top of Mandrill, and I know they support dynamic subject lines. Docs here.
  • 首先只需通过js SDK使用mandrill API 它可以在这里找到。 var m = new mandrill.Mandrill('api key'); function sendTheMail(){ m.messages.send({ "message": { "from_email": "xx@xx.com", ...
  • 我发现你将从下面链接获得所有api及其文档 https://mandrillapp.com/api/docs/index.php.html 借助于此,我解决了我的问题。 谢谢 I found that you will get all api & its documentation from below link https://mandrillapp.com/api/docs/index.php.html With the help of this i resolved my issue. Thanks
  • 目前,Mandrill使用电子邮件地址作为API调用中合并变量的唯一标识符,因此只能为电子邮件地址提供一组合并值,即使您在messages.to已多次指定该地址。参数。 如果您有多个唯一的电子邮件要发送给同一个收件人,那么此时应该在单独的API调用中处理。 At this time, Mandrill uses email addresses as a unique identifier for merge vars in API calls, so it's only possible to provid ...
  • 来自mandrill api doc: 此消息应作为YYYY-MM-DD HH:MM:SS格式的UTC时间戳发送。 如果您指定过去的时间,则会立即发送消息。 预定电子邮件需要支付额外费用,此功能仅适用于余额为正的帐户。 如果我不得不猜测我猜想send_at = time_now需要成为send_at = time_now.to_s以使send_at尊重所需的格式。 Found the answer, you have to include async and ip_pool if you want to u ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)