sstanfie Posted September 26, 2006 Share Posted September 26, 2006 Hello. I'm attempting to launch the following shortcut (among other things) in my AutoIt script:C:\Documents and Settings\All Users\Start Menu\Programs\Gaim\Gaim.lnkThis is how I'm trying it:Run(@ComSpec & " /k " & @ProgramsCommonDir & "\Programs\Gaim\Gaim.lnk", "")I'm using /k instead of /c so I can see the error in the cmd window, which says 'C:\Documents' is not recognized as an internal or external command, operable program or batch file.This works fine:Run(@ComSpec & " /k " & '"C:\Documents and Settings\All Users\Start Menu\Programs\Gaim\Gaim.lnk"', "")but, I don't want to hardcode the path... I need to use the @ProgramsCommonDir marco. I know the above example works because the whole path (which has spaces) is enclosed in quotes.Also, I tried running the .lnk directly, without using @ComSpec, but it didn't work.I know the macro @ProgramsCommonDir resolves to C:\Documents and Settings\All Users\Start Menu\Programs, but it's apparently not enclosed in quotes, which is why I'm getting the error 'C:\Documents' is not recognized as an internal or external command, operable program or batch file.What is the best way for me to execute this shortcut? FYI - I have to run the shortcut, not the .exe that the shortcut points to, because it's an MSI advertised shortcut and there are HKCU entries that get created by running the advertised shortcut.Thanks in advance for your time,Scott Link to comment Share on other sites More sharing options...
Paulie Posted September 26, 2006 Share Posted September 26, 2006 Never tried with a .lnk file, but something like this? Run(@COMSPEC & " /c Start *Filename.lnk*", "", @SW_Maximize) Link to comment Share on other sites More sharing options...
sshrum Posted September 26, 2006 Share Posted September 26, 2006 (edited) Try this: Run(@ComSpec & " /c start " & @ProgramsCommonDir & "\Programs\Gaim\Gaim.lnk") Damn, Paulie beat me. Edited September 26, 2006 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
Xenobiologist Posted September 26, 2006 Share Posted September 26, 2006 Hi, Run(@ComSpec & ' /c gaim.lnk', @DesktopCommonDir, @SW_HIDE) So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
sstanfie Posted September 26, 2006 Author Share Posted September 26, 2006 Try this: Run(@ComSpec & " /c start " & @ProgramsCommonDir & "\Programs\Gaim\Gaim.lnk") Damn, Paulie beat me. With this, I get a window that pops up that says "Windows cannot find 'C:\Documents'. I think it's because C:\Documents and Settings\All Users\Start Menu\Programs (which is from @ProgramsCommonDir) is not in quotes. But, I can't put quotes around @ProgramsCommonDir because it'll be treated as literate text, instead of the macro. Thanks, Scott Link to comment Share on other sites More sharing options...
sstanfie Posted September 26, 2006 Author Share Posted September 26, 2006 Hi, Run(@ComSpec & ' /c gaim.lnk', @DesktopCommonDir, @SW_HIDE) So long, Mega This doesn't work either because the directory resolved by the marco has a space in it, and is not enclosed in quotes. Thanks, Scott Link to comment Share on other sites More sharing options...
sshrum Posted September 26, 2006 Share Posted September 26, 2006 Do this then: Run(@ComSpec & ' /c start "' & @ProgramsCommonDir & '\Programs\Gaim\Gaim.lnk"') Note the use of single and dbl-quotes. Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
sstanfie Posted September 26, 2006 Author Share Posted September 26, 2006 Do this then: Run(@ComSpec & ' /c start "' & @ProgramsCommonDir & '\Programs\Gaim\Gaim.lnk"') Note the use of single and dbl-quotes. Ah, I see how to do it now. That worked. Thank you very much for your help. Scott 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