Start a program from a batch file


  1. Posts : 3
    Windows 10, 7, XP, & Vista
       #1

    Start a program from a batch file


    4 Apps of mine run a batch file that -tries- to call/start and EXE program. These Batch files need to work with OS XP thru Win 10. Win 10 has a pop-up window asking user if its okay to run/execute my EXE. No other Win version does this and thus I suspect a timing problem.

    Here is a few lines from my BAT file:
    Code:
     if %WinVer%-5.0 LSS 0.0 (pause) else (timeout /t 8)
    call %od-tools%\base4DOS.exe /openLF %FCname% %od-user% %FCexit% > nul
    @echo off
    I have tried the following but will this work on older OS versions?
    Code:
    start /wait "" "%od-tools%\base4DOS.exe" /openLF %FCname% %od-user% %FCexit% > nul
    This doesn't work either. Any suggestions?

    Thanks, Phil
      My Computer


  2. Posts : 42,913
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Can you please post a screenshot of the popup message?

    I'm guessing it might be a 'smartscreen' message as you don't specify it. I get this popping up sometimes when installing less common programs I've just downloaded. It's more widely described as an internet site filter.

    But quite why that would be the popup you encounter in this case isn't obvious.

    Assuming my guess is correct, the following should help you decide what to do. You scan also research 'smartscreen'.
    Start a program from a batch file-snap-2016-03-11-13.38.05.jpg
      My Computers


  3. Posts : 3
    Windows 10, 7, XP, & Vista
    Thread Starter
       #3

    dalchina said:
    Can you please post a screenshot of the popup message?
    Its titled 'User Account Control' and is a pop-up box that may be causing my problem.

    I've done a lot of testing between my Win 7 and Win 10 laptop. Here is some code with comments ...
    Code:
    rem 1. .bat works in All Win.s except Win 10!!rem call %od-tools%\base4DOS.bat /openLF %FCname% %od-user% %FCexit% > nul
    rem 2. .bat works in All Win.s except Win 10!!
    rem works! start /wait /B "%FCapp%'s DOSbox Setup" %od-tools%\base4DOS.bat /openLF %FCname% %od-user% %FCexit% > nul
    rem 3. .exe starts for a split second and then exits in Win 10... a Nogo!
    rem   It has a 'User Account Control' pop-up box that may cause a timing problem.
    rem   It works in Win 7.
     start /wait /B "%FCapp%'s DOSbox Setup" %od-tools%\base4DOS.exe /openLF %FCname% %od-user% %FCexit% > nul
    EXE runs for a split second, then terminates ... ideas?

    Phil
      My Computer


  4. Posts : 42,913
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #4

    Hi, UAC was introduced in Vista, then its impact somewhat reduced. It's meant to give the user a last ditch option to block malicious programs.

    You can turn it off altogether:
    Start a program from a batch file-snap-2016-03-12-07.34.17.jpg

    Otherwise the second answer here:
    Add application to UAC exceptions

    may point you in the right direction.
      My Computers


  5. Posts : 3
    Windows 10, 7, XP, & Vista
    Thread Starter
       #5

    dalchina said:
    Otherwise the second answer here:
    Add application to UAC exceptions
    may point you in the right direction.
    That helped ... I use Inno Setup to install my packages. Under [setup] 'PrivilegesRequired=admin' was changed to 'PrivilegesRequired=none' and that did the trick.

    Their was another issue with the Start cmd. I was using 'start /wait /b' and that is a bug. 'start /b /wait' fixed problems.

    Thanks for your help, Phil
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:08.
Find Us




Windows 10 Forums