0

I'm a tester and have hundreds of versions of the same program to test.

To avoid copying certain executables I store them as prog.exe.1 prog.exe.2 etc. then the script create a hardlink prog.exe (mklink /H .. or fsutil hardlink create prog.exe prog.exe.1) to all exe in the loop and start. This is much faster than copying (actually there are more files)

In most cases the started exe is visible in the Task Viewer as prog.exe. The problem is that sometimes it is visible as prog.exe.1 (2, 3, or 124...) and this breaks everything...

Good output (when prog.exe is displayed) of fsutil hardlink list prog.exe is:

\Program Files\prog\prog.exe.1
\Program Files\prog\prog.exe

Bad output (when prog.exe.1 is displayed):

\Program Files\prog\prog.exe
\Program Files\prog\prog.exe.1

Question: how to have it always visible as prog.exe in the Task viewer without copying? Soft links are always visible as targets (prog.exe.1...)

user2708351
  • 121
  • 7
  • I don't see why Task Viewer (do you mean Task Manager?) would resolve a hardlink to the first name returned by `FindFirstFileNameW`. But if that's what it's actually doing, and if it somehow "breaks everything", then, since you don't control the order of that list, you're only choice is to try a different approach. You could use a test script that temporarily renames the file. – Eryk Sun Aug 02 '20 at 18:10
  • I cannot reproduce this problem, even if my `fsutil hardlink list` shows the second situation. BTW, what do you want to do after getting the process name? To get the process id or any thing else? Maybe you could use `CreateProcess` to run the prog.exe and then you will get the pid. Or use `wmic` to retrieve it by commandline:`wmic process where "commandline like 'prog.exe'" get processid, name` – Drake Wu Aug 04 '20 at 03:13

0 Answers0