Questions tagged [batch]

A batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the command interpreter under MS-DOS and Microsoft Windows.

This was the first extension used by Microsoft for batch files. This extension runs with MS-DOS and all versions of Windows, under COMMAND.COM or cmd.exe, which execute its commands, normally line-by-line.

339 questions
0
votes
1 answer

Looking for a way to replace every instance of a non-zero sized file in a directory tree using a batch file

I am trying to figure out a way to have a batch script overwrite every instance of a non-zero byte file inside of a specific directory and its sub-folders. I'm guessing since I'm looking for a non-zero file I could probably loop it with a escape if…
wb6vpm
  • 23
  • 5
0
votes
1 answer

Batch - Extract string before the specified character

How to get the string before the character hyphen? The following code gets the string after the hyphen. How can I reverse this? set string=1.0.10-SNAPSHOT echo %string:*-=% SNAPSHOT But I want the 1.0.10 instead of SNAPSHOT of if the string is…
user630702
  • 495
  • 10
  • 32
0
votes
0 answers

How to write a batch job query that has wait times, dependencies and conditional execution?

I'm trying to write a batch job that executes via task scheduler. The objective is to run these exe jobs sequentially. However, some of these jobs have dependencies on others. for eg. job1.exe (no dependencies. exe for an API call) job2.exe (no…
0
votes
0 answers

batch folder rename on macos / linux

I have 500+ folders which are named with this pattern: May 2020 The folders contain photos, but for some reason the photos creation date in the meta is wrong, or was overwritten. The correct creation date, is the folder name. So in order to get…
zippy-flop
  • 21
  • 4
0
votes
0 answers

Extracting multiple password-protected archives located in multiple sub-directories

There is a folder that contains many folders and subfolders, and each of these contains any number of password-protected 7zip archives. The password is the same for all of them. These are single-layer archives (no archives within archives). I am…
Bamba
  • 1
  • 1
0
votes
1 answer

How do I Pipe in Skip or Overwrite All when running the following bat?

How would I Pipe in Skip or Overwrite All (Always) to the following code? NB! the code recursively extracts archives with folders and sub-archives. FOR /D /r %%F in ("*") DO ( pushd %CD% cd %%F FOR %%X in (*.rar *.zip) DO ( …
JTech
  • 1
  • 1
0
votes
1 answer

enter username and password in a batch script

I run the below code that is log in to a server and after login, it's enter 1 and go to the next line but after that, I need to enter the username and password. help me to complete the code. @if (@CodeSection == @Batch) @then @echo off rem Use…
0
votes
1 answer

Allow domain user run batch files only from specific network folder

Googled about this but did not find the answer, Id like to give my domain users the ability to run batch files ONLY from network shared path which i'll create and put the files into. is it possible to do it by GPO ?
0
votes
1 answer

Fast File Copy script in Windows

I have a process that is run every month or so. Such process identifies a set of files and constructs a proper source and destination path from several fields of different tables in DB to then copy all of these files, so I end up with potentially…
0
votes
2 answers

sendMail.exe alternative

Have a bunch of in-house batch scripts and what-not that utilize sendEmail.exe, which is an old perl auto-emailer application which can be found here: github for sendEmail.exe The problem is that with our migration to office365, and our security…
d34db33f
  • 98
  • 1
  • 8
0
votes
1 answer

Windows Batch: Command FOR /F and Tokens, How can I ser variable from token X until end of the line?

Ok, I been struggling with this for days now. I have a little complex script but at the end I just need to set a variable from a Token 4 to the end of the line. Basically I run a command and the output has some words in the beginning that I don't…
DefToneR
  • 527
  • 6
  • 14
0
votes
0 answers

How to create a Shutdown Script for Server 2016

I have a Windows 2016 server running an Oracle database that needs to be manually shutdown before the server shuts down. I enabled the local GPO (Computer Configuration > Windows Settings > Scripts > Shutdown) and attached the shutdown script to it…
0
votes
1 answer

Read Local "HKEY_CURRENT_USER" from another user, windows batch/powershell

Ok is a tricky question, I know. I have a software that runs validation scripts in all computers in network. I can create my own scripts too. But I found a problem that the script runs as specific user with admin rights. So, when my script checks…
DefToneR
  • 527
  • 6
  • 14
0
votes
1 answer

RDP into a machine with out a user password

The computers dont have passwords, even the admin account ass they are training units. But we cant RDP into them with out passwords. I know the settings are at Windows Settings\Security Settings\Local Policies\Security Options\Accounts: Limit local…
0
votes
1 answer

Get the previous day date as variable in batch file from powershell command output

The scenario is like this. I need a previous day date (i.e. Today -1) as variable in a batch file. But if previous day is Sunday (i.e. script running on Monday) it should return the Saturday's date (i.e. Today -2). I have tried the below script but…