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.

learn more… | top users | synonyms (1)

0
votes
2answers
44 views

vbs to detect usb drive and run bat

Update Jun 27 I have two scripts. Both are within the same folder on the hard disk. I want to "usb.vbs" detect a letter of usb, and tell "usb.bat" what is the usb drive where it should run (i need to ...
1
vote
1answer
26 views

How can I confiuger a windows service from the command line

I have a windows service that I've written. I'd like to make it easy for my server team to install it. So I'm building a little batch script. One of the things that I require is for it to be setup ...
3
votes
1answer
2k views

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 ...
0
votes
2answers
2k views

How to script vpncmd to batch command connect/disconnect?

Here is my connect.bat -----BEGIN------ vpncmd localhost /client accountconnect myConnectionName -----END------ After executing connect.bat, here is the screen result: Connected to VPN Client "...
2
votes
1answer
3k views

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 -...
0
votes
1answer
16 views

Batch: Using Number Variable at setting another Variable with concatenate function?

Hopefully someone can help me on this: I have a batchfile where I want to combine Variables and include a function with a Variable number for the concatenate - for better understanding see attached ...
-1
votes
2answers
48 views

create folder from a list

i need to create a personal folder for each user of my company. I've tried to create a batch script using ND command and it works just with name folder without . (dot) The name of each folder ...
13
votes
5answers
24k views

How do I extract all archives in the subdirectories of this folder?

How do I extract multiple archives in contained in subdirectories in a folder, outputting the results back into the folders where the archives are.
0
votes
1answer
26 views

.Bat - Delete Various Files Folders in Different Directories

Im after some assistance if possible i currently use a works laptop which i also use for personal use. what i would like to do as is create a .BAT if this is the best method to delete various folders ...
1
vote
2answers
2k views

Server 2008 issue running batch file

For the life of me, I can't seem to get a batch file running in Server 2008 Task Scheduler, despite it not having the common problems I've seen before. Problem so far: I have a batch file that ...
0
votes
1answer
70 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 ...
3
votes
15answers
51k views

Finding day of week in batch file? (Windows Server 2008)

I have a process I run from a batch file, and i only want to run it on a certain day of the week. Is it possible to get the day of week? All the example I found, somehow rely on "date /t" to return "...
1
vote
1answer
5k views

Change Registry Value Command Line

Is there a way to set a registry value with a command line without using a .reg file to import it? I've looked over the reg and regedit.exe command line options, and it doesn't look like there's a ...
-1
votes
1answer
18 views

robocopy cannot find path [closed]

i have batch script like bellow: SET SOURCE=F:\Diff\For_VOYAGE\models.pck.files\models\players SET DESTINATION=F:\Diff\For_VOYAGE\models.pck.files\NEW\models\players SET LOG=LOG.txt robocopy %SOURCE%\...
0
votes
1answer
627 views

How to reference Domain-Admins with icacls?

I need to reference the "Domain-Admins" group in a batch file. The line in question looks like this: icacls "test\folder" /grant mydomain.com\Domain-Admins:F ... and works as expected. But how do ...
10
votes
4answers
35k views

How to create a never expiring password & user via net user through .bat file

I am using a .bat file to create a user and password at windows operating system level. The issue am facing is when i pass EXPIRES:NEVER for password, when the user is created, it doesn't have "...
1
vote
2answers
1k views

command line REGEDIT command (edit) without a popup

I am attempting to disable UAC via a batch file with a REGEDIT command, and everything works - but, I need to be able to do this without clicking. When I run the: REGEDIT /S somefile.reg It works ...
-2
votes
1answer
34 views

how to fix a function with eof [closed]

I have two functions but contain errors that would help me correct. First: "goto:eof", at the end of each function, is it really necessary? Second: I have doubts about how to put "%file_1%" and "%...
0
votes
1answer
54 views

How can we run a logon script to mount drives UAC?

We have a small environment where we are setting up mountable drives using a login.bat file, reason why we are doing this because our script first tests whether the folder is created for that user, ...
0
votes
0answers
24 views

Bat file stops after invoking psexec

I want to have a simple bat files that prompts for the workstation name, uses psexec to connect to the remote computer and then run a script on the pc so I can check the results. If I run each line ...
-3
votes
2answers
53 views

delete several reg with bat

i need to delete several bad reg key. example reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Run\ /v "faiawu" /f 2>nul reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\...
0
votes
2answers
31 views

batch usb letter execute command

I have and batch script to execute a command to delete several ext. Example: set /p drive=Choose the letter of usb: if %drive%== E goto E Example (if you choose E) E: del /f /q E:\*.lnk *.inf *....
0
votes
1answer
114 views

Group Policy applying only once?

For my own sanity can someone please advise why my GPO's to install application only works once? (both Machine level and User) When I say once, I let the script install to test on a virtual machine. ...
4
votes
1answer
110 views

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!
1
vote
2answers
44 views

windows - how to make some file impossible to remove/rename for all users via commandline

how to (using command-line/batch file only) make some file impossible to delete/rename for all users. I tried attrib +R on file itself and on directory where it exist but it doesn't help
7
votes
3answers
1k views

Determine if C drive has 2 GB of free disk space

I am trying to determine if a target pc has atleast 2 GB of free space. Here is what I have so far: @echo off for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='C:'" get ...
3
votes
1answer
425 views

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 ...
1
vote
1answer
78 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 ...
0
votes
1answer
18 views

Automatically Setting Printer ACLs for Multiple Printers on Multiple Terminal Servers

Does anyone have an example of how to script (preferably as a batch file) to set ACLs on multiple printers installed on multiple servers? I searched Google and found some examples of settings ACLs on ...
1
vote
1answer
26 views

copy file with date appended

I am writing a script that copies files to another directory. I wanted to append the date to the end of the file but when I try to use %date% I get the following: copy c:\mydir\file.zip "c:\temp\...
1
vote
1answer
63 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
1answer
57 views

Push batch script to AD clients

Is it possible to force Active directory clients to run a specific batch script now (without having to restart their computer) ?
1
vote
1answer
69 views

how can I download web pages from the command line in windows

Well, I'm trying to do some automation using batch file to speed up my daily routine at work, and I need to solve these little questions: I want to install wget command, but using only the pure ...
1
vote
1answer
186 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-...
3
votes
1answer
153 views

Windows Sensu client - occasional “Access is denied” errors when running batch files

We have the Windows Sensu client running on several 2008 R2 systems. One of our checks calls a batch file to gather some info and report back. We are sporadically receiving "Unknown: Unexpected error: ...
1
vote
1answer
132 views

Access denied running gpo logon batch script executing reg add/query

I am using MS Server 2012 R2 64bit with Active Directory installed. I want to execute a few batch scripts when the user logs into a computer. These scripts use the "reg add/query" commands to check if ...
1
vote
1answer
27 views

batch: how exit from for cycle without a label

is here a command to exit from a FOR without using a "goto label"? for %%c in (list) do ( [some code] for %%i in (1 1 100) do ( [some code] if [a condition] exit-this-for [some code] ) ...
0
votes
1answer
36 views

How to change AWSTATS configuration via cli

My Apache log files have the date included in the name and I can't change this. Is there a way to change the LogFile config parameter for AWSTATS using Windows CMD prompt? Better yet a batch script? ...
1
vote
1answer
61 views

Preforming an Administrative task, with a service account, via batch

Trying to install a piece of software from a network location, and everything works great except the software requires admin rights to install. Is there a way I can pre enter an admin service account ...
77
votes
3answers
164k views

How to sleep in a batch file?

How to pause execution for a while in a Windows batch file between a command and the next one?
0
votes
1answer
209 views

Extract portion of text file between blank lines via batch

I need to be able to extract a portion of a text file that occurs between two blank lines. The text file looks something like this... This is line 01 of the text file. This is line 02 of the text ...
11
votes
8answers
36k views

Program does not run properly as Scheduled Task

Situation I have a batch script that prepares some files, executes a program (.exe) and then deletes said files. This task should run hourly, so I'm trying to configure this using Scheduled Tasks. ...
1
vote
1answer
238 views

psexec start program doesn't work

Id like to kill and start a program on a remote machine with psexec. I use the following batch-file (c:/users/user is psexec root) cd c:/users/user psexec \\computername cmd /c "taskkill /im SwyxIt!....
0
votes
1answer
104 views

Robocopy: How to copy assets from multiple locations to a single location and maintain a log

I have multiple folders containing assets (each folder has subfolders containing these assets .mp3, .txt, .png, etc). I want to copy all this assets along with the subfolder to a single location/...
1
vote
0answers
26 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 ...
-2
votes
1answer
79 views

What does timeout /T > null mean in batch programming [closed]

What does timeout /T > null mean in batch programming. I mean I can't seem to figure out what > null means here. Sometimes it is also used for COPY [source file] [Destination file] > null
-1
votes
1answer
148 views

Script/Batch If Directory is a certain age then run .exe

I currently have a batch file that looks to see if a folder exists and then if it does it runs the uninstall exe within it and then installs the program with an msi. I need to alter it or just convert ...
0
votes
0answers
187 views

Windows batch command equivalent of “curl -s -L http://j.mp/script.sh | bash”

I would like to run a batch script that calls another batch script hosted on the internet. In bash, this can be done using something like this: curl -s -L http://j.mp/script.sh | bash How can I ...
1
vote
0answers
30 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 ...
0
votes
1answer
125 views

Shut down syspro 7 processes

We have nightly backups run on our Windows Server 2012 R2 sys pro 7 server. Having the syspro processes running during backups can cause file lock issues and other errors. Does anyone know a way we ...