Sign in to follow this  
Followers 0
jgshier

Run Command -Working Directory

4 posts in this topic

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

[games]

games=FootBall

[FootBall]

Type=Image

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.")

Else

$isopath = $inigameinfo[2][1]

$gamelaunch = $inigameinfo[3][1]

$gamepath = $inigameinfo[4][1]

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

sleep(2000)

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

GUICtrlSetData($Status,"Mounting Image")

sleep(5000)

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

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

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

GUICtrlSetData($Status,"Done")

Endif

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)

Return($sStr)

Endfunc

With no luck. What am I doing wrong?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

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

Try

run($gamelaunch, $gamepath)

just for kicks...

Edited by evilertoaster

Share this post


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)

Try

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\".

Share this post


Link to post
Share on other sites

Got it to work,

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

It's like the working directory does not need the quotes. :D

Share this post


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
Sign in to follow this  
Followers 0