jgq85 Posted April 15, 2020 Posted April 15, 2020 (edited) I am trying both FileInstall and FileCopy. I can get it to work if I pick a folder anywhere else that exists, but for some reason if I try to make the path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp" or @StartupCommonDir, it doesn't create or copy the file there depending on what I try. The reason I need to put it here is because I can't run the exe i'm making in the user's context. My remote management tool will only run under the SYSTEM context. So I think this is the best way I can get it to the user's start up folder, as well as without triggering a UAC prompt. Anyone have advice? I've tried each of the following: FileInstall("C:\ITScript.exe", "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp", 1) FileInstall("C:\ITScript.exe", @StartupCommonDir, 1) FileCopy("C:\ITScript.exe", "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp") FileCopy("C:\ITScript.exe", @StartupCommonDir) Edited April 15, 2020 by jgq85
1957classic Posted April 16, 2020 Posted April 16, 2020 I believe your source location is wrong but I know your destination is incomplete. I think it should be... FileInstall("ITScript.exe", @StartupCommonDir & "\ITScript.exe", 1) Or FileCopy("ITScript.exe", @StartupCommonDir & "\ITScript.exe", 1)
seadoggie01 Posted April 16, 2020 Posted April 16, 2020 Specifically, this isn't working because FileCopy and FileInstall expect either the full path to a file or a directory with a trailing backslash. If there isn't a trailing backslash, your directory looks like a file without an extension on the end. If you print any of the directory macros, you'll see that they don't contain a trailing backslash (a pet peeve of mine, but okay). All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
jgq85 Posted April 16, 2020 Author Posted April 16, 2020 14 hours ago, 1957classic said: I believe your source location is wrong but I know your destination is incomplete. I think it should be... FileInstall("ITScript.exe", @StartupCommonDir & "\ITScript.exe", 1) Or FileCopy("ITScript.exe", @StartupCommonDir & "\ITScript.exe", 1) Hi @1957classic, Thanks for the reply. I'm compiling the script to exe so does that mean I have to specify the path to the ITScript.exe on the machine I'm compiling from? So that it merges into the exe on the target system?
Nine Posted April 16, 2020 Posted April 16, 2020 Once compiled, you cannot use any variables in the source path. Read help file, it clearly states it. So if the location of the source file varies, you will need to adjust you script But you could use a map drive or something similar so you don't have to edit the script for every computer. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
jgq85 Posted April 16, 2020 Author Posted April 16, 2020 2 minutes ago, Nine said: Once compiled, you cannot use any variables in the source path. Read help file, it clearly states it. So if the location of the source file varies, you will need to adjust you script But you could use a map drive or something similar so you don't have to edit the script for every computer. On the help KB (https://www.autoitscript.com/autoit3/docs/functions/FileInstall.htm) the example is: FileInstall("C:\Test.bmp", @ScriptDir & "\Test.bmp") In my case isn't the Test.bmp my ITScript.exe ? Example uses C:\Test.bmp, not just "Test.bmp"
Nine Posted April 16, 2020 Posted April 16, 2020 Let me explain : 1) c:\test.bmp ==> is an absolute path (the file MUST be located inside c:\) 2) test.bmp ==> is a relative path to the script folder (it means, that the file MUST be at the same place as the script) 3) m:\test.bmp ==> where m: is a map drive that relates to any other computer/drive/network that contains the file you want. I suggest you use the 3rd solution where you can apply the same script to any computer in your environment. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
rudi Posted May 7, 2020 Posted May 7, 2020 One more point: What you are trying to do is to create a lot of independent copies of the exact same EXE file. Ooooghhh! I'd like to mention, that you place in the @StartupCommonDir a LNK to "one-file-on-a-network-share" for all computers. $WD="\\server\share\Path1\Path2" $EXE="ITscript.EXE" $LNK=@StartupCommonDir & "\" & StringTrimRight($EXE,3) & "LNK" FileCreateShortcut($WD & "\" & $EXE,$LNK,$WD,"","Description what this EXE is doing") Rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE!
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