locked
cannot pass a parameter running Dos in Windows7 RRS feed

  • Question

  • I am trying to run a .exe file in dos passing a parameter.  If give me a system error  ERROR NUMBER 2, Error txt= NULL OBJECT Reference.  If I click on start / run and run "d:/sap.exe wdw" from here, it runs.  So it seems it will not run a .cmd or .bat files with a parameter.  It gives the same error everything.  Is there some way to qualify the parameter of "wdw"?  I tried quotes and that did not work
    Nick Imorde
    Monday, July 25, 2011 1:58 PM

All replies

  • Happy, taking a guess that you are running SAP? I would suggest you contact the SAP forums, I have seen many many folks trying to dump data from a SAP system to a txt file and then parse the information.  Which is one of the more common things SAP folks need to end up doing for integrations and monitoring if they are not using integration engines like BizTalk.
    -- :P Advice offered, If you need more help it is advised to seek the council and advice of paid professionals. The answer is always 42, or reboot.
    • Proposed as answer by Jason Hiegel Tuesday, July 26, 2011 12:02 AM
    Tuesday, July 26, 2011 12:02 AM
  • Jason,

     

    Actually, this is not SAP.  I am only sending a feed to SAP and processing data using a PowerBuilder executable.   The probem is strictly passing the parameter when I execute this command in a .CMD script.  However, If I run from Windows using the same command, I have no problems.   I tried directly from DOS as well, and it still does not execute due to the parameter.  I was thinking since it worked under Windows 2000 and I am now using 2008 with windows 7, that maybe there is a registry setting or something that needs to take place for a parameter to be used in a .CMD or .BAT.   If I run a script without the parameter, it will run based on the default I give it in the .ini file.  So this is strictly due to an error with how I am running this script with the parameter


    Nick Imorde
    Tuesday, July 26, 2011 11:13 AM
  • Hi Nick,

     

    Windows 7 can run the scrip with parameter. Make sure you run the .cmd or .bat with administrator privileges(right click the file and run as administrator). If the issue persists, please contact script forum to check its accuracy.

     

    http://social.technet.microsoft.com/Forums/en/ITCG/threads

     

    Best Regards,

    Niki


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Wednesday, July 27, 2011 9:43 AM
  • Niki,

     

    That did not work either.  I have tried to run this in dos directly as well however, I may want to note that this is in the D partition.   So, in dos, I ran 

    d:\envision\test123.exe inbound

    This does not work. 

    This does run in "Start>Run>d:\envision\test123.exe inbound"  however. 

    So what is different about running in DOS vs running from Windows Start>RUN.  Is there a debug command I can prefix in Dos that may give me more information?

     


    Nick Imorde
    Wednesday, July 27, 2011 11:50 AM
  • Hi Nick,

     

    I would like to let you know, If you click Start, run d:\envision\test123.exe inbound in the search box, it show the same result with Start -> Run. The commands run without using any account. Therefore, the location is in D: partition.

     

    However, if you open CMD without elevated, it default use current user account. Then, it will open application from C:\Users\Username. If you open CMD with administrator privileges, the default location is in C:\Windows\System32. You can resolve the issue by adding one command,

     

    d:

    d:\envision\test123.exe inbound

     

    You can test following elevated command in Start -> Run. Modify the username as needed. You should receive the same result in DOS.

     

    runas /user:username "d:\envision\test123.exe inbound"

     

    Best Regards,

    Niki


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, July 28, 2011 9:51 AM
  • Niki,

     

    Well, when I run from the .CMD that I modified as

    d:

    d:\envision\test123.exe inbound

    It gives me the same error.  If I run from DOS or from start run as:

    runas /user:username "d:\envision\test123.exe inbound"

    it prompts me for my password and then it runs successfully.

    Looks like when I run as a .cmd or .bat, it still does not work.  I did modify the .cmd as I ran in dos, it will work, but prompts me for a password.   Since I will be running this from a scheduler. is there anyway to include a password or encrypted password in the command.  Seems like if you log in with that username, the system should pick up that account.  But it does not seem to be doing that.   Is there some setting or command that would force it to recognize the userid / password you logged in as?


    Nick Imorde
    Friday, July 29, 2011 12:24 PM
  • Hi Nick,

     

    I saved the commands as .cmd extension and I can run my software successfully. What exactly error message did you receive?

     

    I suggest you turn off UAC and perform clean boot to check the result.

     

    Best Regards,

    Niki


    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Monday, August 1, 2011 2:37 AM
  • Did you create a user "SVC_MyCommandApp" on the local machine, and give it local admin rights? (technically I would go through the profile settings and give it log on as batch, service, etc... and restrict it, but that takes awhile to type)  Then try and run it as a scheduled task specifically as that admin account?
    :P Advice offered, If you need more help it is advised to seek the council and advice of paid professionals. The answer is always 42, or reboot.
    Monday, August 1, 2011 6:17 PM
  • Niki,

    The UAC is already OFF.

    As I noted above, when I run with the "runas" command in dos, it works.  It prompts for a pssword.  The scheduler I use is not interactive.  Is there a script I can run when this user signs on that may eliminate the need for the password prompt to take place?

    When I run in the command as you indicated above, it still fails.  I believe it looks at the parameter with a space before it instead of without a space..ie ( INBOUND) vs (INBOUND).   That is why it complains about the NULL Is there anything that needs to be placed before the parameter to make sure it looks at the parameter properly? 

     


    Nick Imorde
    Monday, August 1, 2011 7:29 PM
  • Niki,

    When I run this command in the Start>Run window using the alias for this machine, it works:

    \\wdwappadm05\envision\saphrohm.exe WDW

    However, if I put this same command in a script in DOS or directly from the script located in d:/envision/scripts/ohmhi0105.cmd, it will fail

    D:\Envision\Scripts> OHMHI0105.CMD

    D:\Envision\Scripts>\\wdwappadm05\Envision\saphrohm WDW

    The error is below.  

    This is a powerbuilder exe that runs.  However, the fact that this runs directly from Start>run->\\wdwappadm05\envision\saphrohm.exe WDW, indicates to me that this is not a code problem.  We are running on a different machine now..windows 7, and I assume that is part of the problem.  The Id I log in wth has admin rights, so not sure how that plays when running the script.  

    The  UAC was already turned off.  This really seems like a config issue somewhere...like maybe something needs to be set.  If I run this same script without the parameter in DOS, it will run but based on the ini file it will run for DCL not WDW.  So, it ignores the parameter.   Is the syntax different when running powerbuilder programs in a script when running in Windows 7.  I noted in other logs that do not run, that it looks like the parameter has a space or NULL before it.   example...when I run another with the paramenter INBOUND, when I run from start > run, it give me the one below and it runs

    SAP HR Medical Qualifications (INBOUND) started on Aug 08, 2011 07:03 AM 

    When I run from Dos or from the script, it looks like this in the log and it does not run.  Notice the Null or space before the INBOUND.  So, the error looks to be the way I am passing this parameter.  

    SAP HR Medical Qualifications ( INBOUND) started on Aug 08, 2011 07:03 AM

    Thanks for your help


    Nick Imorde
    Monday, August 8, 2011 11:49 AM