Questions tagged [batch-file]

batch files are simple text files executed in a command to achieve a particular task or a set of tasks

batch files are text files containing commands executed in sequence to achieve a particular task or a set of tasks. They can be very simple, or can contain complex logic.

440 questions
0
votes
1 answer

How can I redirect the output of one command in a batch file?

Edit: This question has been answered, please scroll down ⬇️ This question is related to Server Fault because I am automating minifying some web files before deploying them to my server. So I have a batchfile which calls minify like this: minify…
0
votes
0 answers

"Invalid drive specification" when copying files

Currently using XCOPY via a BATCH file which I created, in order to copy files over from a client computer to a mounted drive created in Azure. I have been using the XCOPY function for some time, which as worked perfectly. However, I have created an…
0
votes
1 answer

Nagios BAT file not returning correct status code

I've written a batch file for a Windows server to detect whether a particular service is running and if it isn't, return a Critical status back to Nagios. The script works perfectly (as in, it can tell if the process is running or not, I've tried…
0
votes
1 answer

Group Policy scheduled task for running .bat file applies, but task does not create

I am trying to add a scheduled task to run a batch file that updates / installs software. I created a GPO to create the task, using these settings: Task Settings Task settings 2 Task settings 3 For one of them, I am using item level targeting to…
0
votes
1 answer

Erased System Path Variables

I was writing a batch file that was supposed to automatically set up a computer to receive "psexec" remote commads. Unluckly i didn't really pay attention to what i was writing and i wrote this command and then ran It: setx /M Path…
0
votes
1 answer

Run batch file to start specific program to open at specific record

I need to be able to run a batch file that opens Access at a specific record. This I can do, but now I need to also run it on either 32 or 64 bit systems. Our company uses a mix of systems. This is what I have so far: if EXIST "C:\Program…
0
votes
0 answers

Best Method For Clearing User Data On Shared Windows Device?

I have had a client request that I setup a user account on a Windows device that will clear all user profile data once the account has been logged off. The computer is a shared device that will be used by guests and there cannot be any reference to…
0
votes
0 answers

Why Would a Log File Get Cut Off When Emailed?

I am setting up some local backups of AWS EC2 instances. The backups are set to run overnight via Windows Server 2012 R2 Task Scheduler. The basic flow of each backup is that an rsync copies the current instance to local storage, the local storage…
0
votes
1 answer

running batch file as administrator privilege in clients with gpo(scripts/logon)

I want to run a batch file on all my domain clients via gpo(scripts/logon), but the problem is that to run a batch file, administrator privilege is required. I wanted to know is there any command or script to put the username and password of the…
0
votes
3 answers

cmd - run a batch file after all other concurrent batch files finish

I have a simple batch file which calls other batch files, it looks like this: start /b run_part1.bat start /b run_part2.bat start /b run_part3.bat start /b run_part4.bat run_last.bat // fires immediately, how to make this line wait until above…
Cal
  • 189
  • 1
  • 2
  • 7
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

GPO to detect if application is installed, if not install it and then create log file

@echo off IF NOT EXIST "C:\Program Files\APPLICATION_DIR" ( msiexec /q /i "https://www.SOME-WEBSITE.com/software/APPLICATION_NAME_x64.msi" LICENSE_KEY="LICENSE_KEY_GOES_HERE" && echo APPLICATION_NAME script install on %computername% >>…
0
votes
1 answer

Delete all folders on all drives with "foo" OR "bar" in the folder name with batchfile

I am trying to delete all folders on all drives with the above naming pattern, however only on the first folder level, i.e directly below the drive letter, like for example: F:\this folder's name contains FOO and should be deleted ...without…
David.P
  • 119
  • 6
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