Jump to content

Multiple Command Issue - Cannot Find Specified Path


ct253704
 Share

Recommended Posts

I'm having some issues converting a batch file to be used in a script of mine. The batch file was pulled from Stack Overflow with small modifications and works by itself, but when I convert to AutoIT it gets about halfway through and then gives the error "Cannot find the path specified". All it does is set the firefox homepage, though i'd like to expand the settings altered in the prefs.js file if I can get this to work.

Batch File:

cd /D "%APPDATA%\Mozilla\Firefox\Profiles"
cd *.default*
set ffile=%cd%
cd %ffile%
echo user_pref("browser.startup.homepage", "https://www.google.com");>>"%ffile%\prefs.js"
set ffile=
cd %windir%

AutoIT Code

RunWait(@ComSpec & ' /k ' & 'cd /D "%APPDATA%\Mozilla\Firefox\Profiles"&&cd *.default*&&set ffile=%cd%&&cd %ffile%&&echo user_pref("browser.startup.homepage", "https://www.google.com");>>"%ffile%\prefs.js"&&set ffile=&&cd %windir%')

Also to note the batch file doesn't work if each line is ran individually via command prompt. Maybe I should change one of the && in the code?

Link to comment
Share on other sites

I made this.

 

Local $sprefsPath=_FireFoxprefsPath()
Local $sString='user_pref("browser.startup.homepage", "https://www.google.com");'
FileWriteLine($sprefsPath, @Crlf & $sString)
Func _FireFoxprefsPath()
    Local $sPath = @AppDataDir & "\Mozilla\Firefox\"
    Return ($sPath & IniRead($sPath & "profiles.ini", "Profile0", "Path", "") & "\" & "prefs.js")
EndFunc

Saludos

Edited by Danyfirex
Link to comment
Share on other sites

just for wirting in next line. look help file or do a google search.

Saludos

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...