07-27-2018 05:25 AM
Hi
I am developing a script on Diadem 2017 on windows 10 (google cloud vm)
This works perfectly if I run it on my laptop (windows 7) within diadem
dim commandfile:commandfile="C:\Diadem\" & filenamesrc & ".bat"
dim command:command="gsutil -m -q cp """ & gspath & """ C:\FilesToProcess"
WshShell.run(commandfile)
However on Windows 10
I get a message saying it cant find the file (gsutil) (for both exec and run)
If I run it direct from command shell it works
Any ideas
07-30-2018 02:09 AM - edited 07-30-2018 02:13 AM
Hey redtux,
Just to be sure: Your script has a command like "set WshShell = CreateObject ("WScript.Shell")" in it, right? (Would give a different error message if not, but...)
Try this first:
Option Explicit
dim shell
set shell = CreateObject("Wscript.Shell")
shell.run("notepad")
Does it successfully open notepad?
If so, I believe there might be something wrong in your system's environment variable PATH definition. I assume ghostscript(?) might be included in your user's PATH but not in the system one it perhaps uses when executing from DIAdem? Check "Control Panel»System»Advanced System Settings»Environment Variables" and then search for path both in "User variables" and "System variables". It should have your installation path of "gsutil" in there, e.g. "c:\program files\gs\".
07-30-2018 04:18 AM
gspath is the path to a file on gcloud eg: gs://googlebucket/Vehicle 301169/301169/406197/DTC_Read 2018-07-27 13-11-08-242874 Partition 0.dat
(and not ghostscript)
The issue is that diadem isn't seeing the path for some reason
path is C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Google\Compute Engine\sysprep\;C:\Program Files\Google\Compute Engine\metadata_scripts\;C:\Program Files\Puppet Labs\Puppet\bin;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin
If I run it as "cmd /c gsutil -m -q cp """ & gspath & """ C:\FilesToProcess"
It works, though that has the issue of return values and process control
Mike
07-30-2018 04:43 AM
Further investigation
It doesnt seem to accept any non-gui or non-interactive command
eg : "dir C:\FilesToProcess"
has the same error
07-31-2018 07:04 AM
@redtux wrote:eg : "dir C:\FilesToProcess"
has the same error
If you tried to execute this with "WScript.shell.run("dir c:\")", then I can explain the behavior you saw:
"dir" originally was a DOS-command, that was directly built into DOS' command interpreter command.com (similar to Unix' bash). It never was a specific program executed, but a command directly interpreted in command.com. See the second paragraph in List of DOS commands for more information. Nowadays, it is implemented in cmd.exe.
When you run "WScript.shell.run("dir c:\")", Windows' service wscript.exe searches for an executable file like dir.exe, dir.cmd, or dir.bat, and won't find one. Run "WScript.shell.run("cmd /c dir c:\")" instead, and it will work.
07-31-2018 07:28 AM
@redtux wrote:
gspath is the path to a file on gcloud eg: gs://googlebucket/Vehicle 301169/301169/406197/DTC_Read 2018-07-27 13-11-08-242874 Partition 0.dat
(and not ghostscript)
The issue is that diadem isn't seeing the path for some reason
path
Oh, I didn't know that. Ok, do you know which path exactly isn't seen? Is it that WScript cannot find the path gsutil.exe is in or is it that gsutil cannot see the gs:// path?
I assume that gsutil.exe is in C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin, therefore the former should work.
To test it, you can probably run "gsutil test -u" or "gsutil version".
If it is that gsutil cannot resolve gs:// paths when running in the WScript context, then this might be because of the approach they used to implemented gs:// protocol support in Windows. However, I cannot believe it shall not work in this context, as we are talking about modern software.
@redtux wrote:
If I run it as "cmd /c gsutil -m -q cp """ & gspath & """ C:\FilesToProcess"
It works, though that has the issue of return values and process control
Have you tried using WScript.Shell.Exec instead of .Run? Normaly this gives you access to the output stream.
This works for me in DIAdem:
Option Explicit dim shell set shell = CreateObject("Wscript.Shell") dim r set r = shell.exec("cmd /c dir c:\") do while r.status = 0 '0: still running call pause(0.1) loop if r.status=1 then '1: finished msgbox r.stdout.readall end if
08-06-2018 04:17 AM
Option Explicit dim wsh : set wsh = CreateObject( "WScript.Shell" ) LogFileWrite wsh.ExpandEnvironmentStrings( "%PATH%" )
is the path the same in DIAdem?
08-08-2018 04:50 AM
yep, exactly the same
08-15-2018 05:11 AM
I checked with on my windows 10 machine but it seems to work fine with an additional path.
If you call
where gsutil
in cmd does it return the path to the exe?
Does it work if you use a fullpath?