Jump to content
Sign in to follow this  
ldub

(SOLVED) Shellexecute : problems with spaces in the path

Recommended Posts

ldub

I run without problem a MS Access application like this :

; $param is the mdb file to be loaded

$param = "D:\ACCESS\Test.mdb"

ShellExecute("MSACCESS.EXE", $param)

But, if my path (in $param) contains spaces, it doesn't word :

$param = "D:\ACCESS - PRG\Test.mdb"

ShellExecute("MSACCESS.EXE", $param)

Why ? How can I do ?

This problem doesn't occurs with Notepad...

Thanks for your help.

Edited by ldub

Share this post


Link to post
Share on other sites
Andreik

I run without problem a MS Access application like this :

; $param is the mdb file to be loaded

$param = "D:\ACCESS\Test.mdb"

ShellExecute("MSACCESS.EXE", $param)

But, if my path (in $param) contains spaces, it doesn't word :

$param = "D:\ACCESS - PRG\Test.mdb"

ShellExecute("MSACCESS.EXE", $param)

Why ? How can I do ?

This problem doesn't occurs with Notepad...

Thanks for your help.

Try full path for MSAcces.exe or I think is enough
ShellExecute("D:\ACCESS\Test.mdb")

When the words fail... music speaks

Share this post


Link to post
Share on other sites
ldub

Try full path for MSAcces.exe or I think is enough

ShellExecute("D:\ACCESS\Test.mdb")
Thanks for your help but I get always the same error.

In fact, my exact command line is :

$param = "D:\ACCESS - PRG ACTIFS\TestExtractPhotos.mdb /CMD" & '"' & @WorkingDir & '"'

ShellExecute("C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE", $param)

The problem occurs when MSAccess is loaded, it tells me "bad options" and "D:\ACCESS.mdb doesn't exist"

The problem exists ONLY if my path contains spaces.

Edited by ldub

Share this post


Link to post
Share on other sites
ldub

Thanks for your help but I get always the same error.

In fact, my exact command line is :

$param = "D:\ACCESS - PRG ACTIFS\TestExtractPhotos.mdb /CMD" & '"' & @WorkingDir & '"'

ShellExecute("C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE", $param)

The problem occurs when MSAccess is loaded, it tells me "bad options" and "D:\ACCESS.mdb doesn't exist"

The problem exists ONLY if my path contains spaces.

************************************************************

************************************************************

Finally, I found by myself the solution on the forum of VbScript (they have the same problems whith path containing spaces).

$Myparam1 = "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE "

$MyParam2 = 'D:\ACCESS - PRG ACTIFS\TestExtractPhotos.mdb'

$MyParam3 = ' /CMD' & '"' & @WorkingDir & '"'

ShellExecute($MyParam1, Chr(34) & $MyParam2 & Chr(34) & $MyParam3)

*************************************************************

*************************************************************

Edited by ldub

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.