Terminal Command Error

Hi,
Can anyone advise me why I am getting a “This item does not exist” error when I try to run this code?

Dim sh as new Shell sh.Execute ”sudo defaults write com.apple.finder AppleShowAllFiles NO” sh.close

Thank you all in advance.

You probably need an absolute path for sudo. That said, this won’t work anyway as you can’t enter your password.

Dang :frowning:
Thanks anyway.

Plus, you don’t need to sudo that since Finder settings are on a user by user basis. Remove the sudo call and it will work. But, you will need to restart Finder as @jean-paul devulder indicates to have it take effect.

This does not work either - I get the same error message :frowning:

Dim sh as new Shell sh.Execute ”defaults write com.apple.finder AppleShowAllFiles NO” sh.Execute ”killall Finder” sh.close

Thanks anyway.

I can’t imagine why, it should work (and is working here)

Works fine here in Console and Desktop apps.

Weird - I just deleted the quote marks and retyped them, and it now works perfectly :slight_smile:
Thank you all for the assistance.

Did you copy and paste from a website? They were probably “smart quotes” instead of normal double quotes…

What you posted in the OP has curly quotes. That is probably the reason why it did not work.

On Mac, you should uncheck “Use smart quotes and dashes” in Keyboard preferences Text. The “cute” curly quotes are a pest for programming.

Very often, too, web editors add these, and copying snippets don’t work.