0

So I'm trying something out and doing comparisons. Everything else works fine but when I use Ps1 to Exe by F2KO to get the running script's path, it returns something like this

C:\Users\justMe\AppData\Local\Temp\447F.tmp\4480.tmp\Test.ps1

I already tried using the code below but it returns the same AppData path.

$ScriptPath = (Split-Path -parent $MyInvocation.MyCommand.Definition) + "\Test.ps1"
Write-Host "Path: " $ScriptPath

Can anyone help out on this? Thanks.

  • 3
    Could be the actual path to where the exe is programmed to extract the script file and run it. Try a adding a start-sleep at the end and check the path that shows – Daniel Feb 11 '21 at 01:59
  • 2
    the exe is just a wrapper around the PS1 file ... so that path really is where the **_script_** is being run from. i suggest you ask the author how to get the exe path, OR that you look into checking the process list to find the start-in path, OR you try searching for the exe from inside your script. – Lee_Dailey Feb 11 '21 at 06:14
  • Does this answer your question? [Is there a way to properly access the isnetworkdeployed property from a complied EXE (using Quest PowerGUI)?](https://stackoverflow.com/questions/65040018/is-there-a-way-to-properly-access-the-isnetworkdeployed-property-from-a-complied) – iRon Feb 11 '21 at 06:59
  • You might want to use the current location `(get-location).Path` instead. – iRon Feb 11 '21 at 11:19

0 Answers0