/build/static/layout/Breadcrumb_cap_w.png

Running batch file via Script on Win7 (x64)

How are people handling batch files? The reason I ask is that I've been running into a lot of compatibility "issues" when trying to run my batch files via scripting, it'll fail. Yet if I manually run this SAME batch file from the KACE folder, it runs correctly.

This time, it probably has something to do with that I need to launch the 64-bit version of DISM not the 32-bit version.

 Any thoughts?


0 Comments   [ + ] Show comments

Answers (7)

Answer Summary:
Posted by: rjonesdj 11 years ago
Orange Senior Belt
3

I know this was answered a while back, but i have just found a simpler fix, for anyone else having this particular issue.

Instead of calling DISM or C:\Windows\System32\dism.exe from your batch file, use the path C:\Windows\Sysnative\dism.exe
This will call DISM from the 64 bit "System32" folder, rather than the Wow64 filesystem redirection for 32 bit processes.

All explained pretty well here: http://www.nynaeve.net/?p=133

Posted by: darkhawktman 11 years ago
Green Belt
2

This may help. A Bat to Exe Converter:

http://download.cnet.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html

It has an option to create a 64 bit exe. So I would take your bat file convert it to a 64 bit exe and then run it from the kbox and see if it works.


Comments:
  • As well iexpress.exe is a program built into Windows that will allow you to convert batch to exectuable.

    Once you have the bat file created open the start menu and type iexpress.exe and hit enter.

    At the Welcome page click Next

    At the package purpose screen click Next

    Title the package and click Next

    Click Next on confirmation prompt (left on No Prompt)

    Click Next on License agreement (left on Do No Display a license).

    Click Add and navigate to the batchfile you created and click Next

    At Install Program to launch type cmd /c <batchname>.bat in Install Program and click Next

    Click Hidden on the Show Window page and click Next

    Click Next on Finished message (left on No Message)

    Browse to the shared location where you have the working files located and save the name netmap check Hide File extracting… and Store Files using Long… click Yes on the wizard’s warning and click Next.

    Click No Restart and click Next.

    Click Don’t Save on the Save SED page and click Next

    Click Next on create package.

    Click Finish and test <batchname>.exe - samzeeco 11 years ago
  • Turns out IExpress.exe was the trick. Good to know. Thanks. - afincher 11 years ago
Posted by: afincher 11 years ago
Senior Purple Belt
1

I noticed when I launch "cmd.exe" it runs as a 64-bit process. But when KACE runs "cmd.exe" it runs as "cmd.exe *32" (a 32-bit process). I think this has something to do with it.


Comments:
  • Kace is a 32 bit app. That shouldn't make a difference. Are all of your scripts failing? Can you share your setup on some of the ones that fail? Perhaps a screenshot? - dugullett 11 years ago
    • Something like this might be helpful if your batch requires a 64 bit prompt: http://www.heckler.com.br/blog/2010/03/16/how-to-open-a-64bit-command-prompt-from-a-32bit-application/ - jknox 11 years ago
      • @jknox good information to have. Thanks. - afincher 11 years ago
  • @dugullett: My KACE script was:
    On Success: Launch “$(KACE_DEPENDENCY_DIR)\EnableGames.bat†with params “â€

    the "EnableGames.bat" file is:
    dism.exe /online /enable-feature /featurename:InboxGames /NoRestart


    KACE would properly launch the BAT file, but DISM would throw the error because it was a 32bit command line launching it rather than the 64bit:
    You cannot service a running 64-bit operating system with a 32-bit version of DISM.
    Please use the version of DISM that corresponds to your computer's architecture. - afincher 11 years ago
Posted by: kcolville 10 years ago
White Belt
0

Here is what i did for windows 8 : I have been working on this for a couple days because i was pushing out Dot net 3.5 sp1 that included 2 and 4 for windows 8 i found the instructions <a herf="http://social.technet.microsoft.com/Forums/en-US/1854791d-75cd-4d44-9b94-12065d033121/dotnet-35-sp1-on-windows-8?forum=w8itproappcompat"><Here</a>. I kept getting Error 11. I added a task of Launch program and pointed it to:

Directory: C:\Windows\WinSxS\amd64_microsoft-windows-d..ervicing-management_31bf3856ad364e35_6.2.9200.16384_none_b7734a7c9770a13d\

File: dism.exe

with Paramaters: /online /enable-feature /featurename:NetFX3 /All /Source:$(KACE_DEPENDENCY_DIR)\sxs /LimitAccess

 

Hope this helps someone else.

Posted by: dugullett 11 years ago
Red Belt
0

By default everything runs as SYSTEM. Is your batch file something that requires local user access?


Comments:
  • It should be ok running as SYSTEM. Just to verify, I attempted to run it with the local administrator account and I get the same result. - afincher 11 years ago
Posted by: Nico_K 11 years ago
Red Belt
0

Please be also aware that not every system wide variable is resolved correctly, so use hard coded paths if possible or be shure the variables are known to the script.

Posted by: afincher 11 years ago
Senior Purple Belt
0

I ended up using samzeeco's solution of iexpress.exe

Thank you all.

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ