1

Im creating a program that's supposed to be called... upon it being called it needs to re-call the program that called it (And needs to be able to call it with paramaters.)

Ive failed to find any command in any reference or any tutorial on how to do it. Is there any Enviroment variable that is set to the name of the previous caller?

Thanks, and apologies for my poor question format, new.

3
  • 1
    In Windows BAT/CMD processing? No... the simplest way I see is to transfer the caller's full pathname to the chained file as a parameter. Or set some environment variable (%CALLER_FULL_PATHNAME%, for example) before call.
    – Akina
    Jun 8, 2018 at 5:22
  • @ZeekPlayz This sounds like you simply need to use CALL "<Script.cmd>" %~FNX0 and then in the <Script.cmd> you will use SET var=%~1 I suppose and then reference %var% to be the full explicit path of the script that called <Script.cmd> assuming that's what you are talking about. Be sure to use EXIT in the called script or else ensure logic in the first script is set accordingly as it'll pass control back to the original caller to continue the rest of it's logic unless you EXIT if you know what I mean. I would not set an environmental variable though, that is overkill. Jun 8, 2018 at 20:28
  • To clarify the %~FNX0 will be the first argument passed to the <Script.cmd> and you reference that in the called script as %~1. If you create a batch script and use ECHO %~FNX0 & PAUSE you will see this is the full explicit path, file name, and extension of the script so this is what you are passing to the called script as the first parameter and then referencing that as %~1 from within the script you call and pass that to. I'm not sure if you got all that from the comment Akina left but I wanted to clarify a bit further in detail just in case. Jun 8, 2018 at 20:31

0

You must log in to answer this question.