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
1answer
7 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
14 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 ...
0
votes
0answers
29 views

Windows batch file not continuing

I am trying to write a script that stops a service then zips the contents of a directory and copies it to my network drive. The script below stops the service but then dies. net stop MSSQL$time if ...
2
votes
0answers
28 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
1answer
48 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
40 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
12 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
1answer
57 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
66 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! ...
1
vote
1answer
58 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
20 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
19 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? ...
3
votes
1answer
113 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: ...
0
votes
1answer
109 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 ...
0
votes
1answer
72 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 ...
1
vote
0answers
23 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
50 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
vote
1answer
95 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 ...
0
votes
0answers
82 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
21 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 ...
-1
votes
1answer
116 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 ...
-4
votes
0answers
52 views

How do I disable specific keyboard keys in batch? [closed]

I'm trying to figure out what to do to disable the following keys in a batch script: Ctrl Alt Windows Key Escape Delete (not Backspace) Pause/Break key Can someone help me please? It's so a ...
-4
votes
1answer
62 views

How do I utilize disk space in batch? [closed]

I'm trying to write a batch file that would kinda go like this: if DiskSpace > 255MB for C:, goto 1 :1 copy "E:\file.txt" "C:\destination\" It's for a program I assembled, and I needed to create ...
0
votes
0answers
17 views

icewarp automate extraction of smtp logs

How can we create a batch job to extract results of SMTP log search from IceWarp Log Analyzer and save it to desktop or some network drive or better send it via mail. We are using windows server 2008 ...
1
vote
1answer
56 views

user authentication with powershell

I have the following simple script which I'm using to push some files to a number of Win7 and Server2008 machines. In most cases the local user has no password. However the scripts fails because I'm ...
0
votes
0answers
56 views

log a SFTP batch process

I have a simple batch process which does SFTP a file to a SFTP server. The batch code for that is here: option batch abort option confirm off open sftp://server -hostkey="ssh-rsa 2048 ...
0
votes
1answer
246 views

Adding File Server to Trusted Sites through REG ADD Command

I'm trying to add a trusted site to a group of Win 7 computers that need to run batch files without security prompts. Adding the file server to trusted sites allows them to run. I don't want to ...
0
votes
2answers
106 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 ...
3
votes
2answers
310 views

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

Auto login in Windows Server 2012

I have a server which I connect to with remote desktop connection. I have defined auto login for a particular user. I also have scheduled a batch script to run after logon for that user. However, ...
0
votes
1answer
801 views

How do I set variables in bat file and pass them to php variables? [closed]

I am working on a script in Windows to get system information , I want to store the result of each command in a bat variable, then pass them to php variables. Here the script that I tried: for /f ...
1
vote
1answer
612 views

environment variable clientname scope on terminal server

I have a script that needs the CLIENTNAME environment variable, it runs on a terminal server. I have a batch file for testing that contains: set CLIENTNAME; pause If I RDP as an admin: If I open a ...
1
vote
1answer
31 views

From command prompt store a “!” from a file name in a varible

I have a set of files in a folder with names like test! - 01.avi. I want to make a new folder for each file with the same name and then move the file into that folder. I have everything but how to ...
1
vote
1answer
61 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 ...
2
votes
3answers
107 views

How to see what last batch was run on windows

Is there a way to see what was the last batch (something.bat) run on windows? I was in a folder which contains lots of batches, as I was opening them one by one by right clicking and selecting ...
2
votes
1answer
114 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 ...
1
vote
2answers
892 views

icacls variables in batch file

I'm moving users to a new domain, file server and user name format. I'm trying to write a simple DOS batch to copy the data and set the permissions. X: is mapped to the old server and E: is the local ...
1
vote
1answer
91 views

Backup databases from MS SQL Server 2008 Express database thru batch script

I need batch script to backup selected databases from Microsoft SQL 2008 Express Edition. Unfortunately MS SQL Server 2008 Express edition lacks of visual database backup tools called Maintenance in ...
2
votes
1answer
177 views

Managing power options

For various reasons, we want our clients' computers to not sleep when on AC. We have been running the following script with moderate success: powercfg /change standby-timeout-ac 0 However, the ...
-1
votes
1answer
66 views

Delete files by date and character count

I have an interesting problem. I need to delete directories that are older than x days but are only numerical. We have a log folder that has log files that we need to delete but other files and ...
0
votes
1answer
134 views

Batch script to increment the text file ans also the value inside the file [closed]

I have a text file Foo.txt which contains value content0. I have to create a batch file which increment the text file like Foo1.txt, Foo2.txt.....Foo5.txt and also the values in the file content1, ...
0
votes
2answers
440 views

Bat script start a program and than restart

I need some help creating a .bat script that starts a program and when done it restarts the computer. cmd /c C:\"Program Files"\"Toolwiz Time Freeze"\ToolwizTimeFreeze.exe /usepass=password ...
1
vote
1answer
123 views

How to get value of environment variable from passed command line parameter

I have to use/reference an environment variable value which will be passed as a command line argument. Something like below set myvar=%1 echo Value of %myvar% is %%myvar%% Here in %%myvar%% I want ...
1
vote
1answer
228 views

Add new dependency to a Windows Service that already has dependencies

I want to add via Batch script a new service-dependency to an existing service with old dependencies, without deleting these dependencies. I know the command sc config ServiceA depend= ...
-3
votes
2answers
54 views

Need assistance Creating special Batch file [closed]

I need help to create a batch file that will delete log files in D:/folderx on Server:\serverx This is to eliminate the manual process of cleaning up the disk to avoid a page out of low disk space. ...
1
vote
2answers
235 views

Loop in a Windows batch file

I have a problem where I need to clone one virtual machine into several machines for production. The machines have names that is assigned by variables and a rdp port is also assigned by a variable. ...
0
votes
1answer
129 views

Testing MySQL 32-bit ODBC connection via CMD

I'm going to make a batch script to do some basic troubleshooting. Among other things, I want to test 32-bit MySQL ODBC's for connectivity. This script will run locally on each workstation. There ...
2
votes
1answer
232 views

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?
1
vote
1answer
120 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: ...
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 ...