Docfxit Posted October 10, 2022 Share Posted October 10, 2022 This script runs but doesn't produce the output. ; Copy file Shutdown.lnk into Desktop directory RunWait(@Comspec & ' /c Copy "C:\Dnload\9xAddons\Shutdown.lnk" "C:\Documents and Settings\All Users\Desktop" ') How can I figure out why Shutdown.lnk doesn't get copied into the desktop folder? Link to comment Share on other sites More sharing options...
HurleyShanabarger Posted October 10, 2022 Share Posted October 10, 2022 Is it working, if you copy the file using CMD? Have you tried using FileCopy? Link to comment Share on other sites More sharing options...
Musashi Posted October 10, 2022 Share Posted October 10, 2022 What happens if you copy the file with the AutoIt command FileCopy. Before, if necessary, check with FileExists whether the target directory exists (evaluate @error). "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Subz Posted October 10, 2022 Share Posted October 10, 2022 Assume this is for Windows XP or below? You would need to have #RequireAdmin since ..\All Users\Desktop is a system folder, to make it work with other versions of Windows, I'd recommend using: #RequireAdmin RunWait(@Comspec & ' /c Copy "C:\Dnload\9xAddons\Shutdown.lnk" "' & @DesktopCommonDir & '"') Docfxit 1 Link to comment Share on other sites More sharing options...
Solution Docfxit Posted October 10, 2022 Author Solution Share Posted October 10, 2022 (edited) I did originally write this for XP. I've been using it many years. Currently I'm using it in Windows 10. I tried this: #include <WinAPIError.au3> If Not FileCopy("C:\Dnload\9xAddons\Shutdown.lnk", @DesktopCommonDir, 9) Then $iLastError = _WinAPI_GetLastError() $sLastErrorMessage = _WinAPI_GetLastErrorMessage() Msgbox(0, "Show Error ", $iLastError & " - " & $sLastErrorMessage & @CRLF) EndIf And found it does copy the file. Edited October 10, 2022 by Docfxit Link to comment Share on other sites More sharing options...
Developers Jos Posted October 10, 2022 Developers Share Posted October 10, 2022 11 hours ago, Docfxit said: "C:\Documents and Settings\All Users\Desktop" Just for the record: Doubt that target is correct .... shouldn't that have been been something like: C:\Users\Default\Desktop SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now