Working method to call external script on 64-bit Windows

ullerdkullerdk Member Posts: 16
Hi everybody.
Does anybody know a working method to call/execute a external script on a Windows 64-bit computer? The normal Wshell command doesn't seem to work.
Regards
Ulrik

Comments

  • FDickschatFDickschat Member Posts: 380
    I just tried WSHShell.Run and WSHShell.Popup on Server 2003, 64Bit and both work.
    What exactly is your problem? Maybe it is not a question of 64 Bit but of the OS version?
    Frank Dickschat
    FD Consulting
  • ullerdkullerdk Member Posts: 16
    I am not a programmer myself, but I can see that the command Wshell.Run that the programmer has used to call the external script, isn't valid and understood by the DOS shell on a Windows 7 64-bit. I tried on Windows 7 32-bit, there it works fine.
    Which automation did you use?
  • FDickschatFDickschat Member Posts: 380
    The Automation is 'Windows Script Host Object Model'.WshShell. We typically use Run, Popup and the Registry functions.

    As you stated in your case it is a windows 7, 64Bit problem. It seems not to be a general 64Bit problem as there is no problem here with Server2003 64Bit.

    http://en.wikipedia.org/wiki/Windows_Script_Host lists Windows 7 with WSH 5.7 so it should exist on your OS. Maybe it is deactivated. Google how to lookup whether that is the case.
    Frank Dickschat
    FD Consulting
  • ullerdkullerdk Member Posts: 16
    FDickschat wrote:
    The Automation is 'Windows Script Host Object Model'.WshShell. We typically use Run, Popup and the Registry functions.

    As you stated in your case it is a windows 7, 64Bit problem. It seems not to be a general 64Bit problem as there is no problem here with Server2003 64Bit.

    OK, have you tested now yourself on a 64-bit Windows 7 and it didn't work?
  • FDickschatFDickschat Member Posts: 380
    No, I have here only several W7 32Bit Computers available. Maybe you should change the topic so that someone who reads this thread knows what you are looking for.
    Frank Dickschat
    FD Consulting
  • ullerdkullerdk Member Posts: 16
    Is it possible to specify which version (32/64 bit) of WSH to use in the code? Fx. C:\Windows\SysWow64\wscript.exe for the 32-bit WSH on a Windows 64-bit edition ?
  • ullerdkullerdk Member Posts: 16
    Well, what I want to accomplish here, is to send a lpr.exe command to a printer.
    Right now it works on a 32-bit Windows, by calling a cmd-file containing the lpr command.
    When trying on a 64-bit Windows, what happens is, that a 32-bit command shell is opened and since the lpr.exe does not exist as a 32-bit file in either c:\windows\system32 or c:\windows\syswow32, the file is not found. Even a "dir lpr*" command in a 32-bit command prompt does NOT list the lpr.exe file. So 64-bit files are not seen by a 32-bit command shell.
    So now I ask: is it possible to execute a 64-bit command shell from the 32-bit Dynamics NAV application and of course still maintain full compability with the same function on a 32-bit Windows computer?
  • FDickschatFDickschat Member Posts: 380
    5 Minutes Googling and it seems you are not the only one:

    If you can not find lpr.exe at all on your machine you will need to reinstall it. It should be in %windir%\system32.
    In a newsgroup I found this (in german): http://www.ureader.de/msg/12428182.aspx
    Frank Dickschat
    FD Consulting
  • ullerdkullerdk Member Posts: 16
    Hi Frank.
    I have already added the LPR print function through "Windows components", but as I tried to explain in my former post, LPR.exe is a 64-bit DOS application, which is NOT accessible in a 32-bit command prompt (c:\windows\syswow64\cmd.exe).

    You can try this on a Windows 7 64-bit computer:

    1. Install LPR print feature through the "Windows components"
    2. Start c:\windows\syswow64\cmd.exe, which is the 32-bit command prompt
    3. Execute the command "dir c:\windows\system32\lpr*" which will show no files.
    4. Exit the command prompt
    5. Start the normal 64-bit command prompt (through start/accessories)
    6. Execute the command "dir c:\windows\system32\lpr*" which will now show lpr.exe file

    LPR.exe only exists in c:\windows\system32\ as a 64-bit file, and when calling external scripts from Dynamics NAV, it is obviously the 32-bit command prompt that is started, since Dynamics NAV is a 32-bit application.
  • FDickschatFDickschat Member Posts: 380
    Would it be possible to copy the old 32 bit lpr.exe from an xp machine? Will that work under W7?
    Frank Dickschat
    FD Consulting
  • ullerdkullerdk Member Posts: 16
    FDickschat wrote:
    Would it be possible to copy the old 32 bit lpr.exe from an xp machine? Will that work under W7?

    Great idea. I will try to copy lpr.exe from a 32-bit Windows 7 to the c:\windows\syswow64 folder on the Windows 7 64-bit computer.
  • ullerdkullerdk Member Posts: 16
    ullerdk wrote:
    FDickschat wrote:
    Would it be possible to copy the old 32 bit lpr.exe from an xp machine? Will that work under W7?

    Great idea. I will try to copy lpr.exe from a 32-bit Windows 7 to the c:\windows\syswow64 folder on the Windows 7 64-bit computer.

    YES, it worked! Thanks for the suggestion.
Sign In or Register to comment.