Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1  
Old 10-09-2013, 09:50 AM
makotech222 makotech222 is online now
Registered User
 
Join Date: 10-01-2013
Posts: 2
Can't use Wscript.Shell when moved to Win7 x64

Hello, I have a problem with this script i have ported.

We recently updated from winxp x32 to win7 x64, and my vbscript command is having problems running cmd commands. If i manually copy and paste the command, it works fine in cmd, but if i run it through vbscript wshell, it fails.

I'm using VB 7.7a, do i need to upgrade? Thats the only thing i can think of that might cause it.

Here's what a snip of the code looks like:
Code:
Function ExecuteCommand(command)

	Dim oShell
	Set oShell = WScript.CreateObject("WSCript.shell")

	Builder.LogMessage "Executing command: " & command
	Builder.LogMessage "---------------------------------"
    Set result = oShell.Exec(command)
 
	Builder.LogMessage "---Console Output:"
	
		With result
	   Do While .Status = 0 
	      WScript.Sleep 10 
	      Do While Not .StdOut.AtEndOfStream 
	         Builder.LogMessage "| " & .StdOut.ReadLine
	      Loop
	   Loop 
	End With
	Builder.LogMessage "---------------------------------"
 
End Function
Reply With Quote
  #2  
Old 10-09-2013, 10:06 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Without more information I can only guess, but it's probably a 32- vs 64-bit difference.
http://www.kinook.com/VisBuildPro/Manual/6432bit.htm

Visual Build v7 is a 32-bit application, so to compare with running outside of Visual Build, you would need to run the 32-bit cmd.exe or wscript.exe/cscript.exe (in C:\Windows\SysWOW64).

If that doesn't help, please send the information requested at http://www.kinook.com/Forum/showthread.php?t=3044.
Reply With Quote
  #3  
Old 10-09-2013, 10:11 AM
makotech222 makotech222 is online now
Registered User
 
Join Date: 10-01-2013
Posts: 2
I'm very new with VBscript, and the guy who wrote this has left. I'm not sure exactly whats happening when Wscript.shell is being created. Can i specify the location of Wscript.exe?

I've already tried specifiying the location of cmd.exe to both the x64 and x32 versions, to no avail.


One other thought, i was thinking its possibly related to administrative privileges. Even thought on my machine, UAC is set to none, and i'm on the admin account. Could that still be causing problems on Visual Build?

Last edited by makotech222; 10-09-2013 at 10:18 AM.
Reply With Quote
  #4  
Old 10-09-2013, 11:31 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
WScript.Shell is an object available in script code (provided by Microsoft).
http://msdn.microsoft.com/en-us/libr...=vs.84%29.aspx

There's also a wscript.exe and cscript.exe (again, from Microsoft) for invoking scripts from a command-line.
https://support.microsoft.com/kb/232211

WScript.Shell is not even needed in Visual Build to run a program. You can use a Run Program action or a Builder.RunProgramEx call (from script code).
http://www.kinook.com/VisBuildPro/Ma...gramaction.htm
http://www.kinook.com/VisBuildPro/Ma...amexmethod.htm

As to the actual problem, I still don't know what it is so can only guess. A privilege issue is one possibility. At any rate, it sounds like a Windows issue, not a Visual Build problem per se.
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 11:00 AM.


Copyright © 1999-2023 Kinook Software, Inc.