Author Topic: Name of WBT-script or exe to return  (Read 109 times)

hubbel

  • Newbie
  • *
  • Posts: 1
Name of WBT-script or exe to return
« on: September 21, 2017, 01:45:42 am »
Hi there,

I want to create a Winbatch program which uses its own .ini file. The name of the .ini should be dervived from the name of the .wbt or .exe file dynamically.

So I need a way to find out the name of the currently running wbt-script or -execuatable (in other words: the program should return it's own name)

DirScript will return the path where the programm is currently running, but it does not return the name of the wbt/exe.

I thought that WinName would do the job, but it returns only "WBT" when running as a script and returns "WBT - ExecutableName" when running the compiled exe.

My program should be used as a command-line utility, so there shouldn't be any active windows which prevents the usage of WinName at all.

I checked out the help file but didn't find a command which comes close to what I need.

Anyone has a hint for me?

Regards




mhall

  • Jr. Member
  • **
  • Posts: 80
Re: Name of WBT-script or exe to return
« Reply #1 on: September 21, 2017, 01:57:24 am »
Have you tried IntControl (1004, 0, 0, 0, 0)?

From the help file:

Code: [Select]
Returns the full path and file name of the current WinBatch program.

You could use it along with FileRoot() to get just the script name, minus the path.