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.

Filter by
Sorted by
Tagged with
0 votes
2 answers
1k 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 /...
Saeed's user avatar
  • 366
2 votes
1 answer
2k 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 ...
Tushar Joshi's user avatar
2 votes
1 answer
6k 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= ServiceB/...
Reflection's user avatar
-2 votes
2 answers
74 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. ...
DanDruff's user avatar
1 vote
2 answers
4k 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. ...
Dempa's user avatar
  • 143
0 votes
1 answer
1k 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 ...
Ken Ash's user avatar
  • 11
7 votes
1 answer
16k 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?
Kit Sunde's user avatar
  • 946
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....
dave_the_dev's user avatar
8 votes
4 answers
7k 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 ...
Sean Beegle's user avatar
3 votes
1 answer
7k 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 ...
Benjamin Peikes's user avatar
0 votes
1 answer
398 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 ...
Adam's user avatar
  • 87
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-...
Christof Walker's user avatar
1 vote
2 answers
8k 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 ...
ccamacho's user avatar
  • 213
2 votes
1 answer
2k 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* C:...
serdar's user avatar
  • 127
2 votes
3 answers
17k 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 ...
James F's user avatar
  • 21
13 votes
8 answers
71k 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. ...
MarioDS's user avatar
  • 223
0 votes
1 answer
2k 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 ...
Zhenyu's user avatar
  • 263
0 votes
1 answer
387 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 file,...
user342872's user avatar
-1 votes
1 answer
1k 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 ...
GettingStarted's user avatar
0 votes
1 answer
215 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 ...
GettingStarted's user avatar
3 votes
5 answers
995 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 ...
Artur Iwan's user avatar
4 votes
2 answers
5k 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 ...
YemSalat's user avatar
  • 145
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 ...
akash's user avatar
  • 333
2 votes
3 answers
5k 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 ...
Mick's user avatar
  • 347
12 votes
8 answers
10k 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 ...
Brett G's user avatar
  • 2,033
0 votes
0 answers
2k 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 ...
R1cky's user avatar
  • 365
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 ...
user2154424's user avatar
0 votes
2 answers
9k 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 "...
Level1Coder's user avatar
2 votes
1 answer
14k 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, ...
poussma's user avatar
  • 150
3 votes
2 answers
617 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 ...
SteveMustafa's user avatar
0 votes
2 answers
7k 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 ...
user201420's user avatar
-1 votes
1 answer
2k 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 ...
hunter's user avatar
  • 3
3 votes
1 answer
5k 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 ...
armani's user avatar
  • 420
3 votes
1 answer
3k 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 ...
user3133076's user avatar
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. ...
Tin's user avatar
  • 21
0 votes
1 answer
2k views

Exporting Security Group Memberships in Batch

I have the following command but it doesn't work when put into a batch file: dsquery group DC=domain,DC=com -name "Group Name" | dsget group -members | dsget user -display >> "Group Name.txt" ...
PnP's user avatar
  • 1,684
1 vote
4 answers
20k views

Robocopy fails in Scheduled task with ERROR 1326 Logon failure

My aim: To simply mirror a database backup directory onto another server Approach: Use Robocopy statement contained in a scheduled task robocopy "C:\MylocalDirBackup" "\\MY.IP\DatabaseBackupsShare" ...
reticentKoala's user avatar
0 votes
1 answer
2k views

Batch script - How to release a locked file for batch 'copy'

A daily windows scheduled task triggers a batch script which moves program files to a folder on a server, using a simple copy routine. rem deploy programfiles copy dailybuild\*.dll "\\myserver\...
Kman's user avatar
  • 101
2 votes
1 answer
209 views

Weird issue with .bat script

I have a .bat script which instals 3 pieces of software. When i open an elevated Command promt , browse to the file and run it everything works fine. When i run the .cmd directly ( using the 'run as ...
NickDa's user avatar
  • 99
6 votes
2 answers
20k views

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's user avatar
  • 267
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 ...
Aegis's user avatar
  • 123
1 vote
1 answer
1k views

windows xp - how to add a ipp printer by batch/vbs

I need to deploy printers using IPP in the logon script (batch/vbs). I found the following script to do this: rundll32 printui.dll,PrintUIEntry /if /q /b "r011-printer01 " /f %windir%\inf\ntprint....
Zulakis's user avatar
  • 4,233
0 votes
1 answer
2k views

windows xp batch - check if printer exists

I am looking for a batch-function to check if a printer does already exist on a windows xp system. I made up the following script: set PRINTEREXISTS=0 For /F "Tokens=8 delims=\" %%I IN ('reg query "...
Zulakis's user avatar
  • 4,233
5 votes
2 answers
29k 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 [email protected] -p 5774 mkdir -p /var/backup/server.tst/incremental/$user # backup mail dir rsync -...
George Boot's user avatar
-1 votes
1 answer
616 views

portqry to check connectivity

Is it possible to check the connectivity between 2 remote servers using portqry given that the portqry.exe command is executed on another server. for example, check the connectivity between serverA ...
Claudia Benete's user avatar
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 ...
stephenwade's user avatar
0 votes
2 answers
351 views

Why doesn't rsync over ssh work when placed inside a FOR loop in a batch file?

I've placed the ff. code in rsync.bat: for %%A in (%VAR_REMOTE_HOST%) do ( set VAR_TARGET=%USER%@%%A:%VAR_TARGET_DIR% echo Rsync Source Dir: %VAR_SOURCE% setlocal ENABLEDELAYEDEXPANSION echo ...
Jerome Christopher Geronimo's user avatar
0 votes
1 answer
2k views

How to prevent schtasks on Windows 7 from showing the command prompt after executing a task?

I am trying to get a scheduled task on Windows 7 to execute once a minute, using schtasks and a batch file. My .bat batch file is: @ECHO OFF wscript "c:\http.vbs" The .vbs script si a simple one, ...
Cristian G.'s user avatar
1 vote
1 answer
1k views

Batch script to create home home directories from list of names

I'm trying to create a home directories with permissions from a text file. I can only get the batch file to run the first line. Can anyone tell me why? I initiate the scripts by running go.bat as ...
Steven's user avatar
  • 63
0 votes
1 answer
2k views

.bat file - Nagios v3.2 service check and start if stopped

I'm just barely getting into programming so I do apologize for my ignorance. I'm trying to create a .bat file that will check if a service is running on XP Pro. If service is running it will exit 0. ...
LbakerIT's user avatar

1 2 3
4
5
7