batch-file

Launching multiple shell prompts from a single batch file

我的未来我决定 提交于 2020-01-25 02:55:09
问题 I have a set of DOS commands that I need to run in different shell instances. Is there a single batch file I can write that would set of multiple cmd instances and execute the set of DOS commands in each of the prompts? 回答1: Your question seems to boil down to how to run a different series of commands in each instance of cmd.exe without having multiple command files. There's a reasonably straightforward way of doing this. The idea is to run the same command file in each instance of cmd.exe,

Powershell to Create a zip (or 7z) of each file in a folder then delete original file

ぃ、小莉子 提交于 2020-01-25 02:30:47
问题 I have a folder with a Ton of iso images. I've found that a lot of the images have dummy data in them to reach the size of the original DVD. I can save an enormous amount of space by zipping them up. I tried creating a batch file but it failed to work properly. So, I basically want it to create a .7z for each file in a folder, then delete the original file. Here's what I got. It zips the files but it fails on removable of the files afterwards. Can't figure out why: function zipFiles() { dir *

Powershell to Create a zip (or 7z) of each file in a folder then delete original file

眉间皱痕 提交于 2020-01-25 02:30:12
问题 I have a folder with a Ton of iso images. I've found that a lot of the images have dummy data in them to reach the size of the original DVD. I can save an enormous amount of space by zipping them up. I tried creating a batch file but it failed to work properly. So, I basically want it to create a .7z for each file in a folder, then delete the original file. Here's what I got. It zips the files but it fails on removable of the files afterwards. Can't figure out why: function zipFiles() { dir *

start batch file in fullscreen mode

谁都会走 提交于 2020-01-25 00:16:07
问题 How can I start a batch file in full-screen mode? I know that this question was asked before, but it wasn't actually answered. unfortunately, I don't know reverse engineering, so I cant decompile the code. Here is something I tested: @if (@CodeSection == @Batch) @then @echo off rem Use %SendKeys% to send keys to the keyboard buffer set SendKeys=CScript //nologo //E:JScript "%~F0" start cmd.exe %sendkeys% "(%{enter})" goto :EOF @end // JScript section var WshShell = WScript.CreateObject(

CMD script: Reading and saving the last word of each line (multiple lines)

£可爱£侵袭症+ 提交于 2020-01-24 23:33:08
问题 My question is about finding and saving the last word of each line. I have multiple lines. This information is saved in a .txt file. Thus, I am required to build a CMD script that can scan through the txt file, find the last word of each line and save it to a new .txt document. The delimiters here will be the space . For example: It's a very small window<34>. The small birds were singing softly. There are three small rooms up stairs (4) The house has but two small second story bedrooms. The

CMD script: Reading and saving the last word of each line (multiple lines)

让人想犯罪 __ 提交于 2020-01-24 23:32:39
问题 My question is about finding and saving the last word of each line. I have multiple lines. This information is saved in a .txt file. Thus, I am required to build a CMD script that can scan through the txt file, find the last word of each line and save it to a new .txt document. The delimiters here will be the space . For example: It's a very small window<34>. The small birds were singing softly. There are three small rooms up stairs (4) The house has but two small second story bedrooms. The

Run Powershell script via batch file with elevated privileges

谁说胖子不能爱 提交于 2020-01-24 22:20:21
问题 I need to run a Powershell script to create AD user via a batch file. The thing is I need to run this PS script with elevated privileges (domain admin account). I have tried to script a '.bat' file which encloses all this information but I have been unsuccessful so far. Here is the script : echo off cls echo Sign in with your ADM ID set /p username= powershell -noprofile -command "&{ start-process powershell -ArgumentList '- noprofile -file C:\Users\...\Desktop\Powershell_scripts\New-ADuser

Why is the error message “Missing operand” output on processing WMIC output and assigning a value to a variable?

浪尽此生 提交于 2020-01-24 22:20:07
问题 I am working on a batch file that is supposed to show the currently estimated charge remaining. But when I run the command I get the desired result plus the error message Missing operand. output. My code: FOR /F "delims= skip=1" %%i IN ('WMIC PATH Win32_Battery Get EstimatedChargeRemaining') DO (SET /a CHR=%%i) ECHO "Battery Level: %CHR%" How can I get rid of that undesired output Missing operand. ? I have already tried to remove % from the last part, i.e. DO (SET /a CHR=i) , but when I do so

Can I enable/disable a network connection from the command-line or MS-Dos?

空扰寡人 提交于 2020-01-24 21:12:47
问题 I want to enable/disable a network connection from the command-line in Windows 8. netsh interface set interface “Local Area Connection” DISABLED To enable the interface, you'd then run: netsh interface set interface “Local Area Connection” ENABLED When I try this, it generates an error message which states that "no more data is available". 回答1: This works for me: netsh interface set interface name="Local Area Connection" admin=DISABLED 回答2: This may be enough for you if you are using DHCP.

Text utf-8 in console works in eclipse, but fails to work with an exported jar

六眼飞鱼酱① 提交于 2020-01-24 20:59:34
问题 I'm developping a java application, and I get some problems with Output, files, console, So about the files I figure out how to right using utf-8, but I can't figure out to set the encoding in the console. This is a simple test that I use it in my eclipse, then I generate a jar, and I execute it using a .bat file. public class Test { public static void main(String[] args) { System.out.println("Initialisée la procédure"); } } This is the result when I execute my Jar using this bat file: "C: