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

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 a rapidly growing company, and people change…
James F
  • 21
  • 1
  • 1
  • 2
2
votes
2 answers

Setting Variables in Windows Batch Scripts

I need to set some variables based on an argument for a windows batch script. @echo off if [%1]==[] ( echo "Usage: xxx " ) else ( if [%1]==[AAA] ( SET SOURCE_DIR=c:\dirA ) else if [%1]==[ZZZ] ( SET…
raoulsson
  • 4,763
  • 10
  • 34
  • 29
2
votes
1 answer

Running a windows batch script in a separate process

I want to start a long running process from a windows batch file. The start script should just call the second script and return, end. How can I achieve this? Thanks!
raoulsson
  • 4,763
  • 10
  • 34
  • 29
2
votes
3 answers

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 PostgresSQL databases @ECHO off FOR /f "tokens=1-4…
Mick
  • 347
  • 3
  • 14
  • 27
2
votes
2 answers

Batch file to call multiple batch files and keep going after errors

I have a batch file like this, the issue that I have is that if the first batch file fails, the second one never gets started, how can I get them to both keep going? @echo off MapNetworkDrive_J.cmd MapNetworkDrive_Y.cmd I have tried this: @echo…
Nate
  • 2,151
  • 6
  • 26
  • 41
2
votes
6 answers

Copying Directory Tree on Windows

I need to copy a full directory tree (aka recursive copy) with a bat files on windows. On *nix systems I use the -R argument on the copy command, like so: cp -R fromDir toDir and that did the job. I could not find anything similar in the windows…
raoulsson
  • 4,763
  • 10
  • 34
  • 29
2
votes
1 answer

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, not now. I am wondering if there is a way to…
poussma
  • 150
  • 1
  • 1
  • 6
2
votes
0 answers

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. Thus, since Windows uses ANSI (ACP) while the console…
Tin
  • 21
  • 1
2
votes
1 answer

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 administrator' from Windows 7 nothing happens. any…
NickDa
  • 87
  • 1
  • 2
  • 5
2
votes
0 answers

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 fails when run xcopy showing access denied and…
2
votes
1 answer

NFS drops out when .bat script is run

I have a .bat script that runs from a Windows 7 machine. Part of the script is to use plink to ssh into a Red Hat machine and run a couple commands. I have about 4 or 5 plink commands within the script. For example: plink -pw password -ssh…
Franklin
  • 131
  • 3
2
votes
1 answer

Batch - how to copy file by minimum size and date modification?

I have this simple batch script which copies the newest file in some dir to another place. I want this script to also ignore all files (in the DIR command section) under 1GB of size. FOR /F "delims=|" %%I IN ('DIR "Y:\DEVL\*.*" /B /A-D') DO SET…
Yoffe
  • 53
  • 2
  • 7
2
votes
1 answer

Powershell script on the hidden file share not accesible on the workstation

We have a PowerShell script script.ps1 on a hidden shared folder \\Server\Share$. We have a bat file Initiator.bat, which executes the script. The shortcut to the batch file is placed on the user's desktop, which is where they run it…
Darktux
  • 827
  • 5
  • 21
  • 36
2
votes
2 answers

Start /WAIT RDP FIle in Windows 8

I am not sure if I should post this one here or in StackOverflow. I want a BAT that opens a RDP connection file and then, when the connection is closed, logoff the machine. start /WAIT "ConnectionFile.rdp" logoff But the logoff happens instantaly,…
Ricardo Polo Jaramillo
  • 2,039
  • 2
  • 18
  • 35
2
votes
1 answer

Running a batch file from PHP - interactive services detection?

I am having a very hard time getting an executable to run from within a PHP script (using exec(), or a number of other PHP commands I've tried). The issue seems to be coming down to a question of user permissions (possibly?) or Windows/server…
Nik
  • 129
  • 1
  • 3