Since 22H2, my MSHTA application cant access file paths over a shared drive

Sam Denton 25 Reputation points
2023-02-14T16:41:06.5666667+00:00

I built an internal tool a while back for managing access to VMs. Built with MSHTA for convenience, I knew it was considered deprecated by most and have been expecting something to stop working eventually. Dont' know if this issue is specifically HTA related, but I cant recreate it any other way.

Since the 22H2 update, parts of the program give a script error along the lines off 'Cannot find the specified filepath :File/Path/javascript.js'

The issue appears to be that it wont recognise it as a local file path, and is treating it as a URL, swapping out all the backslashes for slashes. Using double slashes results in double backslashes. Adding file:// to the start of the path, making it absolute or relative, using a mapped drive or full path; all make pretty much no difference, except some permutations give the error: 'Expecting object to be local' instead. If I just use //fileserver/path, I can get it to move past that error, but it then stops reading it as a JS file, giving errors about missing functions!

The program still works perfectly when accessed on a windows 10 machine, and a windows 11 machine thats not on 22H2 yet, both also accessing via a folder share/mapped drive.

The only other thing on this PC thats different, I recently ran Microsoft's 'Web Browsing Optimizer' in at attempt to access the new bing features faster! Given this messes with default programs and paths, I wonder if this is the cause. BTW, ChatPGT recommended: "add the UNC path to the "Local Intranet" zone in Internet Explorer" which made no difference.

Would have just assumed this was EOL for mshta but not seen anything about this elsewhere yet.

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} vote

Accepted answer
  1. Limitless Technology 44,766 Reputation points
    2023-02-16T10:59:35.43+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query

    It's possible that the recent Windows update or the changes made by the Web Browsing Optimizer have affected the way MSHTA handles file paths, causing the script error you are experiencing. Here are a few things you could try:

    Try running the program as an administrator to see if that resolves the issue.

    Check that the JavaScript file is located in the correct directory and that the file path in your code is correct.

    Try using a different browser, like Internet Explorer or Edge, to open the program and see if the issue persists.

    Check if any security software or firewalls might be blocking access to the JavaScript file.

    Try using a different method to load the JavaScript file, such as using the <script> tag or the jQuery.getScript() method.

    Check if any group policies or local security policies are blocking MSHTA or access to the file.

    If none of the above works, you could consider migrating your application to a more modern platform or framework that is actively supported and maintained.

    I hope this helps!

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.