SysWOW64 burns a few hours

My latest adventure involves me setting a profile for Powershell to import a module so that I can use a custom script without manually loading it each time. So run off to find that the environment variable is $profile.allusersallhosts. It maps to a file “C:\Windows\SysWOW64\WindowsPowerShell\v1.0\profile.ps1”, so I open up Notepad++, place my import statements in there and life should be good!

However, it’s not working. Not only is it not working, when I go into that folder the file isn’t showing. I have literally no clue where it’s saving so I use SysInternals ProcMon and watch Notepad++ to see the resources it’s using. Turns out that since notepad++ is built as a 32bit application, anytime it looks for the folder c:\windows\system32, some magical internal windows thing routes it to c:\windows\syswow64. So even though Notepad++ shows the folder to be system32, it actually isn’t.

In the end the solution was to use notepad.exe or any other 64bit editor that won’t discreetly change the folder on you and lead you on a wild goose chase.

Happy Coding!

 

 

Leave a Reply