Sign in to follow this  
Followers 0
ldub

(SOLVED) Shellexecute : problems with spaces in the path

4 posts in this topic

#1 ·  Posted (edited)

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



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

#3 ·  Posted (edited)

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

#4 ·  Posted (edited)

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  
Followers 0