The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,482 other followers

Archive for the ‘Batch-Files’ Category

Some Windows 10 updates remove registry values; not sure how widely

Posted by jpluimers on 2021/10/12

After watching an autologon system not logging on automatically over the past years, the pattern seems to be that at least major, and some less minor Windows updates remove autlogon parts of the registry.

I’m not sure where the boundary between “major” and “less minor” lies (though I suspect “cumulative updates” and larger), nor if more than these values are affected:

  • key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
    • value name AutoAdminLogon gets removed or becomes value 0
    • value DefaultUserName gets removed
    • value DefaultPassword gets removed

This means that now after each startup, I need to schedule a task that runs a script setting the values I need depending if a password is needed or not.

The script also needs credentials, so I need to figure out how to properly do that.

I still need to decide between PowerShell or batch file script, as I already have the batch file from How to turn on automatic logon in Windows and automatic logon in Windows 2003.

For my future reference, some more links on things that can get deleted:

Hopefully these links will help me writing the scripts:

–jeroen

Posted in Batch-Files, CommandLine, Development, Power User, PowerShell, PowerShell, Scripting, Software Development, Windows, Windows 10, Windows Development | Leave a Comment »

Run chrome in fullscreen mode on Windows – Stack Overflow

Posted by jpluimers on 2021/09/14

Since Chrome changes over time, the batch file below from [WayBack] Run chrome in fullscreen mode on Windows – Stack Overflow also changes:

@echo off
echo Countdown to application launch...
timeout /t 10
"C:\Program Files (x86)\chrome-win32\chrome.exe" --chrome --kiosk http://localhost/xxxx --incognito --disable-pinch --no-user-gesture-required --overscroll-history-navigation=0
exit

On most of my systems. Chrome is at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe, so I need to change the path anyway.

–jeroen

Posted in Batch-Files, Chrome, Development, Google, Power User, Scripting, Software Development, Windows | Leave a Comment »

Opening shell folders from the command-prompt

Posted by jpluimers on 2021/09/09

I knew I could run shell:startup and similar shortcuts from the Explorer address bar or the Windows-R “run” prompt.

First I learned that via [WayBack] tablet – How to set Google Chrome to automatically open up and in full screen – Super User.

Then via [WayBack] “shell:startup” – Google Search, I found [WayBack] Location of the Startup folder in Windows 10.

It took a while before I realised you can also run them from the command-prompt, batch-files or PowerShell scripts prepending them with start:

start shell:startup

That one will open a new explorer window in the user startup folder from either the command-prompt, a batch file or PowerShell script..

The shell: shortcuts can contain spaces. So for instance there is shell:common startup that opens the common startup folder.

Starting it from the command prompt, batch file or PowerShell script is different: because of the spaces you will get the error on the right unless you add double quotes:

start "shell:common statartup"

All shell: commands that you can run in the same way: double quotes work for both the ones requiring spaces and the simple ones nor requiring spaces.

Virtually each new Windows version (even most Windows 10 major builds) gets new shell: commands.

A good source with an up-to-date and historically accurate of shell: commands list is at [WayBack] Shell Commands to Access the Special Folders in Windows 10/8/7/Vista/XP » Winhelponline,

You can get the current list by recursively enumerating the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions registry key, which consists of a list of Explorer folder GUIDs having Name, ParentFolder and RelativePath value names.

–jeroen

Read the rest of this entry »

Posted in Batch-Files, Console (command prompt window), Development, Power User, Scripting, Software Development, Windows | Leave a Comment »

How to turn on automatic logon in Windows

Posted by jpluimers on 2021/08/09

[WayBack] How to turn on automatic logon in Windows

Describes how to turn on the automatic logon feature in Windows by editing the registry.

Most archivals of the above post fail with a 404-error after briefly flashing the content, but this particular one usually succeeds displaying.

It is slightly different from the one referenced in my blog post automatic logon in Windows 2003, and because of the archival issues, I have quoted most of it below.

A few observations, at least in Windows 10 and 8.1:

  • Major Windows 10 upgrades will disable the autologon: after each major upgrade, you have to re-apply the registry patches.
  • If the user has a blank password, you can remove the DefaultPassword value.
    • Empty passwords allow local logon (no network logon or remote desktop logon), no network access and no RunAs, which can actually help improve security. More on that in a later blog post
  • For a local machine logon, you do not need the DefaultDomainName value either (despite many posts insisting you need them), but you can technically set it to the computer name using reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d %ComputerName% /f
  • If another user logs on and off, the values keep preserved, so after a reboot, the correct user automatically logs on
  • you need a full reboot cycle for this to take effect
  • The AutoLogon tool does not allow blank passwords

I wrote a batch file enable-autologon-for-user-parameter.bat that makes it easier:

if [%1] == [] goto :help

:enable
  reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
:setUserName
  reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d %1 /f
:removePasswordIfItExists
  reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f
if [%2] == [] goto :eof
:setPassword
  reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d %2 /f  
  goto :eof

:help
  echo Syntax:
  echo   %0 username password

The article quote:

Read the rest of this entry »

Posted in Batch-Files, Development, Microsoft Surface on Windows 7, Power User, Scripting, Software Development, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1, Windows 9, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, Windows Vista, Windows XP | Leave a Comment »

Windows: starting Chrome in full-screen kiosk mode from a batch file

Posted by jpluimers on 2021/08/03

When configuring a web-based kiosk for someone with Alzheimer’s disease, I wanted to start Chrome in full-screen kiosk mode.

Chrome full-screen kiosk mode

The secret for full-screen kiosk mode is to pass the -start-fullscreen command-line option. Thanks [WayBack] User ginomay89 – Super User for answering that in [WayBack] tablet – How to set Google Chrome to automatically open up and in full screen – Super User.

Finding chrome

At first I thought about differentiating on the chrome.exe location that you can find in the registry. This turned out to be depending on how you install Chrome:

  • locally for the current user by a non-local-administrator user (by default the location is under %LocalAppData%)
  • globally for all users by a local-administratator user (by default is under %ProgramFiles(x86)%)

Oddly, there is no way (not even by denying UAC elevation!) for a local administrator to install Chrome for only the current user.

This is odd, as when non-local-administrator denies UAC, the installation is locally to the user.

Then I remembered there are two ways for Windows to find an application

The cool thing is that the start command does the latter, so I came up with this batch file that starts chrome with the -start-fullscreen parameter that will initiate kiosk mode with the default chrome settings:

start "Chrome Kiosk Mode" chrome --start-fullscreen

In case I want to compare the registry settings

Basically sorting out the registry settings would mean parsing the references to chrome.exe (often with extra parameters) in the below registry key/value-name pairs.

One day I might need to do this for different reasons, but currently the start trick suffices.

Read the rest of this entry »

Posted in Batch-Files, Development, Power User, Scripting, Software Development, Windows | Leave a Comment »

 
%d bloggers like this: