Linux HowTo: Unable to turn on wireless on new Lenovo IdeaPad laptop

Original Source Link

I just bought a Lenovo IdeaPad laptop which is running Windows 7. I can connect to the Internet if I use Ethernet – however, I cannot seem to turn on the wireless.

The little notification on the bottom right says “No connections are available”. When I press the function key + (key that has wireless symbol) then Lenovo Wireless Device Settings comes up and says:

First switch on wireless

I can’t see any wireless button, so how can I switch on wireless as required?

Just press Fn + F5.

Which model is it?

I found this review about the IdeaPad S12, but not sure if it is the one you have. It is that switch right in the middle, next to the vent?

Here is the review: http://www.crunchgear.com/2009/08/06/review-lenovo-ideapad-s12-netbook-with-via-nano-cpu/

int

It looks like there is blue text under the function (F1-F12) Keys. Try pressing the Function Key + The wireless and see if that does the trick 😉

I have a dell by the way .. but it seems like a logical answer.

I had a similar problem with my Acer Extensa 5620 after installing Windows 7. I would press the button to turn on wi-fi but nothing happened.

The fix was to download the wi-fi driver from Acer’s website. This was the last thing I thought of doing as the device showed up OK in the device manager.

Perhaps Lenovo has an updated driver on their site.

I have the Y550 there is a little baby switch at the left hand side corner on. Like if you have your hands on the keyboard it will be under your left arm. It is on the black very front part of the computer.

This fixed the wireless problem for windows 7 for me on the idealpad S12:

Download bios update from here.

Even though it says windows XP bios update, run it from windows 7. After the update is done it will restart your laptop. When windows boot up, your wireless will be on.

NOTE:

  1. The wireless switch on the side should be on before you do the bios update.
  2. DO NOT TURN THE SWITCH OFF after the the update. It will disable the wireless again and you will have to run bios update again.

Hope this helps.

I recently found my Ideapad wireless switch because of this thread. And because of that let me share a photo of where yours might be located and how it looks like:

enter image description here

Install Drivers for Caps lock OSD, Energy management then Wireless.

(Use the Serial number of the laptop to find specific drivers in Lenovo Support)

If WiFi still doesn’t work change the boot order so that it boots from PXE (PCI LAN) before booting from Hard Drive.

This worked for me.

Found on:
https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_S205

This works in my case:

Intel Wireless LAN Driver for Windows 7 (32-bit, 64-bit) – ThinkPad
(https://support.lenovo.com/in/pl/downloads/ds112915)

I tried many other drivers and all of them didnt work or got me BSOD.
Remember first install drivers like chipset etc and leave that for later.

Tagged : / /

Linux HowTo: Java SE Development Kit 7 Update 71 failed

Original Source Link

I want to install Xamarin in Windows 8.1.

It requires to install Java Development Kit 1.6 or above (32-bit). When I try to install JDK, I get this error message”

enter image description here

I’m using Windows 8.1 x64. How can I get it installed?

Hey man I just found out how to fix this when trying to install it my self.
what you want to do is first install this software http://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/ What this does is when right clicking on a file it lets you well. take ownership of that file. so next step after you install that is to hold down the windows and R key what will open Run now type %temp% and press enter. this will take you to the temp folder what i want you to do is go back one folder so you now see the Temp folder not the stuff inside it right click on that folder and take ownership now just try to install your java again

Tagged : / / / /

Linux HowTo: Firefox: non-Vimperator way to do mouseless browsing?

Original Source Link

Is it possible to do efficient browsing with Firefox using
only the keyboard (like in Opera)?

By efficient I mean something faster than using TAB – this
takes far too long. The arrow keys should be for navigation
(in Opera it is Shift + arrow key). It can done with the
Vimperator add-on or its successor Pentadactyl,
but isn’t there a simpler way?


The closest to Opera’s way is to enable caret
navigation
(F7 toggles this mode). It doesn’t
jump between links so it is a little bit slower, but the
normal navigation (arrow keys, page up, page
down
, etc.) works and the focus/caret/cursor follows
(in contrast to a text editor for page up/down). And text
can be selected and copied like in a text editor.

The biggest drawback is that in practice it is necessary to
switch in and out of caret mode. And there is no indication
of which mode is currently active.


A workaround (proposed by several, but is not
really what I am looking for) can be used if three settings are
changed (to make it practical). After these changes the
first few letters of a link text can be typed and that link
will selected so pressing Enter will open it.

Using the workaround, the screen will jump around if it is a
long page as it does not restrict itself to the current
visible page, but it is usable.

Changes (see below for other versions of Firefox):

  1. Hamburger menu (upper right) → Preferences
    General. Under headline Browsing (scroll down) → Search for text when I start typing

    Turn this option on.

  2. Set option to only go to links; in the address
    bar enter

    about:config

    followed by Enter. Then: press Accept the Risk and Continue!, find the line accessibility.typeaheadfind.linksonly, select the “toggle” icon (e.g. by TABing to it) and change the value to True by hitting Enter.

  3. Turn off case-sensitivity. Set
    accessibility.typeaheadfind.casesensitive to 0 (same
    procedure as for accessibility.typeaheadfind.linksonly, see
    above. When Enter is pressed a dialog box will appear with
    the current value. Type 0 and press Enter).

To use it: type some part of the link. If there are several
possibilities use Ctrl + G (or F3)
to jump between them. Use Ctrl + Enter to
open in a new tab.

For older versions of Firefox

It is the same as the above, except:

Option Search for text when I start typing:

menu Tools/Options/Advanced/tab General/Accessibility/Search for text when I start typing

Opening the about:config page, the button is I'll be careful, I promise.

Platform: Firefox 3.0.6, Windows XP 64 bit SP2.

Firefox has two search keys: / searches any text; ‘ searches for just links. Both continue the search with F3.

Two suggestions:

  1. Hitting the F7 key toggles whether the arrow keys scroll the page or move the cursor. It’s handy for selecting text, but it can also be useful for moving the cursor over top of a link.

  2. Use the MouselessBrowing extension. I haven’t used it in quite some time, but it used to work very, very well.

Tick on “Search for text when I start typing” (Options → *Advanced * → General), and then you can type the text of links and hit Enter, which massively increases speed of navigation.

If I know the text of the link I want to go to, / (quick-find) works pretty well.

I’ve tried all the different methods and addons for keyboard navigation in Firefox, and the two I like the most are:

  1. Press the ' key, type the first few letters of a link and then immediately hit enter.

  2. The Spatial Navigation script that can be found over at userscripts.org. Just like in Opera, you navigate between links with Shift and the arrow keys. It doesn’t come close to the native spatial navigation in Opera, but it works about as well as the Crossfire addon for Chrome.

You could try gleeBox and see if it works for you.

I used Numberfox for a while. It attaches a number to each link on a page so you can use (as Phoshi said) Find As You Type to find the link number. It was a bit cumbersome for me, but it might be what you’re looking for. Unfortunately, it is only for Firefox 2, but if you disable addon update checking, it might work!

Hit-a-hint is an addon that makes a user-defined key a special key which activates alphabetical hints for all the links on a page for easy following. LoL is a fork of HaH that works with Firefox 3.5 and is more actively maintained.

This functionality is quite the same that is implemented also in Vimperator‘s hint mode.

Unfortunately Hint-a-hint doesn’t seem to support more recent browsers and the LoL link is broken and no extension named “LoL” seems to exist in the mozilla addons repository.

Vimium instead seems to be maintained and so far works here.

VimFx

Even before Vimium there was Vimperator for Firefox. In my opinion,
Vimperator has too many features and aggressively changes the default
Firefox appearance and behavior. Vimium is exactly what I need in
terms of added functionality, but for Chrome. That’s why I decided to
develop a similar extension for Firefox.

VimFx will be nice to your browser and to your habits. Promise.

– Anton Khodakivskiy, VimFx’s original author.

saka-key is very promising, building on the ideas from Vimium and cVim, and is supporting both Firefox Quantum and Google Chrome. See the clicking_and_link_hints documentation.

There are currently doubts about its maintenance, but I hope the author will find support to help finalize and maintain this great work.

Tagged : /

Linux HowTo: passwordless ssh from linux to windows

Original Source Link

enter image description hereenter image description here

I am trying to login to Windows without password from a Linux server. I have already installed OpenSSH from GitHub and I’m able to do scp and ssh. I tried copying the authorized_keys to the Windows location. But it’s still not working.
The functionality should be no password prompt for running ssh or scp from linux environment to login/show windows directory.

I tried below commands:

cat .ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'

ssh [email protected] "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

But getting error not able to understand cat and chmod.

Updating the errors

'cat' is not recognized as an internal or external command,
operable program or batch file.

'chmod' is not recognized as an internal or external command,
operable program or batch file.

Do I need to install cygwin? If yes, please help with the implementation.

Any assistance is appreciated. Below is an image of the error.

image of the error

Steps to establish passwordless SSH between Linux ⬌ Windows:

Note:

  • Open a PowerShell console with Administrator privileges and execute all the commands mentioned below in that console only
  • Depending on install path, add C:WindowsSystem32OpenSSH or C:Program FilesOpenSSH to the System Path

Windows Server 2019:

  • Ensure the system is up to date via Windows Update
  • Ensure OpenSSH features are installed:
    • Apps & Features > Manage Optional Features
    • OpenSSH Server and OpenSSH Client should be listed, if they are not: Add a Feature

Windows Server 2012 and 2016:

  1. Download OpenSSH (OpenSSH-Win64.zip)
  2. Extract the contents to C:Program FilesOpenSSH and enter directory
  3. Follow steps 4 – 6 mentioned in the Install Wiki:

    # In an elevated Powershell console, run the following:
      powershell -ExecutionPolicy Bypass -File install-sshd.ps1
    
    # Open the firewall for sshd.exe to allow inbound SSH connections
      New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
    
    # Start sshd (this will automatically generate host keys under %programdata%ssh if they don't already exist)
      net start sshd ; net start ssh-agent
    

Common Steps for Windows Server 2012/2016/2019:

  1. Execute the following, which should show the status as Running for both services:

    Set-Service ssh-agent -StartupType Automatic
    
    Set-Service sshd -StartupType Automatic
    
    Get-Service -Name ssh-agent,sshd
    

    If not running: open Services and start OpenSSH Server and OpenSSH Authentication Agent

  2. For public-private key pair generation, issue ssh-keygen and follow the prompts
  3. Create C:ProgramDatasshadministrators_authorized_keys:
    New-Item -ItemType file "C:ProgramDatasshadministrators_authorized_keys"
    
  4. Append /root/.ssh/id_rsa.pub to C:ProgramDatasshadministrators_authorized_keys
    • If id_rsa.pub does not exist on Linux, generate via: ssh-keygen
  5. Append C:UsersAdministrator.sshid_rsa.pub to /root/.ssh/authorized_keys
    • If authorized_keys does not exist:
      touch "/root/.ssh/authorized_keys"
      
  6. For permission settings:

    icacls "C:ProgramDatasshadministrators_authorized_keys" /remove "NT AUTHORITYAuthenticated Users"
    
    icacls "C:ProgramDatasshadministrators_authorized_keys" /inheritance:r
    
    Restart-Service -Name sshd, ssh-agent -Force
    

Relevant locations on Windows host:

  • C:WindowsSytem32OpenSSH
  • C:Program FilesOpenSSH
  • C:UsersAdministrator.ssh
  • C:ProgramDatassh

References:

The errors say it all.

More or less, your ssh server provides… well, an ssh server. It dosen’t have the ‘unix’ style or linux coreutils you’re trying to run by default.

While swapping this ssh server for cygwin might help – what you literally need to do is understand what you’re doing and not presume linux commands will work.

You can probably get cat on windows – through various native packages of it like the ones bundled with git or GOW

The permissions model probably works differently so you need to do it with native tools.

It needs some reading but this suggests “only System, Administrators and owner can have access”- and this post suggests you can use ICACLS to set the appropriate permissions.

The takeaway is – well you got to understand your tools and realise that you’re not going to find the same environment everywhere.

Tagged : / /

Linux HowTo: Excel VBA, Forward and Reverse calculation

Original Source Link

I want to put a VBA code on my excel sheet such that 2 cells are both input and output of each other depending on which of those 2 cells has been entered last. How can I achieve that? Kindly assist

  • Create new Excel workbook
  • Open VBA editor (Alt-F11)
  • Double-click “Sheet1” on Project pane – its code window will open
  • Enter the below code:
Private Sub Worksheet_Change(ByVal Target As Range)
Static busy As Boolean
If busy Then Exit Sub
busy = True
Select Case Target.Address
    Case "$A$1"
        Range("A2") = "A1=""" & Range("A1").Text & """"
    Case "$A$2"
        Range("A1") = "A2=""" & Range("A1").Text & """"
End Select
busy = False
End Sub
  • Close VBA editor
  • Enter something into cells (manually, copypaste one cell, copypaste range, dragover)
  • Look, investigate
Tagged :

Linux HowTo: Windows 10 Store broken: You’ll need the internet for this

Original Source Link

enter image description here

Tried all suggestions searched online, e.g.
disable proxy, reset app store app, enable/disable IP V6, run a mysterious Power Shell script etc.

None of them worked.

Please share some ideas.


Update 1:

Tried to run Troubleshooting tools in Windows 10,
when I ran to Internet Connections, it shows : detected problem but cannot fix it.

enter image description here

Also ran the Network Adapter, no problem was found.
Ran Windows Store Apps, no problem was found.

After trying more than 10 different approaches by following a link provided by an encrypted post(you will know what I mean once you opened the link) shared by @LPChip, I finally fixed the Windows Store.

Unfortunately, I ran 2 approaches at same time, after that the problem was fixed, so I cannot really tell which one is the fix, but I will list all of them:

  1. Reset Windows Update Components

    Download the zip from here, and Right click the file ResetWUEng.cmd and click Run as administrator.

  2. Clear the Store Cache

    Press Windows Key + R to open Run, then input wsreset.exe and click OK. It takes a while, so be patient.

After these 2 fixes, my store finally started working, so happy~!
enter image description here

Good luck~!

Tagged : / /

Linux HowTo: Explantion for CSRSS.EXE using the GPU

Original Source Link

This is a follow up question to conhost.exe and csrss.exe questions

I am currently on a Windows 7 x64 machine, using a relatively high end GPU (GTX 970 4 GB). Windows Aero is enabled. I am using Process Explorer to examine this case.

I have two csrss.exe processes running, both as SYSTEM, one under session 0 and one under session 1. I have csrss.exe files, both in the correct directories. Using Process Explorer, I can see my GPU is being used only by csrss.exe. The session 1 csrss.exe is using it. Closer examination of the process’s threads reveals these .dll files:

Cdd.dll
Winsrv.dll
Csrsrv.dll

Cdd.dll – the canonical display driver is particularly important here, as described below in some helpful info below a kind user was able to provide for me.

Under DWM, GDI calls are redirected to use the Canonical Display Driver (cdd.dll), a software renderer.

So perhaps it’s something in csrss.exe actually redirecting calls to cdd.dll. Confirmed further by going back to the first Wikipedia article:
instead of issuing a system call, the Win32 libraries (kernel32.dll, user32.dll, gdi32.dll) send an inter-process call to the CSRSS process which does most of the actual work without compromising the kernel.
So application calls to gdi32.dll (which would be anything that renders any Windows GUI component like buttons, scrollbars, text, etc.) end up making their way to csrss.exe via IPC, which csrss.exe redirects to cdd.dll.

So dwm.exe, which I would have presumed would have been using the GPU, is instead someway showing through csrss.exe.

So that at least explains the story partly. When idle at the desktop, GPU usage is > 0.01%. However, if I interact with certain UI elements of a program, for example hovering over the GPU graphs to bring up stock-like windows UI, or hovering over parts of Steams UI (Steamworks is a video game drm client) the GPU usage for csrss.exe rises, maybe a few percent, and depending on what is going on, such as rapidly hovering over Process Explorer graphs, it can go to 15-20%.

I selected the csrss.exe process in question and pressed Ctrl+H. I found threads related to procexp64.exe, steamwebhelper.exe (displays web API for steam.exe, which is also under this csrss.exe), explorer.exe, dwm.exe, and anything that seemed that would create windows/stock UI elements.

I tried Safe Mode and creating a new standard user account, but the same activity occurs.

My question is, is this activity normal? Csrss.exe seems to increase its cycle delta when moving the mouse, and when I hover over auch ui. Is the reason hovering over certain aero elements, or programs like steam that may use certain windows elements causing GPU usage to rise under csrss.exe because that is the process calling cdd.dll? As I said, on idle GPU usage is negligible, which I guess confirms no malicious activity. I suffer no performance issues running high end games with Aero enabled, but I’m wondering if this is normal activity for a high end machine.

Should csrss.exe be using the GPU like this when calling on things
like cdd.dll and winsrv.dll?

Specs:

  • I5 3570k
  • GTX 970 4 GB
  • 8 GB RAM
  • Windows 7, 64-bit

I was just having the same issue. I was going to terminate csrss.exe, but then noticed one thing in Task Manager. The Video Encoder part of the GPU was in use.

So the problem was that my AMD Radeon Crimson ReLive was doing this thing called ‘Instant Replay’ in which the gameplay of last few minutes is continuously captured.
Even though I had disabled ‘Record Desktop’ in settings, it was still recording. So this was just a bug which was using GPU.

TL;DR:
Disable Instant Replay. How to disable it? It depends on what recording/streaming software does your PC has. Just Google it.

Note:
If disabling Instant Replay does not solve the issue, or it is already OFF or you don’t have streaming software, your PC might be infected by a virus or something.

Tagged : / / /

Linux HowTo: Windows 10 won’t hibernate

Original Source Link

My setting is display off after 15 min, sleep after 60 min and hibernate after 120 min.
Just moving mouse won’t wake up the computer, but keyboard typing and mouse clicking would do.

This setting has worked for long time (several month).
Maybe from the last update (12/15) or from the new year, my computer won’t hibernate at all.
Display goes off after specified time, but it won’t sleep or hibernate.

What would be the problem?

Generally this problem will occur if you are running certain software in the background.

IE:

Backup Software
Remote Desktop Software

I have seen this specific problem with both of these type of applications because the software will override the power settings in Windows.

You should look to see what applications you have installed since the last time you remember it working. Once you identify those you should look for things that would potentially want the computer to not sleep. (this should be somewhat obvious) And disable them in startup.

Additionally you could open task manager and go to startup and disable startup applications until you are sure it is working again.

An update or application may have disabled hibernate. Re-enable hibernate from the command line. Start a CMD session as Administrator and enter

powercfg -h on

That should fix the issue.

updating the motherboard BIOS worked for me trust me ive done all i could find on google updating BIOS is the one to go if you have nothing else to do

Tagged : / /

Linux HowTo: Compare framewidth and frameheight in Windows explorer search

Original Source Link

I am trying to sort a large group of videos (1700). I want to separate videos that have a width that is bigger than the height from videos that have a height bigger than the width.

I found online the term below where you can search for videos of a certain width:

framewidth: <=640

I tried to change this to work in my favor coming up with the solution below which does not work:

framewidth: < frameheight

Any ideas how I can sort these videos using the “framewidth” and “frameheight” values?

Windows 10 Pro 64-bit

How to organize your videos:

Explorer does not sort video by dimension. Sort with a batch file, for all video get the width and height, if the width is greater than the height move to %userprofile%Desktop1. If video in more than one directory change dir /b to dir /b /s Make a text file containing name, width, height, duration, bit rate, and sample rate sorted by name, date, size.

Batch file: Sort using md, cmd, for, dir, ffprobe, set, if, and move:

Must be run in a window with administrative privileges.
Add extensions to dir /b *.mp4 *.mkv
For testing clear desktop of directory named 1
Works if whitespace in path.
Download latest ffprobe, ffmpeg, and ffplay for Windows 64-bit from ffmpeg.zeranoe.com
Download test files (5MB) from Google Drive
How to write a batch file

CMD:

cmd /V
if not exist "%userprofile%Desktop1" md "%userprofile%Desktop1"
for /F "tokens=*" %g in ('dir /b *.mp4 *.mkv') do (
for /F %h in ('ffprobe.exe -v error -show_entries stream^=width -of default^=noprint_wrappers^=1:nokey^=1 "%g" 2^>^&1') do set zwidth=%h
for /F %h in ('ffprobe.exe -v error -show_entries stream^=height -of default^=noprint_wrappers^=1:nokey^=1 "%g" 2^>^&1') do set zheight=%h
if !zwidth! gtr !zheight! move /y "%g" "%userprofile%Desktop1"
)
rem 

Script:

setlocal enabledelayedexpansion
if not exist "%userprofile%Desktop1" md "%userprofile%Desktop1"
for /F "tokens=*" %%g in ('dir /b *.mp4 *.mkv') do (
for /F %%h in ('ffprobe.exe -v error -show_entries stream^=width -of default^=noprint_wrappers^=1:nokey^=1 "%%g" 2^>^&1') do set zwidth=%%h
for /F %%h in ('ffprobe.exe -v error -show_entries stream^=height -of default^=noprint_wrappers^=1:nokey^=1 "%%g" 2^>^&1') do set zheight=%%h
if !zwidth! gtr !zheight! move /y "%%g" "%userprofile%Desktop1"
)
rem 

Test files:

input270x480.mp4
input480x270 whitespace.mp4
input480x270.mp4
input270x480.mkv
input480x270 whitespace.mkv
input480x270.mkv

Results:

input480x270 whitespace.mkv
input480x270 whitespace.mp4
input480x270.mkv
input480x270.mp4

Make a text file containing name, width, height, duration, bit rate, sample rate sorted by name, date, size:

CMD:

(
echo Sort by name
echo %date%
echo%time%
echo.)> sortbyname.txt
for /F "tokens=*" %g in ('dir /b *.mp4 *.mkv') do (
echo %g
echo Video Stream0:
ffprobe -v error -select_streams v:0 -show_entries stream^=width,height,duration,bit_rate -of default^=noprint_wrappers^=1 "%g"
echo Audio Stream0:
ffprobe -v error -select_streams a:0 -show_entries stream^=duration,bit_rate,sample_rate -of default^=noprint_wrappers^=1 "%g"    
echo.
)>> sortbyname.txt

(
echo Sort new to old 
echo %date% 
echo%time% 
echo.)> sortNewToOld.txt 
for /F "tokens=*" %g in ('dir /b /o-d *.mp4 *.mkv') do (
echo %g
echo Video Stream0:
ffprobe -v error -select_streams v:0 -show_entries stream^=width,height,duration,bit_rate -of default^=noprint_wrappers^=1 "%g"
echo Audio Stream0:
ffprobe -v error -select_streams a:0 -show_entries stream^=duration,bit_rate,sample_rate -of default^=noprint_wrappers^=1 "%g"    
echo.
)>> sortNewToOld.txt

(
echo Sort large to small 
echo %date% 
echo%time% 
echo.)> sortLargeToSmall.txt
for /F "tokens=*" %g in ('dir /b /o-s *.mp4 *.mkv') do (
echo %g
echo Video Stream0:
ffprobe -v error -select_streams v:0 -show_entries stream^=width,height,duration,bit_rate -of default^=noprint_wrappers^=1 "%g"
echo Audio Stream0:
ffprobe -v error -select_streams a:0 -show_entries stream^=duration,bit_rate,sample_rate -of default^=noprint_wrappers^=1 "%g"    
echo.
)>> sortLargeToSmall.txt
rem 

Script:

(
echo Sort by name
echo %date%
echo%time%
echo.)> sortbyname.txt
for /F "tokens=*" %%g in ('dir /b /a-d *.mp4 *.mkv') do (
echo %%g
echo Video Stream0:
ffprobe -v error -select_streams v:0 -show_entries stream^=width,height,duration,bit_rate -of default^=noprint_wrappers^=1 "%%g"
echo Audio Stream0:
ffprobe -v error -select_streams a:0 -show_entries stream^=duration,bit_rate,sample_rate -of default^=noprint_wrappers^=1 "%%g"    
echo.
)>> sortbyname.txt

(
echo Sort new to old 
echo %date% 
echo%time% 
echo.)> sortNewToOld.txt 
for /F "tokens=*" %%g in ('dir /b /o-d *.mp4 *.mkv') do (
echo %%g
echo Video Stream0:
ffprobe -v error -select_streams v:0 -show_entries stream^=width,height,duration,bit_rate -of default^=noprint_wrappers^=1 "%%g"
echo Audio Stream0:
ffprobe -v error -select_streams a:0 -show_entries stream^=duration,bit_rate,sample_rate -of default^=noprint_wrappers^=1 "%%g"    
echo.
)>> sortNewToOld.txt

(
echo Sort large to small 
echo %date% 
echo%time% 
echo.)> sortLargeToSmall.txt
for /F "tokens=*" %%g in ('dir /b /o-s *.mp4 *.mkv') do (
echo %%g
echo Video Stream0:
ffprobe -v error -select_streams v:0 -show_entries stream^=width,height,duration,bit_rate -of default^=noprint_wrappers^=1 "%%g"
echo Audio Stream0:
ffprobe -v error -select_streams a:0 -show_entries stream^=duration,bit_rate,sample_rate -of default^=noprint_wrappers^=1 "%%g"    
echo.
)>> sortLargeToSmall.txt
rem 

Windows Explorer is not the right tool for such operations.
PowerShell is much more suitable.

You could use the following PowerShell script to move all images whose
width is less-than the height to another folder:

$image = New-Object -ComObject Wia.ImageFile
foreach ($item in Get-ChildItem "C:sourcefolder" | Where-Object Extension -In ".jpg", ".bmp", ".png") {
    $image.LoadFile($item.fullname)
    if ($image.Width -lt $image.Height) {
        Move-Item -LiteralPath $item.FullName -Destination "C:targetfolder"
    }
}

You could run this script directly from PowerShell or from the Command Prompt:

powershell -File script.ps1 -ExecutionPolicy Unrestricted

Tagged : / / / /

Linux HowTo: %PROMPT% variable resolved differently if set directly in CMD or by Windows variables tool

Original Source Link

When trying to customize my command prompt I faced a strange behaviour:

from the CMD the line

SET set prompt=$D $T$H$H$H$_%USERNAME%@%COMPUTERNAME%$_$P$G

works as expected:

28/05/2020 12:02:15
[email protected]
C:UsersDDS>

But if I set the same variable EDIT: (in “variable for user DDS”) with the very same values from the windows utility to set variables I got:

28/05/2020 12:04:18
[email protected]
C:UsersDDS>

NOTE: the utility itself is showing the value correctly DDS when editing the variables, just the command prompt resolves %USERNAME% to SYSTEM

When you execute this from the system app, it is run under the SYSTEM user.

Keep in mind that the variables are not updated with every prompt. This means that if you were to change your username, your prompt does not. It becomes a static text. Given that you use prompt variables for the date, they get updated, but the computername and username are not.

I don’t think this is going to be a massive problem, but you can do 2 things to resolve this. Either not use %USERNAME% but just write out your username (it doesn’t matter anyway) or use the command prompt to set the prompt correctly, then push that to the system using:

setx PROMPT %PROMPT%

To test this, try using %CD% in your prompt, then change directory. Notice how your prompt still shows the old directory.

Tagged : / /