We help IT Professionals succeed at work.

This App cannot run on your PC message

jskfan
jskfan used Ask the Experts™
on
This App cannot run on your PC message

I am trying to run a .cmd file but keep getting this pop message shown below

Any help ?

Thank you
 c
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
NoahHardware Tester and Debugger

Commented:
Hi there! :)

Firstly, you might want to try running running the file as an administrator. That might do the trick.
run-batch-file-explorer_win10.webp

Secondly, I noticed that Windows Server 2012 is tagged in this question. This could mean that you might need your admin to add the software for you since a normal user might not be allowed those permissions or changes.

Could you also attach the .cmd or .bat file you are trying to run?

Author

Commented:
I am logged in with domain admin account to windows server 2012 , I also have run the file as Administrator. I get the same message.

the file content is as follows:

cscript.exe "C:\windows\system32\Printing_Admin_Scripts\en-US\prnport.vbs" -
a  -s Windows7 -r "printer1" -h hostname -o raw -n 9100

timeout 5

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -a  -p
"Myprinter" -m "HP 910" -r "printer1" -s Windows7

timeout 5

powershell.exe c:\printer.ps1

Open in new window


the printer.ps1 file content is :

$printer = Get-WmiObject -Class Win32_Printer -Filter "Name = 'Myprinter'" -ComputerName windows7
$printer.Direct= $true
$printer.Put()

Open in new window

Kesavan JeganarayananIT Consultant

Commented:
Could you try with the following methods:
1.
Open Start.
Search for Windows PowerShell ISE, right-click the top result, and select the Run as administrator option.
Click on File.
Select the New option to create a new empty .ps1 file.
Write a new or paste the script you want to run

2.
Open Start.
Search for PowerShell, right-click the top-result and click the Run as administrator option.
Type the following command to allow scripts to run and press Enter:
Set-ExecutionPolicy RemoteSigned
Type A and press Enter (if applicable).
Type the following command to run the script and press Enter:
& "c:\printer.ps1"
Top Expert 2016
Commented:
Depending upon your windows updates the windows August 13 update broke  vb6 and vbs file functionality
https://tech.slashdot.org/story/19/08/17/0153225/windows-update-to-fix-critical-wormable-flaws-may-break-vb-apps
Fixed in later updates.
might help to put in some debugging steps

@echo starting pnpport 
cscript.exe "C:\windows\system32\Printing_Admin_Scripts\en-US\prnport.vbs" -a  -s Windows7 -r "printer1" -h hostname -o raw -n 9100
@echo Waiting 5 seconds
timeout 5
@echo starting setting MyPrinter
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -a  -p "Myprinter" -m "HP 910" -r "printer1" -s Windows7
timeout 5
@echo starting powershell
PowerShell.exe -ExecutionPolicy Bypass -Command  c:\printer.ps1

Open in new window

Author

Commented:
David Johnson, CD

Brilliant!!!

It worked without any error.... Can you please explain the changes you made to the script ?

Thank you
Top Expert 2016

Commented:
other than the @echo statements which simply display program status to the screen using the -executionpolicy bypass allows all script to be run no matter what the execution policy in the registry is

Author

Commented:
Thank you for your Help!!