Start program WITHOUT UAC, useful at system start and in batch files (use task scheduler)

I like to run the search program Everything (link valid 6/4/2014 but check techsupportalert.com for any updates) but it is a stand-alone executable downloaded from the internet so it triggers a UAC (User Account Control) warning.

No biggie, but i also want it to start automatically when windows starts. And i dont want to have to click UAC or have my customers click UAC every time they start windows.

I also might want to put commands that must be elevated in batch jobs (.bat files) when there’s no one there to click YES to the UAC.

The workaround is to go thru task scheduler. There you can set up a task to start with elevated privileges which won’t trigger a UAC.

The article at http://www.winhelponline.com/blog/run-programs-elevated-without-getting-the-uac-prompt/ contains the basic, but forgets some points.

My edits are in green:

Creating a Scheduled Task

1. Open Task Scheduler by clicking the Windows Orb and typing “task” and selecting “Task Scheduler” from the search results, or from Control Panel or by running the command control schedtasks from Start, Search box.

2. Left-click Task Scheduler Library category in the left to select it (make it highlighted; or else you can’t do “New Folder” below)

3. Right-click “Task Scheduler Library” category in the left, and choose New Folder

4. Name the folder as MyApps (or whatever name you choose; you’ll use the same name again, below)

5. Click the little triangle to the left of “Task Scheduler Library” to display the list of folders beneath it, including our newly created MyApps folder.
Select the MyApps folder (or whatever you named it) by left clicking on it once.

6. In the Actions pane on the right, click Create Task…

7. Type a name for the task that you want to create. You’re going to have to type this again later, so for convenience, keep it short and dont use any spaces.

8. Enable the option Run with highest privileges. This is an important step. In fact the key to the whole thing.

8.a. (FYI The “Hidden” checkbox refers to only viewing tasks in the task scheduler; there is way to show or now show hidden tasks when in task scheduler; This Hidden settings does not make the task hidden in any way when it runs.)

9. Select the Action tab

10. Click New

11. Click Browse… to select the program (Example: Regedit.exe) you want to run, and mention the parameters (called arguments in task scheduler). required if any, for the application. (For example, to run a .REG file, select Regedit.exe and mention the parameter (argument) as “/s filename.reg” without the quotes. Another example: my Everything program takes a -startup argument to start in the system tray rather than with a window.)

To run Services MMC applet, browse and select MMC.EXE and type services.msc in the Add arguments (optional) field.

12. Select the Conditions tab

12.a. UNcheck “Start the task only if the computer is on AC power”

13. Select the Settings tab

13.a UNcheck “Stop the task if it runs longer than”

13.b at the bottom there is “If the task is already running, then the following rule applies:” You can choose whatever you want here.

If when it’s running you want to not start another one, select “Do not start a new instance”.

If when it’s running you want might want start another one running simultaneously, select “Run a new instance in parallel”.

If when it’s running you want to end the one that’s currently running, and start another one running, select “Stop the existing instance”.

I suppose “Queue a new instance” is helpful, but i can’t think of an example right now.

Note, you can export this to an xml file (see below) and then import it into another system

Creating a Scheduled Task via cmd line schtasks

(NOTE: this method is NOT AS GOOD–see below)

Alternatively, you can create a task via the cmd line schtasks :

schtasks /create /sc once /tn cmd_elev /tr cmd /rl highest /st 00:00
schtasks
invoke the schtasks.exe cmd line program
/create
schtasks can also query, delete, etc; we want to create a task
/sc once
how often to run; we’re not creating a repetitive task; in fact we dont want to run it at all, just set it up to be run manually, but that option does not appear to be available, so “once” is the closest (see explanation at /sc starttime)
/tn cmd_elev
/tn stands for Task Name and you can name it anything you want (but you have to use the same name when you later invoke /run
/tr cmd
the command to run, in this case the cmd.exe program, aka command prompt
/rl highest
Why we came to the party. /rl stands for Run at privilege Level; and we want the highest priv level

/st 00:00
/st stands for Start Time; dont want a start time, but it appears to require one. When you create thru the GUI you dont have to have a trigger at all, but via cmd line you seem to (or was it just me?). I just put in 00:00 (format is HH:MM) which is never in the future, which means it’ll trigger a warning

WARNING: Task may not run because /ST is earlier than current time.

Yeah, that’s what i want. (NOTE: love those microsoft guys: it’s a nit, but when the time is EQUAL to the current time, you get the warning)

If all goes well, you should see

SUCCESS: The scheduled task "cmd_elev" has successfully been created.

or whatever name you called it.

If you re-run the line (let’s say you were experimenting 😉 you will get the warning

WARNING: The task name "cmd_elev" already exists. Do you want to replace it (Y/N)? y

You can safely say Y to this.

NOTE: this method is NOT AS GOOD as creating thru the GUI. At least i could not find the switches to set some important things.

Namely,

  • “start the task only if the computer is on ac power” will be checked in the conditions tab; not ideal
  • “stop the task if it runs longer than [time]” where time defaults to “3 days” will be checked in the setting tab; not ideal

Launching a Scheduled Task item manually

To run a scheduled task item manually, use the schtasks.exe command-line tool that comes with Windows. For example, to launch the Services console task that you already created, use the following command:

SCHTASKS.EXE /RUN /TN MyApps\REGEDIT

Note: Where MyApps\REGEDIT is the name you chose for the folder and Taskname. You’ll need to enclose the task name within double-quotes if the task name contains blank spaces in between. (Example: SCHTASKS.EXE /RUN /TN folder\“Name of the Task”) If the folder has spaces, you’ll have to enclose that in double-quotes; perhaps best to enclose the whole thing. (Example: SCHTASKS.EXE /RUN /TN “folder\Name of the Task”)

Creating Shortcuts to run each Task

You can create a Desktop shortcut for each scheduled task item you’ve created earlier. Right-click on the Desktop and choose New, Shortcut. Type the command-line (say, SCHTASKS.EXE /RUN /TN MyApps\REGEDIT). Mention a name for the shortcut and click Finish.

Run the task minimized

As Schtasks.exe is a console utility, you’ll see the Command Prompt window opening and closing quickly whenever you run the shortcut. So, you may configure the shortcut to run in a minimized window state, in the the shortcut properties.

  • Right-click on the shortcut and click Properties.
  • In the Run drop-down options, change the selection from “Normal Window” to Minimized.
  • Click OK.

Note: In the shortcut properties, you may want to click Change Icon and assign appropriate icon for the shortcut. The icons should be present inside the executable itself, in most cases. For Regedit.exe, browse to Regedit.exe and choose an icon. You may also browse the shell32.dll and imageres.dll files for additional icons.

xml file

Once you set up a task the way you like it via the GUI (recommended method), you can export it to an xml file so that it’s easier to set up on the next system.

Here’s my xml file for (Search) Everything. Filename ends in .xml.txt so change it to just .xml befor importing to task scheduler. start_search_everything.xml.txt

Other Methods

There are at least three other compelling methods.

The first two come from

1. NirSoft NirCmd

nircmdc has an elevate cmd

nircmdc elevate cmd

2. SysInternals PsExec

Part of PsTools suite.

psexec.exe -accepteula -h -u “$username” -p “$password” cmd.exe

The “-h” switch is the one doing the magic:

-h If the target system is Vista or higher, has the process run with the account’s elevated token, if available.

The third comes from

3. vbs or PowerShell to elevate

key lines are to use the visual basic script / vbscript command UAC.ShellExecute to perform the elevation, create a new cmd (command prompt), and re-run the original bat file, now elevated. Does that by writing a .vbs file:

ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"

Or, you can use PowerShell to elevate:

if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( powershell "saps -filepath %0 -verb runas" >nul 2>&1)

Elevated command prompt and mapped drives

One problem you might encounter when using this method if you’re running a batch file (.bat) in elevated mode, is: Mapped drives (incl net use) missing from elevated processes eg UAC cmd run as administrator. Fortunately, there’s some solutions in that blog post.

Windows 7 ISO direct Digital River download links from Microsoft

UPDATE 11/8/2015:
THESE LINKS ARE NOW STALE!

You can try them, but 11/8/2015 they redirect to Microsoft Home Use Progrgam (hup) for employees of corporations that have paid for MS software licenses at work.

Best thing to do is keep googling for links. Sometimes you need a key to get the download–but then dont need a key to install as trial.

An excerpt from the excellent Sean’s Windows 7 Install & Optimization Guide for SSDs & HDDs at overclock.net url: <http://www.overclock.net/t/1156654/seans-windows-7-install-optimization-guide-for-ssds-hdds>

Windows 7 ISO download links:

  • Have you lost your disc or is it damaged beyond use and need a legitimate copy of windows 7?
  • Are you getting error messages or BSoDs with your installer?
  • Do you just want a copy of Windows 7 with SP1 pre-installed?

    These are new SP1-U ISOs directly from Microsoft; having a direct Digital River download from Microsoft is the only way you can link Windows 7 downloads on this site. You will still need an activation key to use these copies after the 30 day grace period is over.

    Windows 7 Home Premium SP1-U ISO:
    English 32-bit

    • http://msft.digitalrivercontent.net/win/X17-58996.iso

    English 64-bit

    • http://msft.digitalrivercontent.net/win/X17-58997.iso
    Windows 7 Professional SP1-U ISO:
    English 32-bit

    • http://msft.digitalrivercontent.net/win/X17-59183.iso

    English 64-bit

    • http://msft.digitalrivercontent.net/win/X17-59186.iso
    Windows 7 Professional N SP1-U ISO: (Note: N editions come without media components)
    English 32-bit

    • http://msft.digitalrivercontent.net/win/X17-59335.iso

    English 64-bit

    • http://msft.digitalrivercontent.net/win/X17-59337.iso
    Windows 7 Ultimate SP1-U ISO:
    English 32-bit

    • http://msft.digitalrivercontent.net/win/X17-59463.iso

    English 64-bit

    • http://msft.digitalrivercontent.net/win/X17-59465.iso

    Multilingual Windows 7 versions here: (link)

Windows ClipBoard Viewer

When you cut and paste, what you cut is stored in the windows “clipboard”.  You can cut and paste (or copy and paste) using the Edit -> Cut (or Edit -> Copy) and Edit -> Paste menu options in nearly all programs.  Or you can cut (or copy) and paste using the Ctrl-X (or Ctrl-C) and Ctrl-V keyboard shortcuts.  As you probably know, “cut” deletes the old one, whereas “copy” preserves the old one.

Either way, this “clipboard”  which stores your cut (or copy) is normally invisible.

On Windows XP there was a way to view it.  You had to run the program "clipbrd" (file: clipbrd.exe) and because it was in the C:\WINXP\system32 or C:\Windows\system32 folder you could run this by using Start->Run and typing clipbrd into the box.

Windows Vista and Windows 7 do not contain the clipbrd program file.

But, you can copy the file from a Windows XP system and just place it in your Windows Vista or Windows 7 C:\Windows\system32 folder and it should just work.

 

CHKDSK results in Windows 7

On Windows XP CHKDSK used to record its output to a file called Bootex.log in the root of the volume being checked. “Bootex” is short for BootExecute the name of the registry entry that triggers the boot-time CHKDSK. But no such file is produced on Windows 7.

Instead go to, Control Panel -> Administrative Tools -> Event Viewer

Or just type Event in the Windows 7 Start Menu search box. It should find Event Viewer, then just click on it.

The exact name of the exe file is eventvwr.msc

Then, Windows Logs -> Application -> Wininit

Most things are found in the System log, not Application. CHKDSK results is one of the exceptions.

Wininit is found under the source column. Wininit is not a very common value for source. Some people online say Winlogon. But i found it in Wininit.

References: http://superuser.com/questions/214209/where-are-the-results-of-chkdsk-located-in-windows-7

How to run CHKDSK – http://support.microsoft.com/kb/315265

CHKDSK help fILe – http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/chkdsk.mspx?mfr=true

HTML5

HTML5 is a set of new web development technologies that bring the mobile (ie iPhone or smartphone) experience to websites.

In doing so, they also achieve the ability to write one application and have it run the same way on the web and on an iPhone, or other smartphone.

In other words, they bring features common to smartphone apps to web development, namely

  • Touch events
  • Swipe events
  • Pinch zoom in/out
  • Location access (eg GPS)
  • Camera access
  • Offline storage, eg each app can store data, info, files
  • Offline app usage.
    • Web apps require you to be online to run them. They have always been websites up til now.
    • Most smartphone apps run whether or not you’re online
    • HTML5 allows web apps to run while offline, like smartphone apps

Here’s a quote of the text of html5.org, captures 8/25/2013, a good overview of HTML5 resources:

html5.org


HTML5 is the latest version of HTML and XHTML. The HTML standard defines a single language that can be written in HTML and XML. It attempts to solve issues found in previous iterations of HTML and addresses the needs of Web Applications, an area previously not adequately covered by HTML.

Here are several resources worth exploring:

The Windows Registry

The Windows Registry replaces .ini files. It is a place where programs store the data they need to run. Eg, configuration settings.

Some key facts to remember.

Root Keys

[P] – primary key
[A] – alias to some other key in the registry

  1. [A] HKEY_CLASSES_ROOT (HKCR)
    • On Windows 2000 and above, HKCR is a compilation of user-based HKCU\Software\Classes and machine-based HKLM\Software\Classes. If a given value exists in both of the subkeys above, the one in HKCU\Software\Classes takes precedence.
  2. [A] HKEY_CURRENT_USER (HKCU)
    • a link to the subkey of HKEY_USERS that corresponds to the user; the same information is accessible in both locations
  3. [P] HKEY_LOCAL_MACHINE (HKLM)
  4. [P] HKEY_USERS (HKU)
  5. [A] HKEY_CURRENT_CONFIG (HKCC)
    • It is a handle (alias) to the key "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current" (only exists in Windows 9x/Me and NT-based versions of Windows)
  6. HKEY_PERFORMANCE_DATA (only in NT-based versions of Windows, but invisible in the Windows Registry Editor)
  7. HKEY_DYN_DATA (only in Windows 9x/Me, and visible in the Windows Registry Editor)

hive file locations

The Registry is stored in hive files.

Note:

  • %SystemRoot% is usually c:\windows
  • %UserProfile% is usually
    w2k w2003 wxp
    c:\Documents and Settings\[USERNAME]
    Vista w7 w8
    c:\users\[USERNAME]
HKEY_LOCAL_MACHINE\SAM
%SystemRoot%\System32\Config\SAM

  • (SAM stands for “Security Accounts Manager”)
HKEY_LOCAL_MACHINE\SECURITY
%SystemRoot%\System32\Config\SECURITY
HKEY_LOCAL_MACHINE\SOFTWARE
%SystemRoot%\System32\Config\SOFTWARE
HKEY_LOCAL_MACHINE\SYSTEM
%SystemRoot%\System32\Config\SYSTEM
HKEY_USERS\.DEFAULT
%SystemRoot%\System32\Config\DEFAULT
HKEY_USERS\[User SID] (HKEY_CURRENT_USER)
%UserProfile%\NTUSER.DAT
HKEY_USERS\[User SID]_Classes (HKEY_CURRENT_USER\Software\Classes) (part of HKEY_CLASSES_ROOT)
w2k w2003 wxp
%UserProfile%\Local Settings\Application Data\Microsoft\Windows\UsrClass.dat (path is localized)
Vista w7 w8
%UserProfile%\AppData\Local\Microsoft\Windows\UsrClass.dat (path is not localized)

Reference: https://en.wikipedia.org/wiki/Windows_Registry

HTML5 offline apps for iphone

there’s some special meta tags you can put in a webpage to make your web apps avable and full screenable to the iphone hard drive. (so it can work offline) Here’s an example : http://mrgan.tumblr.com/post/125490362/glyphboard2 [or view source of http://mrgan.com/gb/]

There’s also frameworks like phonegap that let you access cocoa apis from javascript, but it sounds like you don’t need that.

answered Jun 25 ’09 at 13:18

Breton

via ruby – Develop iPhone app without a Mac? – Stack Overflow.

Reference: https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html

CHKDSK windows cmd line tool – Microsoft In-Depth discussion

Here is Microsoft’s in-depth discussion of what CHKDSK does. An overview can be found here.

This KnowledgeBase article claims to be about the new /C and /I switches, but the article goes on to say

To understand when it might be appropriate to use the /C and /I switches, you need a basic understanding of some of the internal NTFS data structures, the kinds of corruption that can take place, what actions CHKDSK takes when it verifies a volume, and what the potential consequences are if you circumvent CHKDSK’s usual verification steps.

So the article really winds up being about chkdsk in general.

Continue reading

CHKDSK Windows cmd line tool – Microsoft overview


(cuz the yellow highlight color below was chosen for white (light) chars on black background)
Here’s microsoft’s overview of the CHKDSK Windows command line tool.  An in-depth discussion can be found here.

Quote microsoft:

Chkdsk

Creates and displays a status report for a disk based on the file system. Chkdsk also lists and corrects errors on the disk. Used without parameters, chkdsk displays the status of the disk in the current drive. Continue reading

Fixing “Access is denied” on a foreign drive

If you have an old drive you’re trying to use in a new computer, you might get an “Access is denied” error. The reason might be that the users on the old disk might be unrecognized by the current computer. (There are other reasons, eg, the file might have permissions set to disallow access. Also the file might be in use, in which case see “Unlocker” as described in Best Free Undeletable File Remover at techsupportalert.com But if not, read on:)

Say you’re trying to access folder “Pete” in the “F:” drive (an external drive, say, from an old computer).

00_and_14_pete_folder_highlited_ed

You might get an “Access is denied” error:

01_access_is_denied

To fix it right click on the folder you want to access, and click “Properties”:
02_and_07_properties_right_click

The “Security” tab might be missing:

03_properties_no_security_tab

If the “Security” tab is missing, there’s an intermediate step. Click Tools -> Folder Options :

04_open_tools_folder_options_edited

In the “Folder Options”, click the “View” tab:

05_folder_options_click_view

In the View tab, UNCHECK “Use simple file sharing (Recommended)”.  It may be “Recommended” but is it nevertheless sometimes not ideal.

06_uncheck_simple_file_sharing

Click “OK”.

Back to the folder you want to access (in the example “Pete”). Right click and select “Properties”:

07_and_02_properties_right_click - Copy

Now there should be a “Security” tab:

08_properties_with_security_tab

Click on the “Security” tab.

Note the Group or user names. If this is your problem, some will be missing, and some might be unrecognized or look strange. That “S-1-5-…” is a user from another PC (most likely the pc the drive came out of).  We want to add some here. Click “Add”:
09_properties_security_no_administrators_ed

In the text box, add the user that needs access. On most Windows XP computers, it is sufficient to add “Administrators”. It is a user Group. Or, you might want to add your username on this computer. Or another user’s username. Click “Check Names”:

10_properties_security_add_type_administrators_check_names

If there’s no typo, Windows should change your text into a recognized username. In the example “PETE\Administrators”. In this case “PETE” is the computer name (happens to be the same as the user name and folder name in this example):

11_properties_security_add_type_administrators_name_found_click_ok

Click OK to get back to the Properties dialog box. Now the new username should be shown. Now look at the lower half, the Permissions. Some in the “Allow” column might be un-check’ed:

12_properties_security_with_administrators_click_full_control

If so, click the check box for “Full Control” to enable all permissions:

13_properties_security_with_administrators_with_full_control_on

Click ‘OK’ to return to the list of files.

14_and_00_pete_folder_highlited - Copy

Now double-click on “Pete” and you will have access! 😀
15_pete_folder_accessible

Hooray!