New answers tagged

0

I also liked Qwertiy's answer best. Here is a script (works for an arbitrary number of files, also for .mov; tested on macOS): #!/bin/bash if [ $# -lt 1 ]; then echo "Usage: `basename $0` input_1.mp4 input_2.mp4 ... output.mp4" exit 0 fi ARGS=("$@") # determine all arguments output=${ARGS[${#ARGS[@]}-1]} # get the last argument (...


2

Yes, it is legal. FFmpeg is released under GNU Lesser General Public License (LGPL) version 2.1 or later. Some external libraries like libx264 get released in GPL 2 or later. But both of them have permissions for free/commercial usage, distribution, or modification. So you can use FFmpeg in your both commercial or free software. And you can release the ...


0

For fish shell: Since no one has made a solution for the fish shell, I'd like to give it a try. Just making a Fish version out of the answers given here, so consider this, Fish Shell edition. 😎 1st solution is based from @Grigory K answer. Solution #1 Fish version would be like this: function cd_up cd (printf "%.s../" (seq $argv)) end alias '...


0

Just run this in a script to solve all your problems: Using Chris' solution: This is an elaborate answer, however I solved my problems by building on Chris' solution, and I find it far better then KDE's built-in wallpaper functionality - which only works on a single monitor. Works on all monitors - Just change the variables sleeptime AND location at the top -...


1

Actually the answer is No. ping is a troubleshooting command line tool which's task is to send ICMP packets to other host. When we ping any IP address it generates ICMP Echo Requests, if the packet can reach the destination successfully the destination device will respond with ICMP Echo Response. The main purpose of this is to check if a server, website or ...


1

Microsoft has made it much more difficult to view protection history. To open Defender, use a shortcut to ms-settings:windowsdefender ... but then as you state you must manually open Virus & threat protection, which then runs SecHealthUI.exe in "C:\Windows\SystemApps\Microsoft.Windows.SecHealthUI_cw5n1h2txyewy". Trying to open that executable ...


0

man pivot_root tells: Note that exec chroot changes the running executable, which is necessary if the old root directory should be unmounted afterwards. Same goes for a few other resources as mentioned afterward. Without chroot to the newer filesystem the umount command will fail with EBUSY, because the shell's process is still keeping a resource usage in ...


0

Have you already have a look as possible ssh agent forwarding that the x2go client might use silently? (sorry, cannot comment at that time)


0

All of the functions mentioned in http://zsh.sourceforge.net/Doc/Release/User-Contributions.html need to be autoloaded before you can use them. You don't need to add them to your $fpath, though; Zsh will be able to find them automatically. So, to get access to zmv, you simply need to add the following to your ~/.zhsrc file: autoload -Uz zmv alias zcp="...


0

Here's how to do it properly in Zsh, with arrays: common-files() { file-names $1 && local -a files_a=( $reply ) file-names $2 && local -a files_b=( $reply ) # `:*`: Keep only the items common to both. # `(F)`: Join the items with newlines. print ${(F)files_a:*files_b} } file-names() { # `.`: Match only files (not dirs). # `D`:...


0

I adjusted your script to Powershell: $hide = (Get-ItemProperty -path $USERKEYPATH\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced).Hidden If ($hide -eq 0) { Set-ItemProperty -Path $USERKEYPATH\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name Hidden -Value "1" } IF ($hide -eq 1) { Set-ItemProperty -Path $...


1

Simeplest solution I could think of: sort -u file1.txt file2.txt > result.txt


0

It seems that --strip-components and -C options need to precede the file to extract, otherwise they are silently ignored. I suppose the man page hints at this tar -x [-f ARCHIVE] [OPTIONS] [MEMBER...] But in some contexts (https://askubuntu.com/a/45354/596667) it seems to be ok at the end. The correct command line is thus mkdir outdir && curl -L '...


0

the PYTHONPATH enviromental variable needs to include the complete path #!/usr/bin/env xdg-open [Desktop Entry] Name=Cura GenericName=Slicer application Comment=Prepare model for 3d printing MimeType=model/stl;application/prs.wavefront-obj;application/vnd.ms-3mfdocument;text/x-gcode Icon=cura-icon Type=Application Categories=3DGraphics;GUIDesigner;Graphics ...


1

Try this: @echo off cd "G:\Movies" for %%a in (*.mkv) do ( ffmpeg-normalize "%%~fa" -n -p >>"Out_%%~na.txt" ) exit /b 0 Will create output files in syntax "Out_Filename.txt"


1

cd is a shell builtin command, so just use builtin cd "$@" to get the original behavior. There is also command ... but which applies only to external commands in zsh. Both are explained in man zshbuiltins or have a look into the PRECOMMAND MODIFIERS section in man zshmisc.


0

cd /d "c:\dir_B" && for %i in (*)do if exist "C:\Dir_A\%~nxi" echo\Del "%~i" /q /f ` 1. Go to Dir_B folder: pushd "D:\Dir_B" 2. Use one simple for loop to list yours files: for %i in (*)do... 3. Test if exist your file in Dir_A folder: if exist "D:\Dir_A\%~nxi" 4. If last command return true, ...


1

For me it was caused by the executable being set to run as administrator in the compatability settings. To fix this: Right-click on Python.exe Click Properties → Compatibility Uncheck Run this program as an administrator


0

You can search for a list of files in "Everything" by delimiting with |. For example: file1|file2|file3|file4


0

I like the following approach: du -schx .[!.]* * | sort -h where: s: display only a total for each argument c: produce a grand total h: print sizes in a human-readable format x: skip directories on different file systems .[!.]* *: Summarize disk usage of each file, recursively for directories (including "hidden" ones) | sort -h: Sort based on ...


2

adding a second % before N apparently fixed it. set Logpath="C:\Users\bob\Desktop\project\a.txt" set StringToLookFor="asdf" set NUM=0 for /F %%N in ('find /C %StringToLookFor% ^< %Logpath%') do set NUM=%%N pause echo %NUM%


0

If you need it to pause for a specific amount of time, how about using timeout? timeout /t 5


0

Windows 10 Command Prompt Can Be Closed using ALT+F4 Hotkey claims that this problem affects only Windows up to 8.1. Windows 10 Command Prompt duly responds to ALT+F4 It also mentions that Alt + F4 can be disabled in Windows 10 to mimick the old behaviour by creating a registry key REG_DWORD AllowAltF4Close set to 0 in HKEY_CURRENT_USER\Console.


1

If you wanted to empty the folder, my take is: @ECHO OFF :choice cls set /P c=Which directory? [Desktop, Documents, Downloads, Pictures] if /I "%c%" EQU "Desktop" set Point = "Desktop" if /I "%c%" EQU "Documents" set Point = "Documents" if /I "%c%" EQU "Downloads" set Point = &...


0

vlock is what you are looking for. I have never used it before, but I just tested it on Kubuntu and it locked the console and the processes running in the background continued to run. From die.net: vlock is a program to lock one or more sessions on the Linux console. This is especially useful for Linux machines which have multiple users with access to the ...


0

No need to script this, Use the built-in enterprise-ready solution for such use cases. Software Restriction Policies Technical Overview ... Software Restriction Policies | Microsoft Docs Administer Software Restriction Policies | Microsoft Docs Work with Software Restriction Policies Rules | Microsoft Docs Use Software Restriction Policies and AppLocker ...


2

I found this in a comment on the simalar post that at first i thought only renamed things in the foler its executed in. It seems to work Get-ChildItem "C:\path\to\folder" -recurse | Where {-Not $_.PSIsContainer} | Rename-Item -NewName {$_.FullName.ToLower()}


0

PowerShell: Verbose, Files $Source = 'c:\TopFolder' ( Get-ChildItem $Source -File -Recurse ) | Rename-Item -NewName { $_.Name.ToLower() } Key-Banger, Files: (gci 'c:\TopFolder' -af -r) | ren -new { $_.Name.ToLower() } For folders, to avoid Source/Destination errors, you have to rename to a temp value as an intermediate step. Here's one way: gci -ad -...


0

Based on Is there a way to batch rename files to lowercase, here is a formulation that does files and folders recursively: for /f "Tokens=*" %f in ('dir /l/b/s') do (rename "%f" "%f")


0

Try this powershell code: Get-childItem "Filepath" -Recurse | Rename-Item -NewName {$_.Basename.tostring().tolower() + $_.extension} This will recursively rename all files and folders in "Filepath" to lower case.


0

Microsoft does not install Software from within WinPE to the full OS but rather reboots, let's Windows do it's configuration and then hooks itself into the now running real OS and continues the isntallation from there. The method used afaik is the setupcomplete.cmd file. This is basically an normally empty file that is always executed at the end of a windows ...


1

Assuming your executable is a console application, you don't need start: %comspec% /k "cd /d "c:\Python27" && python.exe" rem :: or.. %comspec% /k "pushd "c:\Python27" && python.exe" rem :: or, with arguments %comspec% /k "pushd "c:\Python27" && "python.exe" args[0] ...


2

You can use this: cmd.exe /k "cd /d "Filepath" & start program.exe" /k switch tells to keep command prompt open after command execution. cd changes directory to the file path, /d switch makes it safer because without this switch over-drive paths cannot be changed. Then start the program. You can create a shortcut. Right click on ...


1

I think what you're asking for is something like this in a .bat batch file Create a new file called shortcut.bat. In the file create the following: cd c:\path to file\ Start program.exe pause When you run shortcut.bat it'll fire up a command window, start your program and leave the command window open.


0

@echo off cd /d "%~dp0" setlocal enabledelayedexpansion for /d %%i in ("* - *") do 2>nul ( echo\ & set "_Folder=%%~i" echo\Folder found: ...\!_Folder:*\=! cd /d "%~dp0!_Folder:*- =!\." ) && 2>nul ( echo\Folder "!_Folder:*- =!" exists... & cd.. ) || 2>nul ( echo\Folder: ...\!_Folder:*- =! does not exist, creating... mkdir "%~...


0

Try: &cmd /c "mysql -u user --password=pass dbname < backup.sql" You're essentially running in cmd in this case, but it's my preferred way of doing it as using < in PowerShell itself will not work (until it does one-day :P). Also, I recommend putting the path to your mysql executable into your PATH environment variable so you can simply ...


0

This is not a Powershell specific thing. It is an industry format specification. So, just search the web for each encoding individually to get the details. https://en.wikipedia.org/wiki/UTF-8 Such discussions are had for example: MicrosoftDocs/PowerShell-Docs https://github.com/MicrosoftDocs/PowerShell-Docs/issues/4021 What's the difference between UTF-8 ...


0

Exist also another way to escaping space: ^< nul cd /d C:\Program Files ^< nul cd /d Temporary ASP.NET Files ^< nul cd /d c:\documents and settings The idea came from ​​a bug addressed on the dostips.com: Bug/Mystery in the phase parsing rules 1.5 and 2 CR vs redirect


0

It turns out that I have an x64 processor but installed the x86 version of Powershell. Both issues were resolved by installing the x64 version of Powershell instead.


1

Try this from powershell: Get-ChildItem "Filepath" -Recurse | Where-Object {$_.PSIsContainer -eq $false} | Remove-Item


5

Run the Command Prompt and enter the following commands: cd /D "your folder" del /S /Q *.* This will list all the files as they are being deleted. To not see this, change the second command to: del /S /Q *.* >nul


1

I added the -n option and the problem was solved. I had added LS_COLOR to the .bash_profile file.


0

The syntax proposed in the answers frankly is unintuitive and meh. You should be able to go back simply by repeating the period i.e. cd ... or cd .... https://github.com/parkercoates/dotfiles/blob/master/.zsh/expand-multiple-dots.zsh or https://github.com/knu/zsh-manydots-magic


3

I highly suspect the "contents of the list.txt file" you posted is an interpretation (representation) of the actual content, not the literal content. Then it makes sense. <0x1b> is what the program you used to view the file prints to represent the (unprintable) ASCII escape character (in various circumstances the character may be referred to ...


1

Another way to do the job without capture groups: rename 's/(?<=\d)_(?=\d)/:/' something* Explanation: s/ # substitute (?<=\d) # positive lookbehind, make sure we have a digit before _ # underscore (?=\d) # positive lookahead, make sure we have a digit after / # with : # ...


1

Try: rename 's/([0-9])_([0-9])/$1:$2/' Example Consider a directory with this file: $ ls som* somethingblabla15T06:58_31+0000somethingblabla.bla Let's run rename and then run ls again: $ rename 's/([0-9])_([0-9])/$1:$2/' s* $ ls som* somethingblabla15T06:58:31+0000somethingblabla.bla How it works ([0-9])_([0-9]) matches a digit followed by an underscore ...


0

If you have Git installed, it comes bundled with create-shortcut.exe which allows you to create shortcuts from the command line, and works in Windows 10. This utility is not AFAICT publicly documented, and the --help is minimal: Usage: create-shortcut.exe [options] <source> <destination> However, using Sysinternals's strings utility to extract ...


-1

Did you mess around with the PATH variables? Right click This PC → Properties → Advanced System Settings → Advanced tab → Environment Variables In System variables, edit Path Make sure that these paths are defined in the Path variable: C:\WINDOWS\system32 C:\WINDOWS


0

An example using find: (type "sourcefile" | find "Meghana" 2>nul) >"targetpath"


1

On Windows, I managed using the tip from @zacharyliu. For laymen and for those who like portable things I easily did it using Cmder. Download Cmder. I use the portable version with full installation Extract Cmder Open the folder and enter the bin folder (in the same folder as the executable, if not, create one) Download the NirCmd files (link at the ...


Top 50 recent answers are included