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?
Answers (7)
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
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
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
-
@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
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.
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