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,118 other followers

Archive for the ‘Batch-Files’ Category

windows – Batch-file: undocumented wild card characters to check for file pattern existence – Stack Overflow

Posted by jpluimers on 2020/08/19

I wish I had known these undocumented wildcards exists like two decades ago: [WayBackwindows – Batch-file: Check if file with pattern exist – Stack Overflow, thanks Squashman:

There are undocumented wildcards that you can use to achieve this as well.

IF EXIST "D:\*Backup*.<" (
   ECHO "file exist"
) ELSE (
   ECHO "file not exist"
)

This wildcard option and other were discussed in length at the following two links.

From those links:

The following wildcard characters can be used in the pattern string.

Wildcard character  Meaning

* (asterisk)
Matches zero or more characters

? (question mark)
Matches a single character

" 
Matches either a period or zero characters beyond the name string

>
Matches any single character or, upon encountering a period or end of name string, advances the expression to the end of the set of contiguous >

<
Matches zero or more characters until encountering and matching the final . in the name

–jeroen

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

How to pin either a Shortcut or a Batch file to the new Windows 7, 8 and 10 Taskbar and start menu? – Super User

Posted by jpluimers on 2020/04/29

This nailed it: way easier than all the alternatives involving VB scripts, registry keys and Group Policy Editors.

  1. Create a shortcut to your batch file.
  2. Get into shortcut property and change target to something like: cmd.exe /C "path-to-your-batch".
  3. Simply drag your new shortcut to the taskbar

Source: [WayBackHow to pin either a Shortcut or a Batch file to the new Windows 7, 8 and 10 Taskbar and start menu? – Super User

The trick is step 2. After that you can modify back your shortcut to just the batch file.

–jeroen

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

How to make a self extracting archive runs your setup.exe, 7zip -sfx

Posted by jpluimers on 2020/01/01

For my link archive step by step instruction on the command-line which can be automated:

Via:

–jeroen

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

When an installer errors out with “Please re-run this installer as a normal user instead of”…

Posted by jpluimers on 2019/08/12

Via [WayBack] Anyone with a hint on how to work around this: … “Please re-run this installer as a normal user instead of”… – Jeroen Wiert Pluimers – Google+

This happened for instance when trying to install Source Tree 2.x on Windows (1.9.x works fine):

[Window Title]
SourceTreeSetup-2.3.1.0.exe

[Main Instruction]
Installation has failed

[Content]
Please re-run this installer as a normal user instead of “Run as Administrator”.

[Close]

The problem was by accident the machine got in a state to run commands without UAC approval, so the run dialog would already look have “This task will be created with administrative privileges”:

It was odd, as the machine didn’t have it enabled in the security policy (secpo.msc):

So I did a bit more digging, bumped into [WayBack] Why does my Run dialog say that tasks will created with administrative privileges? – The Old New Thing and had one of those #facepalm moments: Explorer had crashed, and I had started it from Process Explorer, forgetting Process Explorer had an UAC token.

The solution is easy:

  1. Logoff / Logon
  2. Verify the Windows-R shows a “normal” run:

Then you can just run the installer:

–jeroen

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

Windows: running a batch file during logon of a single or all users

Posted by jpluimers on 2019/07/01

You can automatically start processes during logon in a lot of ways (Trojans/Viruses find new ways all of the time).

The easiest way is to create a shortcut in one of the Startup folders. There are two of them: one for all the users, and one for the current user. Depending on your locale, Explorer can show a translated name, but the actual folder is named either of these:

  • "%AllUsersProfile%/Start Menu\Programs\Startup"
  • "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup"

The folders do not exist at first, but are created when software starts putting shortcuts in them.

For a manual process, I created the two batch files below that create, then go to them (in both the console and explorer).

From there you can add shortcuts to things you want to run during logon.

They are based on:

I have successfully tested them in various Windows versions up until 10.

–jeroen

Batch files:

:: https://stackoverflow.com/questions/16087694/auto-run-a-bat-script-in-windows-7-at-login
call :do "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup"
goto :eof
:do
mkdir %*
pushd %*
explorer /e,.

 

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

 
%d bloggers like this: