There’s a couple of automatedcommand lineroutines that I’ve needed to write and have run at startup on the VCR, but they require elevation to actually run (damn you, UAC!). My goal has always been to have the machine boot with no input from me until it’s ready, so I needed a way to run these scripts automagically without requiring a physical “right-click, run as administrator” routine before the boot process is finished. To solve this, I needed to figure out how to run a batch file as administrator.
One does not simply right-click and run a *.bat file as administrator, though. Oh, no! Windows doesn’t like that! It takes a little more stupidity to run a batch file as administrator in Windows 7!
Once your batch file is written properly, you’ll need to create a shortcut to the *.bat. This is the first step in the roundabout process. Windows allows shortcuts to *.bat files to be automatically run with elevated privileges while the files themselves cannot (it must be some kind of idiot-proofing to prevent you from running a coup de grace downloaded from the interwebs). Take note, though, that you can’t click the option for “Run As Administrator” from the compatibility tab like you normally would; you must open the “Shortcut” tab, then click the “Advanced” button, THEN select the option to run as administrator.
Once you’ve set the shortcut’s settings to run as administrator, then you can point Task Scheduler or EventGhost at the shortcut and have it run whenever you like!
As the VCR continues to evolve, I’m adding game support to the system, making it an all-in-one entertainment box. To start, I’ll be using Retroarch for most of my classic game emulation. I’ll write more about the program in another number, but the biggest problem getting it to run in Windows is the need for DirectX 9 support. Without installing DirectX 9, upon your first run of Retroarch, you’ll receive a d3dx9_43.dll missing error. In this number, I will direct you how to fix the d3dx9_43.dll error in Windows 7.
Download DirectX End-User Runtimes to install d3dx9_43.dll or any other missing libraries
Interestingly enough, newer DirectX distributions may not come with the required dll files, so you’ll have to download these from Mircosoft. The June 2010 DirectX End-User Runtimes package contains all the files you should need to support Retroarch and other, older Windows games. Simply navigate to the download page, and run the setup file.
Command & Conquer is perhaps the greatest PC game franchise in history, and Electronic Arts in one of its most surprising moves released an unadulterated collection of all the franchise games up to that point–before subsequently ruining the whole thing with C&C 3 and Red Alert 3. I ran across a clean copy at the local thrift shop, so I picked it up for a few dollars. (Yes, I know that technically, I could’ve downloaded the game from EA for free, except that it’s probably not still available, or–if it is–it’s surprisingly difficult to locate the original download links.) Here’s how to get Command & Conquer The First Decade to work in Windows 7.
The problem here is that I’m playing a twenty-year-old game written for a twenty-year-old operating system on a 21st-century version of Windows. One consolation is that Windows 7 has a pretty decent level of compatibility with applications written for older versions of the OS, and that is our saving grace.
The trick is that we’re not going to run any of the games through the launcher that EA installs; we’re going to do this old-school, via good ol’ Windows Explorer. For the older titles in the franchise, we’re going to need to take one more step that I’ll elaborate on in a moment. For each of the titles in the series, you’ll need to set the compatibility settings for the game’s executable.
For C&C, original Red Alert, and Tiberium Wars, the exe file should be set to Windows 95 compatibility, and all the check boxes should be marked (640×480 resolution, 256 colors, disable visual themes, disable desktop composition, disable display scaling). Also, you’re going to need to kill explorer.exe to prevent any funky colors from accidentally showing up in the game. This is where our batch file comes in. Open Notepad and type the following code:
taskkill /f /IM explorer.exe
C:\"Program Files (x86)"\"EA Games"\"Command & Conquer The First Decade"\"Command & Conquer Red Alert(tm)"\"ra95.exe"
Note that this points to the default installation location of Red Alert. If you’ve installed to a different location, make sure to use that instead!
Save this file as “RA95.bat” or something easily recognized. On running, the code will force-quit Windows Explorer (the Windows “shell”, or operating environment), run the game, then reopen Explorer when finished.
Red Alert 2 only needs to be run in compatibility mode for Windows 98/2000, no other settings need to change. Renegade should work in 98/2000 mode as well, though I have yet to verify this.
Generals should be run in Vista SP2 compatibility mode, with no other settings changed.
In case you needed to run a program or any other task in Windows via the command line, but did not want a new window opened, use the “start” command and the /B tag to execute a Windows command in background.
I’ve been playing around with adding video game functionality to the VCR as of late, and to that end I picked up an Xbox 360-compatible wireless controller, complete with guide button. Unfortunately, Microsoft does not make using–much less programming–the guide button very easy, but I have a workaround that I will elaborate on in a later number. There is a small applet running in the background that listens for the guide button and responds in a preprogrammed manner; however, I do not want this applet functioning all the time because it becomes annoying when not within the game atmosphere.
In order to call the applet when I want to, I use Eventghost and trigger the applet upon a particular task creation. To stop the applet, however, I needed to execute a batch command. The “taskkill” command can easily kill a process from command line as long as its listed in the Task Manager.
taskkill /f /im process.exe
The /f tag will force quit the particular process and the /im tag indicates the image name of the process (as listed in the Task Manager).
The initial feature set of the VCR relies on a Microsoft-branded remote control to send signals to Windows and control XBMC/Kodi. Eventghost has been able to parse all these signals into useful commands, including one to put the system to sleep (effectively powering off). Unfortunately, this still required physically pressing the “power” button on the face of the VCR to toggle the system back on. To solve this, I enabled wake on USB in both the BIOS settings and, back in Windows, in the device settings for the remote.
To find the device settings for your remote, open the Control Panel and navigate to the Device Manager under the “Devices and Settings” section. Locate the listing for your remote in the device tree, right-click it, and select “Properties”. Under the “Power Management” tab, make sure that “Allow this device to wake up the computer” is checked. Click “OK”, reboot, and you’re all set! The power button on the remote should drop the system into standby mode and a second press should wake it instantaneously!
Dear Microsoft, It really shouldn’t be this difficult.
To enable the same view for all Windows 7 folders, you need to set up a particular folder however you like.
In the Windows Explorer “Tools” menu , click “Folder Options”.
In the “View” tab, click the “Apply to Folders” button. Windows will ask if you’re sure about the change (and why wouldn’t you be, if you’re going through the trouble?). Click the “Yes” button, then “OK”.
Adventitious Geekery and other distractions created or curated by Matthew "Atari" Eargle