Jump to content

Run Command -Working Directory

Recommended Posts

Kinda a newbee to this, I am trying to call a program from an ini file. I can't seem to call just

Run('"' & $gamelaunch & '"') as the programs path seems to be screewed up. So i am trying to work with the working directory.

ini looks like this





GameImage=\\turningpoint\images$\Backyard Football 2006 - Everyone\Backyard Football 2006.iso

GameLaunch=C:\Games\Backyard Football 2006\BYFB2006.exe

GamePath=C:\Games\Backyard Football 2006\

The part of the script I am having problems with is this

$inigameinfo = IniReadSection($inifile,$s_text)

if @error Then

MsgBox(4096,"","An Error occured, can't find game in ini file.")


$isopath = $inigameinfo[2][1]

$gamelaunch = $inigameinfo[3][1]

$gamepath = $inigameinfo[4][1]

run('"C:\Program Files\Daemon Tools\daemon.exe" -unmount 0')


run('"c:\program files\Daemon Tools\daemon.exe" -mount 0,"' & $isopath &'"')

GUICtrlSetData($Status,"Mounting Image")


;msgbox(0,"debug",'"' & $gamepath & '"') ****** This shows the right path

;run('"' & $gamelaunch & '"', "C:\Games\Backyard Football 2006\") ***** This works

run('"' & $gamelaunch & '", "' & $gamepath & '"') ****** This does not



On the run that is dynamic, I get "The Directory Name is invalid", Not sure why

I also tried

Run(AddQuote($gamelaunch), AddQuote($gamepath))

Func AddQuote ($sStr)

If StringLeft($sStr,1) <> chr(34) then $sStr = chr(34) & $sStr

If StringRight($sStr,1) <> chr(34) then $sStr = $sStr & chr(34)



With no luck. What am I doing wrong?

Link to post
Share on other sites

run('"' & $gamelaunch & '", "' & $gamepath & '"')

I don't know why you need the extra quotes...(although i dont think it should matter)


run($gamelaunch, $gamepath)

just for kicks...

Tried that, same thing, I am using the extra quotes, because the spaces in the path. Where if I where to hard code it it would be "C:\Games\Backyard Football 2006\".
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...