Jump to content
Sign in to follow this  

-1 Invalid Directory when RunAsSet

Recommended Posts


Just when I thought I had the RunAsSet figured out...

I am receiving the dreaded

Line -1:

Error: Unable to execute the external program

The directory name is invalid

Here is the code

If FileExists(@StartupCommonDir & "\Windows Desktop Search.lnk") Then
    $fileToDelete = @StartupCommonDir & "\Windows Desktop Search.lnk"
    Run(@ComSpec & " /c " & "del "  '"' & $fileToDelete & '"', "", @SW_HIDE)

I first tried fileDelete(), then without the variable by building the path to the file on the run line and finally tried making the path to the file a variable.

Why Microsoft thought their search bar was a critical update is beyond my be the users are screaming.

Thanks for any assistance.

BTW I have figured out the RunAsSet for installing files from a network share. I will be searching for my original post and adding what I came up with.

Mr Ed

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.