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)

1
vote
1answer
1k 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 ...
2
votes
3answers
2k views

How to put DayOfWeek value into file name?

I would like to use the numerical part of the output of "wmic path win32_localtime get dayofweek" to number backup files. Something along the lines of: FOR /F "tokens=2 delims=\n" %%DoW IN ('wmic ...
1
vote
0answers
24 views

Does anyone have a Windows “at /every:” example to explain how to setup a batch file to run the first sunday of every month? [migrated]

This is the one I have to run first day of the month, but I need to run it the first sunday of every month. at 13:00 /every:1 D:\DBMaintenance\MySc.bat Thanks
1
vote
1answer
72 views

Can't run .bat file off share, but can from cmd

I have a smb share on a Linux box set up that I can view in explorer: \\XXX.YYY.ZZZ.QQQ\Share In this share is a batch file: \\XXX.YYY.ZZZ.QQQ\Share\Scripts\Script.bat I can open the file in ...
-3
votes
0answers
27 views

Next drive letter available after C:

Using a batch script, I want to capture the next existing drive letter after C: into a variable. If none exists, only then assign C: to that variable. I tried the below code, but it shows next drive ...
0
votes
1answer
13 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 ...
0
votes
1answer
975 views

How do I delete a remote file using NCFTP (Windows client)?

With ncftpput.exe how do I delete a remote file once logged in? I have tried using the -W option to send a Raw FTP command but cannot get it to work. Has anyone got a working example? Have tried ...
1
vote
0answers
57 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 ...
0
votes
1answer
1k 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
4answers
18k views

Command Line Winrar & Batch Scripts

I've written a wee batch script to backup some stuff on my desktop and dump it over the network to a share... The only thing that's bugging me is the verbosity of rar.exe while it's doing the ...
5
votes
4answers
11k 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 ...
15
votes
3answers
62k views

For Loop counting from 1 to n in a windows bat script

I need to run a windows command n times within a bat script file. I know how to do this in various programming languages but cannot manage to get it right on the windows command line :-( I would ...
1
vote
1answer
68 views

Disable NIC advanced properties in Windows server 2008/2012

I have some Rackspace VM's and need to disable these advanced NIC properties: Correct TCP/UDP checksum value IPv4 checksum offload Large receive offload Large send offload version 2 TCP checksum ...
2
votes
1answer
96 views

How to remove directories using wildcards by reading a file using batch?

Batch file for /f "delims=" %%f in (7profiledeletelist.txt) do rd /s /q "%%f" PAUSE exit 7profiledeletelist.txt C:\Users\1* C:\Users\2* C:\Users\3* C:\Users\4* C:\Users\5* C:\Users\6* C:\Users\7* ...
9
votes
5answers
838 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
3answers
371 views

Batch script to export info from Active Directory (name, phone numbers, location, etc) into a csv file

The secretary at my work uses a spreadsheet that lists names, phone numbers, and locations of employees to look up info if someone asks. All this info is located in AD, but the problem is that we are ...
0
votes
2answers
2k views

Batch - Ping IP and execute different commands on return

I'm trying to make (hopefully a simple) script that when run pings my mobile device. If the mobile is connected to the network it will execute one command and if not it will execute another. I've ...
8
votes
5answers
16k 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
3answers
3k views

Is there a way to reset the password for a list of Active Directory users en-mass?

I have a list of user accounts that need their password reset to a default password (also users will be required to change the password at first login). Is there a way to reset the password for a list ...
0
votes
1answer
52 views

get files from a shared folder with password from a anohter computer with batch file

I'm using a .bat file to get some files from a shared folder on another computer in the same network. My challenge is that the shared folder is password protected. Is there a way to write username and ...
1
vote
1answer
1k views

I'm trying to make a batch file that will ping multiple IP's and return the results in a text file [duplicate]

Possible Duplicate: Batch file to MASS ping group of computers on network by name, check reply, and resolve hostname I am trying to ping many IP's at once and to date it's been done ...
0
votes
1answer
48 views

I am unable to set the owner of a folder back to the user from my bat file

The following bat file is being used to fix permissions for Users in our organization. Everything works perfectly until we try to set the owner back to the user. takeown /F F:\Users\First.Last /R ...
0
votes
1answer
68 views

Windows - How to redirect all console output to text file? The console program is called by another software that I can't control

It is a pretty complicated issue (at least for me). GUI software at a given moment, calls console software, which outputs something to console and quits. I'd like to save those results to a text ...
-1
votes
1answer
200 views

Best Practices for User folder permissions [closed]

The following is my bat file. Is there a way I can substitute First.Last with usernames from a CSV file? My boss doesn't want to do all the users at once. He's afraid that something may happen so he's ...
0
votes
0answers
11 views

One location to other location through the move specified files names only

I have so many files move to one location to other location through the move specified files names only . a .txt with a list of name files: 101.jpg 222.jpg 205.jpg etc. ... I need a script that ...
7
votes
2answers
6k views

Locale-unaware %DATE% and %TIME% in batch files?

The %DATE% and %TIME% environment variables provide the current date and time on Windows machines on the command line and inside a batch file. Sadly, those values are locale-aware! Meaning that, say, ...
3
votes
5answers
312 views

del *.txt removes also file.txt_backup

Imagine that we have directory c:\test with following files: first.txt second.doc third.txt fourth.txt_bak I want to remove only txt files, but leave doc and txtwhatever untouched. When I run ...
1
vote
1answer
2k views

check for ping reply - unexpected result

I am running this within windows xp batch file: ping -n 3 10.1.1.2 >nul: 2>nul: if %errorlevel%==0 ( echo ping reply arrived ) else ( echo no ping reply. ) sometime, it seems ...
31
votes
3answers
69k 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?
11
votes
8answers
2k views

Expire Files In A Folder: Delete Files After x Days

I'm looking to make a "Drop Folder" in a windows shared drive that is accessible to everyone. I'd like files to be deleted automagically if they sit in the folder for more than X days. However, it ...
2
votes
2answers
356 views

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 ...
1
vote
1answer
1k views

Migrating ODBC information through a batch file

I am a desktop support technician currently working on a large scale migration project across multiple sites. I am looking at a way to transfer ODBC entries from Windows XP to Windows 7. If anyone ...
1
vote
1answer
81 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 ...
2
votes
2answers
331 views

simple script to backup PostgreSQL database

Hello I write simple batch script to backup postgeSQL databases, but I find one strange problem whether the pg_dump command can specify a password? There is batch script: REM script to backup ...
1
vote
2answers
2k views

How to “ignore” username and password prompt in net use

I have at the moment a logon.cmd script, that I'm using to map network drives to the users profile. It looks like this: ::Onboarding net use m: /delete net use m: \\BOB\onboarding ::Bookings net use ...
0
votes
0answers
259 views

Error: “Parameter is incorrect” when opening 0b bat/cmd

Having sort of issue that is more likely annoying when need to create short batch script (though it's not scripting issue). I want to right-click on desktop and create new text file. Rename it and ...
0
votes
3answers
1k views

Autostart Cygwin on Windows boot and run a cygwin command

Sometimes my Windows server reboots at night to install new updates. Then the next day I find out that my cygwin instance has been stopped. What I want is on Windows start, also run Cygwin AND run a ...
1
vote
1answer
283 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 ...
0
votes
2answers
816 views

Remote GPO through BATCH Script exiting

Right so, I'm trying to make a remote GPO script that from one of our management machines will push the GPUPDATE command to certain servers. After some googling I found a script that I tried to ...
4
votes
5answers
2k views

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

How to use a freshly installed environment variable in Windows

When I set an environment variable through the setx command in Windows 7, the variable is correctly set but if I type in set, it list the environment variables that were set at the script start up, ...
2
votes
0answers
269 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 ...
0
votes
13answers
32k 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 ...
3
votes
2answers
152 views

Make windows all in capitals for specific application

Is there a method where I can set windows transparently to caps preferrably when a specific application is run. For bonus points, I should be able to revert back to normal (non capslock mode) when ...
0
votes
2answers
604 views

Change Chrome homepage for multiple PC's

In our business we have about 300 PC's. What I want to achieve is to change the homepage on all browsers (IE, Chrome and Firefox). The problem is that I can't find any way to set/change the homepage ...
-1
votes
1answer
166 views

Space in batch commands (del and taskkill) [closed]

I have a problem using del and taskkill. del D:\New Folder.exe I tried changing the code to this: del D:\"New Folder.exe" That didn't work So I tried this: del "D:\New Folder.exe" Still not ...
2
votes
1answer
144 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 that I need ...
0
votes
0answers
176 views

Output results of findstr at a Batch file so they can be read by PHP

I have this Batch file which looks for a string through a the files in the current folder: @echo off for /f %%i in ("*") do ( findstr /m /C:color "%%i" ) Now I would like to output the ...
2
votes
1answer
785 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 ...