vbscript fails to start windows application

M

Magnus

Hope someone can help me on this one..

I am trying to execute some applications from within vbscript using
wscript.shell "run" function. What happens is that the script executes
without any errors or warnings, one of the application (battlefield1942) im
trying to start even generates a pid file as it normally does when started
up "manually". Another application however, starts as expected, so it seems
almost random from my angle. The application I can't seem to start is Aida32
and Battlefield1942. I have tried executing notepad in vbscript, and that
works fine, also another application that starts fine is the game
"Blitzkrieg". The thing is that the same script that fails to start aida32
under windowsxp, is the very same script that successfully starts aida32
under windows 2000. So it definitively seems to be related to Windows XP
somehow, the question is how ??

' The script lines im currently using, which also fails
Set sh = CreateObject("Wscript.Shell")
sh.run "start D:\Games\bf1942\BF1942.exe"
Set sh = nothing

- Magnus
 
R

Ray at

Drop "start" from your command. Start is not an executable or a file. It's
a command within the cmd command interpreter. Or, if you want to use start
(shouldn't be necessary), use "cmd.exe /c start D:\..\..2.exe"
 
M

Magnus

"Ray at <%=sLocation%> [MVP]" <Too many private support requests - Ask for
it if needed> skrev i melding
Drop "start" from your command. Start is not an executable or a file. It's
a command within the cmd command interpreter. Or, if you want to use start
(shouldn't be necessary), use "cmd.exe /c start D:\..\..2.exe"

Sorry, my bad.
That is _without_ the start, the one I posted here is bound to fail, and not
my initial problem. It was just while experimenting I did this.

So the corrected will be, still fails to fully start the application:

Set sh = CreateObject("Wscript.Shell")
sh.run "D:\Games\bf1942\BF1942.exe"
Set sh = nothing

- Magnus
 
M

Magnus

Magnus said:
Hope someone can help me on this one..

I am trying to execute some applications from within vbscript using
wscript.shell "run" function. What happens is that the script executes
without any errors or warnings, one of the application (battlefield1942) im
trying to start even generates a pid file as it normally does when started
up "manually". Another application however, starts as expected, so it seems
almost random from my angle. The application I can't seem to start is Aida32
and Battlefield1942. I have tried executing notepad in vbscript, and that
works fine, also another application that starts fine is the game
"Blitzkrieg". The thing is that the same script that fails to start aida32
under windowsxp, is the very same script that successfully starts aida32
under windows 2000. So it definitively seems to be related to Windows XP
somehow, the question is how ??

' The script lines im currently using, which also fails
Set sh = CreateObject("Wscript.Shell")
sh.run "start D:\Games\bf1942\BF1942.exe"
Set sh = nothing

- Magnus

Correction..

Script applicable to my problem is this one, and not the one in the previous
post:

Set sh = CreateObject("Wscript.Shell")
sh.run "D:\Games\bf1942\BF1942.exe"
Set sh = nothing

On a further note, should there be any doubt, using the path above in
start/run works.

- Magnus
 
R

Ray at

Ah, alright. So, then, what, nothing happens at all? Do you have antivirus
software installed with script-blocking enabled? And you're sure those
lines are executing?

msgbox "About to create"
Set sh = CreateObject("Wscript.Shell")
msgbox "Created? Vartype is " & VarType(sh)
sh.run "D:\Games\bf1942\BF1942.exe"
msgbox "Should have run."
Set sh = nothing
msgbox "sh is now nothing"

--

Ray at home
Microsoft ASP MVP
 
M

Magnus

Ray at said:
Ah, alright. So, then, what, nothing happens at all? Do you have antivirus
software installed with script-blocking enabled? And you're sure those
lines are executing?

msgbox "About to create"
Set sh = CreateObject("Wscript.Shell")
msgbox "Created? Vartype is " & VarType(sh)
sh.run "D:\Games\bf1942\BF1942.exe"
msgbox "Should have run."
Set sh = nothing
msgbox "sh is now nothing"

Yes it runs perfectly, the script that is. But the application does not
start fully.

Script says "Vartype is 9", and goes all the way, ends with the "sh is now
nothing", no complaints. And no, I do not have any sort of antivirus
software installed on this computer, no script blocking with that.

I have the same problem on work where we have vbscript to start Aida32, only
the windows xp machine have this problem.

My XP system is up to date.

- Magnus
 
D

Dave Patrick

You might check Task Manager|Processes to be sure it isn't running and just
not visible.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]
Microsoft Certified Professional [Windows 2000]
http://www.microsoft.com/protect


:
|
| Yes it runs perfectly, the script that is. But the application does not
| start fully.
|
| Script says "Vartype is 9", and goes all the way, ends with the "sh is now
| nothing", no complaints. And no, I do not have any sort of antivirus
| software installed on this computer, no script blocking with that.
|
| I have the same problem on work where we have vbscript to start Aida32,
only
| the windows xp machine have this problem.
|
| My XP system is up to date.
|
| - Magnus
|
|
 
M

Magnus

Dave Patrick said:
You might check Task Manager|Processes to be sure it isn't running and just
not visible.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]
Microsoft Certified Professional [Windows 2000]
http://www.microsoft.com/protect

Sorry I haven't provided highly relevant information as you request, but I
have confirmed this, and it is not running.

- Magnus
 
M

Magnus

Magnus said:
Sorry I haven't provided highly relevant information as you request, but I
have confirmed this, and it is not running.

- Magnus

Small update.. think the solution might be near or impossible for all I
know, in vbscript anyway.

But it seems to relate to how the application im trying to start up actually
works.

I have tried the similar in a .cmd/.bat script, and it seems to only accept
the following.

@echo off
echo Starting battlefield1942
d:
cd Games\bf1942\
BF1942.exe
echo Done...
pause

As you can see I have to cd to the directory before I run the executable.

- Magnus
 
D

Dave Patrick

You might try adding the dir where BF1942.exe exists to the system path
statement.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]
Microsoft Certified Professional [Windows 2000]
http://www.microsoft.com/protect


| Small update.. think the solution might be near or impossible for all I
| know, in vbscript anyway.
|
| But it seems to relate to how the application im trying to start up
actually
| works.
|
| I have tried the similar in a .cmd/.bat script, and it seems to only
accept
| the following.
|
| @echo off
| echo Starting battlefield1942
| d:
| cd Games\bf1942\
| BF1942.exe
| echo Done...
| pause
|
| As you can see I have to cd to the directory before I run the executable.
|
| - Magnus
|
|
 
M

Magnus

Dave Patrick said:
You might try adding the dir where BF1942.exe exists to the system path
statement.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]
Microsoft Certified Professional [Windows 2000]
http://www.microsoft.com/protect

Lo and behold, I have the solution.. :)

No need, as I suspected, it has to do with the "current directory". And
found out I can change that in vbscript.

The solution:
Set sh = CreateObject("Wscript.Shell")
sh.CurrentDirectory = "D:\Games\bf1942\"
sh.run("BF1942.exe")
Set sh = nothing

Strange though, that I experience this issue only on XP machines together
with these particular applications. No hassle in Windows 2000.

Thanks anyway

- Magnus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top