1.

Solve : How to determine the name of batch script while running?

Answer» <html><body><p>Hi all, <br/><br/>Within my <a href="https://interviewquestions.tuteehub.com/tag/batch-893737" style="font-weight:bold;" target="_blank" title="Click to know more about BATCH">BATCH</a> script, I need to find out what is the name of the script that is currently running. Reason... I have multiple different batch files that on completion I want to send an email to a different set of recipients. Am using blat with -tf option. The <a href="https://interviewquestions.tuteehub.com/tag/plan-25498" style="font-weight:bold;" target="_blank" title="Click to know more about PLAN">PLAN</a> is to make the -tf file name parameter dynamic based on the name current of the currently running script.<br/>eg. Assume I have batch files, JOB_A.<a href="https://interviewquestions.tuteehub.com/tag/bat-394554" style="font-weight:bold;" target="_blank" title="Click to know more about BAT">BAT</a>,  JOB_B.bat etc<br/>In each script, I want to execute blat - tf C:\Mail_Recipients\%%.txt  .....<br/><br/>Question: How do I find out the name of the currently running batch script while it is executing.Parameter %0 gives you the name of the bat (if you have not used SHIFT)%0 gives the command effectively used to invoke the script. This can vary. The actual script name and extension <a href="https://interviewquestions.tuteehub.com/tag/may-557248" style="font-weight:bold;" target="_blank" title="Click to know more about MAY">MAY</a> be <a href="https://interviewquestions.tuteehub.com/tag/isolated-1052384" style="font-weight:bold;" target="_blank" title="Click to know more about ISOLATED">ISOLATED</a> in every case as %~nx0 or %~dpnx0 for the full drive, path, name and extension. <br/><br/></p></body></html>


Discussion

No Comment Found