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
8
votes
3 answers

Evaluating expressions in windows batch script

This one could turn out as the dumbest question ever, as I am probably missing out the obvious. Anyway, here it is: Can you evaluate expressions in a batch script. For example, I want to add two numbers and print the result: echo 4+2 This will just…
raoulsson
  • 4,763
  • 10
  • 34
  • 29
7
votes
1 answer

Can I permanently add to PATH in windows using batch?

Is it possible to permanently add c:/project/bin to PATH i windows using only batch?
Kit Sunde
  • 946
  • 3
  • 12
  • 33
7
votes
2 answers

delete registry key using wildcards

I'm hoping to find a way to delete registry keys based on wildcards using a batch file rather than writing some vbscript. Does anyone have an example? I'm forced to proceed with MS's wonderful manual removal of Office as described…
netadmin_dude
6
votes
2 answers

Checking if shared folder exists using CMD

How I could check if network folder shared exists using batch script? Example: \\10.10.10.1\folder1\folder2\shared_folder
gedO
  • 267
  • 1
  • 4
  • 12
6
votes
1 answer

Is there a cmd/certutils to copy a certificate from one store to another?

I would like to know if there is a cmd to copy an existing certificate from one store to another. I am trying to copy a certificate from the Users Intermediate Certification Authorities store (certutils -user -store ca fqdn-HOST-CA) to the machine's…
6
votes
6 answers

shortcut for Eventvwr > Connect to another computer

I was wondering if you can write the following action in a batch command? eventvwr (open the event viewer) Menu Action > Connect to another computer Type in the name of the computer. Connect. This would make my life just a few minutes/day more…
Peter
  • 161
  • 2
  • 10
5
votes
1 answer

PowerShell: export GPO to a text file

I'm new to Windows Server, and I'm curious: is there any way to dump group security settings to a text file, using PowerShell or batch files? Thank you!
user337011
  • 51
  • 1
  • 2
5
votes
2 answers

rsync unexplained error & received SIGINT, SIGTERM, or SIGHUP

I created a batch script to back-up our server: #!/bin/bash user=$1 # create user dir ssh root@local.backup.tst -p 5774 mkdir -p /var/backup/server.tst/incremental/$user # backup mail dir rsync -rvz --del --rsh='ssh -p5774' /home/$user/imap…
George Boot
  • 153
  • 1
  • 1
  • 5
4
votes
4 answers

Start GPO script as administrator

I need to install a software using a login script, which is distributed by the GPO. Currently it is starting, but it is not run as an administrator, so the installation is not done. How can I make this script run as an administrator in the login to…
Ivo Jesus
  • 63
  • 1
  • 1
  • 6
4
votes
1 answer

Get PowerShell command output as a variable in bat (cmd) script

I'm trying to get FQDN of a host in some .cmd file. We have disjointed AD domain so "@echo %COMPUTERNAME%.%USERDNSDOMAIN%" does not work. I mean it works, but returns wrong value. The solution I ended up with is powershell.exe -noninteractive…
Papa Smurf
  • 89
  • 1
  • 3
  • 9
4
votes
1 answer

Batch Process Performance on Linux

My end users wants to run batch processes concurrently on a Linux box. Their impression is that running multiple of them at same time will reduce turnaround time. These processes do fair amount of heavy lifting. My take on this is that running…
oradbanj
  • 161
  • 1
  • 1
  • 6
4
votes
1 answer

Script for renaming files and adding a timestamp (server 2012 r2)

I'm struggling to create a (fairly simple) batch file script that meets these requirements: Looks in the folder called Source for a file (with any name.csv) Renames the file to File_YYYYMMDD_HHMinMinSS.csv (timestamp should be modified/creation…
SysAdminUK
  • 113
  • 1
  • 2
  • 14
4
votes
2 answers

Is there a way to change passwords on multiple servers simultaneously?

x3 Server 2012 R2, x2 Server 2012 My system has 5 servers; 1 Hyper-V server hosting 2 vm servers (these are the x3 2012 R2 servers), and a Win 8.1 pc running hyper-V that hosts 2 more vm servers (these vm's are the x2 2012 servers). Every 45 days…
4
votes
2 answers

Check free disk space using Batch commands

Is there a way already to check the free space of a hard drive in a batch script? I'd rather not use third party apps since I need to fill out a lot of forms, and in that case I think I'll write a small app myself.
Mats Fredriksson
4
votes
2 answers

Batch rename directories with regex via command line on Linux

I have a folder on the server that contains directories that are created daily and are named by date, like so: 07-06-14 08-06-14 09-06-14 etc. At some point I decided that a preferred naming would be in the following format: 2014-06-07 And the new…
YemSalat
  • 145
  • 1
  • 7
1
2
3
22 23