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
3
votes
1 answer

wevtutil requires Run As Admin for Security log (but not for System), or how to Run As Admin for Task

I'm using this query to check for certain Exchange account changes on my Windows 2008 R2 AD primary: wevtutil qe Security /q:"*[System/EventID=5136]" /f:text /rd:true /c:1 I'm making a batch file out of it in order to send the event's contents as…
3
votes
1 answer

batch - File last modification time with seconds

I want to know when a file has been modified for the last time. I can get these infos using the following batch script: FOR %%i IN (myfile) DO SET modif_time=%%~ti The problem is how to get the second of the last modification ? and the command %~t…
3
votes
1 answer

trying to copy security groups to a user using dsmod group utility in AD

I am trying to create a batch file that asks to enter source samid and destination samid. Then using dsquery and dsget find out what security groups source samid is assigned to and assign destination samid to those security groups using dsmod.…
newbie
  • 51
  • 3
3
votes
1 answer

Why does robocopy take 8 hours to transfer one files that is 70-80gb?

We have a scheduled task that runs every night and copies a file of around 70-80gb from one server to another on our network. For some reason it has been taking ~8 hours to do this, which is a problem because it doesn't finish before our nightly…
Mike
  • 165
  • 1
  • 4
  • 15
3
votes
2 answers

cmd.exe: how to start a background process, run some things, stop background process

I want to run a batch script that: starts a background process (a Selenium RC server, if that matters); waits until the background process starts to listening some port (or wait a fixed amount of time); run some instructions; stops the background…
Seiti
  • 145
  • 1
  • 3
  • 10
3
votes
1 answer

Split string line read by a batch file

is there a way to "split" the value of string line readed by a batch file ? Suppose to have this text file 192.168.1.2; PC_NAME_1 192.168.1.3; PC_NAME_3 ... I would like to read line 1, and split the value into two variables ... So i can use IP…
stighy
  • 931
  • 8
  • 21
  • 32
3
votes
10 answers

Batch processing on Linux

We're currently setting up a server to some heavy lifting (ETL) after another process has finished within the business, at the moment we're firing off jobs either via scheduled cron jobs or remote execution (via ssh). Early on this week we hit a…
Andrew Williams
  • 667
  • 8
  • 20
3
votes
1 answer

VboxManage in a Batch File

I have the command below in a windows batch file, whenever I run the above batch (ipconfig.bat) to get the ip of my linux vm, it outputs the ip fine but doesn't ends the batch file, I have to press control + c and then press "y" to end the batch…
Mutahir
  • 2,357
  • 2
  • 32
  • 42
3
votes
1 answer

Microsoft Intune - How to modify Windows 10 registry settings?

Win32 app uses bat file to install software and edit registry keys. Registry keys are modified if I run bat file locally but not when run through via Intune because Intune runs installation as System. I created a PowerShell script that works when…
JPX
  • 151
  • 2
  • 2
  • 7
3
votes
3 answers

How to get all processes under a session of a particular process that is using a port in Windows cmd

I want to list and kill all processes belonging to a session of a particular process that is using a port. This should happen through a windows batch command that would accept a port number as input. For example: Let us say a process PA is currently…
3
votes
6 answers

Windows Batch - Get name of currently logged-in user

In a sort of small mitigation for a large network for the exploit of replacing utilman.exe on windows repair, by cmd.exe, then changing user password, I'm doing a small script based on EventSentry tool that will detect that utilman.exe is changed…
DefToneR
  • 527
  • 6
  • 14
2
votes
2 answers

Change Registry Key Permissions Access Control List using only Command Prompt

I am trying to change the Access Control permissions on a specific registry key i'm generating using a batch file. I try using regini.exe to pull the configuration from a .ini file and run into issues. I keep getting this error: …
2
votes
1 answer

Grant "Network Service" Read Only Permissions to Cert for RDP via Batch

I'm securing RDP by adding my SSL cert to my Windows host and of course, I'm working on scripting everything. I've got it 99% complete, the only step I can't figure out how to script is relating to permissions. Eg:…
FreeSoftwareServers
  • 515
  • 1
  • 8
  • 26
2
votes
1 answer

Batch script with %date% variable

I do robocopy using .bat script, this script is starting 22PM before midnight and it took over 5 hours to complete. The problem is that destination folder is created with date \nas01\%date% so when it starts let's say is 10.07.2019 but when robocopy…
zuku
  • 61
  • 1
  • 7
2
votes
2 answers

Azure Batch, Low priority nodes not working at all

We have been using low priority nodes in my company for a really long time. Every now and then we get preempted nodes but our tasks end up running eventually. We have 1 dedicated node, and we scale up to 20 low priority ones. For the last 3 days no…