batch-file

Query Certificates for SHA1 / SHA2 / SHA256

北慕城南 提交于 2021-02-08 10:26:02
问题 I know we can do this in PowerShell. (Get-ChildItem Cert:\Currentuser\My\ | Select -Property SignatureAlgorithm -ExpandProperty SignatureAlgorithm).FriendlyName Results: sha256RSA sha256RSA Ref.. https://blogs.technet.microsoft.com/poshchap/2017/10/20/one-liner-get-signing-algorithm-for-personal-store-certificates/ However, corporate will not allow us to run PowerShell in the field. I can run the following and get the certs installed for the Intermediate and Root Stores. certutil -store CA

Rename Files having EmDash using a Batch File

白昼怎懂夜的黑 提交于 2021-02-08 10:24:18
问题 I have a ton of files containing em dashes within the file name. I am having trouble renaming them, as cmd apparently fails to recognize it, and converts emdash into a regular dash. As a result I get the following error after I run the ren command: ren "MyFile With – EmDash.txt" "MyFile.txt" The system cannot find the file specified. Things I have tried Inserting chcp 65001 at start of batch code. This command does not seem to work. Saving the batch file as ANSI in Notepad What this does is

Query Certificates for SHA1 / SHA2 / SHA256

落爺英雄遲暮 提交于 2021-02-08 10:24:09
问题 I know we can do this in PowerShell. (Get-ChildItem Cert:\Currentuser\My\ | Select -Property SignatureAlgorithm -ExpandProperty SignatureAlgorithm).FriendlyName Results: sha256RSA sha256RSA Ref.. https://blogs.technet.microsoft.com/poshchap/2017/10/20/one-liner-get-signing-algorithm-for-personal-store-certificates/ However, corporate will not allow us to run PowerShell in the field. I can run the following and get the certs installed for the Intermediate and Root Stores. certutil -store CA

Multi Select Menu

为君一笑 提交于 2021-02-08 10:14:32
问题 Good day! Recently I made thread, where I asked, how to create, or is it possible to create Tickmenu in Batch. One of those who answered was - Dennis van Gils, who kindly presented his Multi Select menu. Here is code: @echo off setlocal EnableDelayedExpansion set "getKeyMacro=powershell -noprofile "^ while (-not (37..40+13).contains($x)) {^ $x = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown').VirtualKeyCode^ }^ if ($x -eq 13) {^ 'enter'^ }^ ('left','up','right','down')[$x - 37]^ "" set "num=0

Execute PS from bat for Intune Win32

痴心易碎 提交于 2021-02-08 09:36:12
问题 I am so confused and actually also not so familiar with PS and bat after my troubles with them. I want to set the Lockscreen in Windows 10 with Intune through an IntuneWin file (WIN32 application). I have a folder with the image, which I want to set, a copy.bat which should copy the image in the directory and also execute the PS file for setting the login image and a del.bat for deleting the image. copy.bat md %AllUsersProfile%\sz copy /Y Wallpaper.jpg %AllUsersProfile%\sz powershell

wmic output to file without addtional line issue

守給你的承諾、 提交于 2021-02-08 09:36:11
问题 I've looked at all these threads and posts: Thread: https://superuser.com/questions/1082530/how-can-i-remove-the-last-blank-line-of-a-wmic-command Thread: How can I remove empty lines from wmic output? Thread: Parsing WMIC output Post: https://stackoverflow.com/a/37725658/8262102 So far and none help and most of them use findstr /r /v "^$" to do this. The issue with them all is that in my case the output contains an additional line when written to a file. My desired output to file should be:

Batch file using WMIC not working correctly with TaskScheduler (but working fine from command line!)

余生颓废 提交于 2021-02-08 09:21:36
问题 I decided to write a small batchfile to make daily copies of a folder and its contents. I used WMIC to properly format the date in order to name the folders automatically. While it works perfectly on the command line, it seems that it dislikes being executed by the TaskScheduler - it does make a copy of the folder, but doesn't retrieving any date, and saves the files into a folder named -~-2-~-2 . It seems to skip the first part of the code altogether, and jump directly to the Pad digits part

Passing Powershell variable to Windows Batch file

五迷三道 提交于 2021-02-08 09:16:30
问题 Due to restrictions around my project and how this is being deployed, I need to run a powershell command in a batch file and echo a variable from the powershell script. This scripts retrieves a model number from a TV over RS-232 and returns the model in HEX. I wrote the script and meticulously condensed it to one line that runs. I can even 'powershell -command "[myCondensedScript]"' in the command line and it works great for /F %%a in ('powershell.exe -command "$port = New-Object System.IO

“SFC” output redirection formatting issue - Powershell / Batch

大憨熊 提交于 2021-02-08 08:35:23
问题 I'm working on a powershell script in which several commands output are shown in the window and appended to a file or a variable. It worked correctly until I used the sfc command. When piped or redirected, the output is "broken": > sfc /? Vérificateur de ressources Microsoft (R) Windows (R) version 6.0[...] > sfc /? | Tee-Object -Variable content V Ú r i f i c a t e u r d e r e s s o u r c e s M i c r o s o f t ( R ) W i n d o w s ( R ) v e r s i o á 6 . 0[...] Are there other commands like

How to automatically download a specific file type from within a wildcard folder on an FTP server

我怕爱的太早我们不能终老 提交于 2021-02-08 08:34:25
问题 I'm trying to set up a way to automatically download all .mkv files on an ftp server within a folder of which I won't know the whole name. The most I will know is The.Walking.Dead.* Where star represents what I don't know of the folder name. Currently I'm using WinSCP and the closest code I've gotten from here is @echo off "C:\Program Files (x86)\WinSCP\WinSCP.com" ^ /log="D:\Documents\WinSCP Log\WinSCP.log" /ini=nul ^ /command ^ "open "ftp://ivay.myseedbox.site/downloads/manual/" ^ get "/The