Windows Script Host

Posted: 07-21-2003, 09:08 PM
Would anyone know why this sample code does not work
properly under XP. It seems that the spaces in the path
name are not interpreted correctly.
I need to use the full path because I have two versions of
Office on my computer.

Thanks for any suggestion.
**************************************************
<job id="Test">
<script language="Vbscript">

dim WshShell, AcPath
dim Return

'The following gives a file not found
'AcPath = "C:\Program files\Microsoft office\office\"

'The following displays the folder content
AcPath = """C:\Program files\Microsoft office\office\"""

'The following opens the default version of Access
'AcPath = ""

msgbox AcPath

set WshShell = Wscript.CreateObject("WScript.Shell")

Return = WshShell.run (AcPath & "msaccess.exe",1,true)


MSGBOX "The End"

</script>
</job>
Reply With Quote

Responses to "Windows Script Host"

David Jones
Guest
Posts: n/a
 
Windows Script Host
Posted: 07-21-2003, 10:08 PM
Use the following:

'Since you're adding stuff, you only want the beginning
quote.
AcPath = """C:\Program files\Microsoft office\office\"
'Append the filename you want so you have it all in one
variable, rather than messing around with the command line
'Since this is the end of the real path, quote the end
AcPath = AcPath + "msaccess.exe"""
set WshShell = Wscript.CreateObject("WScript.Shell")
Return = WshShell.Run (AcPath,1,true)
>-----Original Message-----
>Would anyone know why this sample code does not work
>properly under XP. It seems that the spaces in the path
>name are not interpreted correctly.
>I need to use the full path because I have two versions
of
>Office on my computer.
>
>Thanks for any suggestion.
>************************************************* *
><job id="Test">
><script language="Vbscript">
>
>dim WshShell, AcPath
>dim Return
>
>'The following gives a file not found
>'AcPath = "C:\Program files\Microsoft office\office\"
>
>'The following displays the folder content
>AcPath = """C:\Program files\Microsoft office\office\"""
>
>'The following opens the default version of Access
>'AcPath = ""
>
>msgbox AcPath
>
>set WshShell = Wscript.CreateObject("WScript.Shell")
>
>Return = WshShell.run (AcPath & "msaccess.exe",1,true)
>
>
>MSGBOX "The End"
>
></script>
></job>
>.
>
Reply With Quote
antoni
Guest
Posts: n/a
 
Windows Script Host
Posted: 07-22-2003, 02:01 PM
A thousand thanks. It works fine.
I can now continue on my project.
>-----Original Message-----
>Use the following:
>
>'Since you're adding stuff, you only want the beginning
>quote.
>AcPath = """C:\Program files\Microsoft office\office\"
>'Append the filename you want so you have it all in one
>variable, rather than messing around with the command line
>'Since this is the end of the real path, quote the end
>AcPath = AcPath + "msaccess.exe"""
>set WshShell = Wscript.CreateObject("WScript.Shell")
>Return = WshShell.Run (AcPath,1,true)
>
>>-----Original Message-----
>>Would anyone know why this sample code does not work
>>properly under XP. It seems that the spaces in the path
>>name are not interpreted correctly.
>>I need to use the full path because I have two versions
>of
>>Office on my computer.
>>
>>Thanks for any suggestion.
>>************************************************ **
>><job id="Test">
>><script language="Vbscript">
>>
>>dim WshShell, AcPath
>>dim Return
>>
>>'The following gives a file not found
>>'AcPath = "C:\Program files\Microsoft office\office\"
>>
>>'The following displays the folder content
>>AcPath = """C:\Program files\Microsoft office\office\"""
>>
>>'The following opens the default version of Access
>>'AcPath = ""
>>
>>msgbox AcPath
>>
>>set WshShell = Wscript.CreateObject("WScript.Shell")
>>
>>Return = WshShell.run (AcPath & "msaccess.exe",1,true)
>>
>>
>>MSGBOX "The End"
>>
>></script>
>></job>
>>.
>>
>.
>
Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script Error problem with windows xp sp2 Joey451 Windows XP WMI 0 10-26-2007 10:52 PM
Error-Windows Script 5.6 install Paul P Windows XP Device Drivers 0 09-20-2003 05:44 PM
Windows Script Host Howard Smith Windows XP Embedded 2 08-04-2003 12:17 PM
script errors in windows xp tori Windows XP Printers / Scanners / Fax 0 07-21-2003 08:11 PM
Windows Script Host 5.6 antoni Windows XP 4 07-12-2003 02:32 AM


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90