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.
73
questions with no upvoted or accepted answers
3
votes
1
answer
4k
views
Getting error 1219 while there are no other sessions
PC's in our organisation run Windows 10 Pro and are sometimes shared between users (local accounts, no domain and AD).
I have written a batch script that users execute when mounting our network ...
3
votes
1
answer
705
views
Why does scripting with appcmd behave differently than using IIS GUI?
I've scratched my head raw on this. Please help me stop the scratching.
We have a manual workaround for a site problem we're experiencing. The workaround always works when we do the steps ...
2
votes
2
answers
6k
views
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 ...
2
votes
0
answers
477
views
Automated Install of PADS (Mentor Graphics) works manually but not in Software Center
I am trying to automate the install of PADS VX.2 or PADS VX.2.2 (made by Mentor Graphics) to be ran with Software Center. It has a proprietary batch tool that I used to make a silent install script, ...
2
votes
0
answers
2k
views
Behaviour of environment variables in HKCU\Volatile Environment reg key
I have a .bat script that runs for every user at login (copies Oracle Java Exception Sites). It copies a file to:
%userprofile%\appdata\LocalLow\Sun\Java\Deployment\security\exception.sites
...
2
votes
1
answer
1k
views
how to loop though sub folder to check if folder is empty - batch script?
What I want to do:
write a batch script to do the following
loop though all dir starting with "01-"...
Check if "Pictures" folder is empty or not. skip rest folders
If "Pictures" folder is Empty, ...
2
votes
0
answers
263
views
DSADD in batch file - syntax incorrect! Same command in command works fine
Really stumped here and I'm sure the answer is simple. Simply put, I'm creating a bunch of AD accounts based on input from a spreadsheet. I've been able to concatenate the fields into a DSADD command ...
2
votes
0
answers
806
views
Trying to run a netsh batch with foreign characters
I am trying to run a batch file with the following content:
netsh interface ip>set dns "Połączenie lokalne" source=dhcp
The file is saved as ANSI. My Windows codepage is 1250, the OEM one 852.
...
2
votes
0
answers
2k
views
Access Denied error when running xcopy in jenkins on windows 2008 r2
I have installed Jenkins on a Windows Server 2008 R2 and in the build script i use xcopy to copy the generated war file to a specific folder
The problem I am having is that every so often the build ...
2
votes
1
answer
229
views
NFS drops out when .bat script is run
I have a .bat script that runs from a Windows 7 machine. Part of the script is to use plink to ssh into a Red Hat machine and run a couple commands. I have about 4 or 5 plink commands within the ...
2
votes
2
answers
352
views
Change windows group permissions without the sufficient rights in a batch
I wrote a batch file, which creates multiple folders und subfolders in the current directory. The group permission of one folder is also changed. This works on my local workstation with administrator ...
1
vote
0
answers
224
views
Syntax for creating SCHTASK.EXE tasks to run batch files that take parameters
I have a set of older batch files that scheduled the running of some maintenance tasks for a database that I look after. They used the AT command.
The database has been moved to Windows server 2016 ...
1
vote
0
answers
155
views
Is it possible to open a file within a batch file as another user?
im trying to run psql.exe (postgreSQL) with an active code page set to 1252. I want to have a batch file that opens up a command prompt with that code page, then navigates to the psql directory to run ...
1
vote
0
answers
500
views
using start /wait for a headless process in a batch file - any way to show the process is running?
So I have a large batch file, and in the middle it hits a start /wait command to run a silent install of an MSI. I'd like to have some animation or something to indicate that the batch file is in fact ...
1
vote
0
answers
660
views
Capturing output of remote process from sysinternal's psexec Script
I'm trying to deploy a program throught PSexec with a script from Bat file to use one CMD instance per computer and not one after the other.
I need a log to be generated on my local server to be sure ...
1
vote
3
answers
632
views
Can't remote reboot domain PC
I use bat + Powershell script to reboot a domain computer. I do not want to use domain admin but local user with admin privileges.
bat file:
PowerShell -NoProfile -ExecutionPolicy Unrestricted -...
1
vote
0
answers
160
views
Q: How Robycopy deals with pointers to directories (short-cuts)
For example, in the statement below
robocopy %src% %target% copy:DATSO
the parameter %src% may be a pointer to a directory.
In my case, Robocopy FAILED TO COPY the content the pointer is pointing ...
1
vote
2
answers
3k
views
How to find a file in cmd and then piping the output in findstr
I have a simple question regarding how to finding a file in cmd and then piping the output to findstr to nail down a specific file.
For example,
dir change /s /p | findstr "error"
Can this be ...
1
vote
1
answer
2k
views
Moving a lot of files with robocopy and 7zip
With the help of StackOverflow and a number of other places I've created the following script, the purpose is to look at a folder and it's subdirectories, if the files are older than 32 days -> move ...
1
vote
1
answer
724
views
Remotely change local group policy server 2008R2
I'm trying to find a way I can edit the 'trusted hosts' list under local group policy remotely.
Path from within Local Group Policy is:
\local computer policy\computer configuration\administrative ...
1
vote
1
answer
2k
views
How to catch "The system cannot find the file" within For /F loop?
How to catch "The system cannot find the file" within For /F loop?
I would like my code to do the following:
1 - Search for the specified file
2 - If file not found, handle the "The system cannot ...
1
vote
1
answer
3k
views
Wevtutil equivalent for powershell script to get event logs
I have made a powershell script which is as below but since I won't be able to save it in .evtx format. I want the wevtutil equivalent(using wevtutil epl) for the same.Please help!
$ErrorTime=Get-...
1
vote
0
answers
62
views
How can I wait to the close of the uninstall panel in windows 7 from batch file?
I have simple batch file :
@echo off
call "c:\windows\system32\appwiz.cpl"
echo "Done"
On Windows XP, this batch launche the uninstall panel of windows, and block the execution until the use close ...
1
vote
2
answers
2k
views
logoff sessions except console
There is an application in a multi-user environment that can only be open in one session on a workstation. The users move around frequently from PC to PC, leaving the application open, and the ...
1
vote
1
answer
935
views
top batch to dump CPU usage for all CPUs
I am looking for a command that I can run in a batch mode and report back to a monitoring server. I'd like a CPU usage across all CPUs (the equivalent of running top in interactive mode and then ...
1
vote
1
answer
244
views
Rename NTFS file to eliminate multiple periods via batch
I at wits end trying to rename NTFS files that have technically legal, but problematic multiple periods in my Windows 2012 Server share
Files are dropped in a share that look like this:
THIS.IS.THE....
1
vote
0
answers
297
views
Powershell-Script is not exectued correctly
I have a power-shell-script which is called by a batch-file. The batch calls the script after it has set the execution policy to unrestricted. Currently the script does nothing more than writing a log-...
1
vote
1
answer
755
views
if exist !SOMEPATH! not working in batch file
I have a batch script in which i am using multiple if exist statement, the problem is all statements are working except one .
Following variables are set
SETLOCAL ENABLEDELAYEDEXPANSION
SET ...
1
vote
1
answer
2k
views
Running multiple instances of a Batch file in windows simultaneously?
I have a windows batch file that is invoked by windows scheduler. When I try to have multiple windows scheduler tasks trying to run the batch file simultaneously, the batch file is locked by the first ...
1
vote
2
answers
106
views
computer startup script reporting success to a server
I am using Group Policy to deploy a computer startup script that tries to uninstall one program and install another. I need this script to report its status (whether a certain file exists on the ...
1
vote
0
answers
323
views
Windows file compare (FC) spurious differences
I'm getting differences like this:
a.txt
Betty Davis
Cathy Edwards
b.txt
Betty Davis
Cathy Edwards
There are only two lines listed in the diff (which doesn't ...
1
vote
0
answers
195
views
scheduledtask to update svn directory creates multiple processes
We have a fairly standard web setup, with a windows 2008 server hosting our website and the directories being under control of SVN, with tortoise SVN as the preferred provider.
One of the SVN folders ...
1
vote
0
answers
103
views
Why is my IF comparison op failing?
update SOLVED - the problem is not with my code. there is a design limitation (some might say "bug") in the command processor. the IF comparison operators do not work with values higher than ...
0
votes
0
answers
21
views
AWStats a network drive
I am running AWStats from a NAS networked drive on a Windows network. The apache sever log files are also on the NAS network drive and the path includes the network drive letter along with locations ...
0
votes
1
answer
469
views
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 ...
0
votes
1
answer
4k
views
Using GPO to run batch files at logon not working
I'm having a weird issue with creating Group Policy on an inherited Domain Controller. This thing was never set up properly, and I'm not well versed in working with Group Policy.
We are running ...
0
votes
1
answer
517
views
How to reset the "allow pc to be discoverable on this network" prompt?
I have been advised to ask this question here on ServerFault.
I've searched StackExchange, StackOverflow, and Google and I'm not finding any insights on how to reset the prompt when first connecting a ...
0
votes
0
answers
36
views
at-command: Scheduling and process priority
I have about 10 "at" jobs. There are cases where there is a conflict of resources and I am trying to find a neat way to schedule this. Say, job#5 may want to start before the job#4 ends. ...
0
votes
0
answers
157
views
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 ...
0
votes
0
answers
25
views
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 ...
0
votes
0
answers
699
views
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 ...
0
votes
1
answer
107
views
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%
...
0
votes
1
answer
2k
views
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 ...
0
votes
1
answer
518
views
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 ...
0
votes
0
answers
760
views
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 > ...
0
votes
1
answer
3k
views
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....
0
votes
0
answers
86
views
BAT script to return server licenses at shutdown?
My office uses program licenses that have to be manually activated and returned, and people tend to forget to do this when they go home for the day, resulting in most licenses tending to be ...
0
votes
0
answers
98
views
Required Microsoft RSAT dlls and exe files
I've got to script some Active Directory actions (remove computer object) but will be limited to using a batch file; I'm tied to a product that is looking for a specific batch file. I'll place my ...
0
votes
0
answers
2k
views
Update Group Policy via Batch Script or Powershell Windows 7
I administer about 300 remote computers (all across the country) that are on Windows 7 Pro (32-bit) and I need to change the Group Policy. This is the first time in 5 years I've had to change the GP. ...
0
votes
1
answer
434
views
execute check and repair mysql(wampserver) from a batch file
I'm trying to run check mysql and repair mysql functions in a sql file from another batch file.
I get the error as:
C:\wamp64\bin\mysql\mysql5.7.19\bin\mysql.exe" "mysql -u root -p < batch.sql"
...