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 1,707 other followers

Archive for the ‘Console (command prompt window)’ Category

Some FindStr links

Posted by jpluimers on 2019/08/23

When searching text files on Windows, often FindStr is the only tool at hand. Given the MS-DOS ancestry, it carries quite a bit of history, so here are a few links on the quirks it has:

General references:

–jeroen

Posted in Console (command prompt window), Power User, Windows | 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 »

How can I open a cmd window in a specific location? – Stack Overflow

Posted by jpluimers on 2019/03/19

Based on [WayBack] How can I open a cmd window in a specific location? – Stack Overflow:

cmd /K "pushd ""D:\Versioned Stuff\wiert.me"""

The quoting is required for paths having spaces, so I always include them just in case I ever have a path with spaces.

If I want it with bash, then I run it as follows:

cmd /K "pushd ""D:\Versioned Stuff\wiert.me""" && "C:\Program Files\Git\bin\bash.exe"

Documentation: [WayBack] CD Change Directory – Windows CMD – SS64.com

–jeroen

Posted in CommandLine, Console (command prompt window), Development, Power User, Software Development, Windows | Leave a Comment »

Run cmd as elevated user (via: windows – How to run batch file command with elevated permissions? – Super User)

Posted by jpluimers on 2019/03/13

Based on [WayBack] windows – How to run batch file command with elevated permissions? – Super User:

powershell -command "Start-Process cmd.exe -Verb runas"

This works better than "runas /user:administrator cmd.exe" as that forces to use the specific Administrator account, whereas the PowerShell way allows you to specify the actual account during elevation.

You can extend this to run a command with one or more parameters based on [WayBack] Launch Elevated CMD.exe from Powershell – Stack Overflow (thanks [WayBack] mklement0):

powershell -command "Start-Process cmd.exe -Verb runas -Args /k, call, goto-bin"

This will actually pass “call goto-bin” to cmd.exe which tries to execute the “goto-bin” command (which I have around on the PATH as goto-bin.bat).

You can either use comma-separated parameters or a quoted string. In this expansion, comma-separated is easier in this PowerShell construct.

–jeroen

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

How do I export the history from the Windows command line to a text file? – Super User

Posted by jpluimers on 2019/03/11

I totally did not know that DOSKEY was part of CMD.EXE, but it is: [WayBack] How do I export the history from the Windows command line to a text file? – Super User

Even better: it can export the command history:

doskey /HISTORY > history.txt

Related:

–jeroen

Posted in Console (command prompt window), Power User, Windows | Leave a Comment »

 
%d bloggers like this: