MikeC Posted January 3, 2017 Share Posted January 3, 2017 Hi I am trying to run the following commands and after literally hours of google searches over multiple days, I cannot get them to run. if not exist %WinDir%\System32\Macromed\Flash\ md %WinDir%\System32\Macromed\Flash\ if not exist %WinDir%\SysWow64\Macromed\Flash\ md %WinDir%\SysWow64\Macromed\Flash\ echo AutoUpdateDisable=1 >%WinDir%\System32\Macromed\Flash\mms.cfg echo AutoUpdateDisable=1 >%WinDir%\SysWow64\Macromed\Flash\mms.cfg For example, this returns a zero, but does not run the required command: Run(@ComSpec & " /c " & 'if not exist %WinDir%\System32\Macromed\Flash\ md %WinDir%\System32\Macromed\Flash\', @SW_HIDE) Please can someone help me out? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 3, 2017 Moderators Share Posted January 3, 2017 @MikeC I would suggest just doing what you want to do in AutoIt, rather than trying to do it in a batch file and then run the batch through AutoIt; save yourself a lot of headache. The syntax is very similar (below): If Not (FileExists(@WindowsDir & "\System32\Macromed\Flash\")) Then DirCreate(@WindowsDir & "\System32\Macromed\Flash\") You can then use AutoIt to modify the mms.cfg to add your AutoUpdateDisable. MikeC 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Subz Posted January 3, 2017 Share Posted January 3, 2017 Here is the code I used for packaging Adobe Flash config Opt('ExpandVarStrings', 1) FNC_FLASHCFG() Func FNC_FLASHCFG() Local $hCFG_AdobeFlash = '@WindowsDir@\System32\macromed\Flash\mms.cfg' Local $hOPN_AdobeFlash = FileOpen($hCFG_AdobeFlash, 138) FileWrite($hOPN_AdobeFlash, 'AutoUpdateDisable=1' & @CRLF) If @OSVersion = 'WIN_XP' Then FileWrite($hOPN_AdobeFlash, 'AutoUpdateInterval=0' & @CRLF) FileClose($hOPN_AdobeFlash) EndFunc Link to comment Share on other sites More sharing options...
MikeC Posted January 3, 2017 Author Share Posted January 3, 2017 1 hour ago, JLogan3o13 said: @MikeC I would suggest just doing what you want to do in AutoIt, rather than trying to do it in a batch file and then run the batch through AutoIt; save yourself a lot of headache. The syntax is very similar (below): If Not (FileExists(@WindowsDir & "\System32\Macromed\Flash\")) Then DirCreate(@WindowsDir & "\System32\Macromed\Flash\") You can then use AutoIt to modify the mms.cfg to add your AutoUpdateDisable. Error: "If" statement has no matching "EndIf" statement Link to comment Share on other sites More sharing options...
MikeC Posted January 3, 2017 Author Share Posted January 3, 2017 53 minutes ago, Subz said: Here is the code I used for packaging Adobe Flash config Opt('ExpandVarStrings', 1) FNC_FLASHCFG() Func FNC_FLASHCFG() Local $hCFG_AdobeFlash = '@WindowsDir@\System32\macromed\Flash\mms.cfg' Local $hOPN_AdobeFlash = FileOpen($hCFG_AdobeFlash, 138) FileWrite($hOPN_AdobeFlash, 'AutoUpdateDisable=1' & @CRLF) If @OSVersion = 'WIN_XP' Then FileWrite($hOPN_AdobeFlash, 'AutoUpdateInterval=0' & @CRLF) FileClose($hOPN_AdobeFlash) EndFunc Thanks. I have no knowledge or experience of functions in AIT; What does line 1 do exactly? What does line 2 do? I can see that you define the function in line 3, does 2 simply execute it? Link to comment Share on other sites More sharing options...
Subz Posted January 3, 2017 Share Posted January 3, 2017 ;~ Expands Variables within a string for example: ;~ '@WindowsDir@\...' = 'C:\Windows\...' Opt('ExpandVarStrings', 1) ;~ Runs the function FNC_FLASHCFG() ;~ Declares the function Func FNC_FLASHCFG() ;~ Adobe Flash configuration path Local $hCFG_AdobeFlash = '@WindowsDir@\System32\macromed\Flash\mms.cfg' ;~ Opens '@WindowsDir@\System32\macromed\Flash\mms.cfg' for writing ;~ Flag: 138 ;~ : 128 Use Unicode UTF8 (with BOM) (Adobe requirement) ;~ : 8 Create directory structure if it doesn't exist ;~ : 2 Write mode (overwrite previous contents) Local $hOPN_AdobeFlash = FileOpen($hCFG_AdobeFlash, 138) ;~ Write AutoUpdateDisable=1 to the file FileWrite($hOPN_AdobeFlash, 'AutoUpdateDisable=1' & @CRLF) ;~ If Windows XP Write AutoUpdateInerval=0 to the file If @OSVersion = 'WIN_XP' Then FileWrite($hOPN_AdobeFlash, 'AutoUpdateInterval=0' & @CRLF) ;~ Close/Save the file FileClose($hOPN_AdobeFlash) EndFunc Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 3, 2017 Moderators Share Posted January 3, 2017 25 minutes ago, MikeC said: Error: "If" statement has no matching "EndIf" statement It seems you have something to work with using Subz' code. But to clarify, a single line If statement should not throw an error without an "EndIf". Did you try it exactly as written? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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