Questions tagged [batch-file]

batch files are simple text files executed in a command to achieve a particular task or a set of tasks

batch files are text files containing commands executed in sequence to achieve a particular task or a set of tasks. They can be very simple, or can contain complex logic.

440 questions
2
votes
1 answer

Run a batch file from network shared folder depending on MS outlook bit version

Hello I'm trying to figure out on how to Run a file from network, basically it's located from \10.18.xx.xx\installers\install.bat, so yeah It's gonna prompt a username and password when I locate it manually. What are the codes the I should use in…
2
votes
2 answers

Robocopy - All data marked as modified

We make use of the following script to backup a folder (quite large - approx. 400GB), to a NAS with EXT4 Filesystem: robocopy "Source_Directory" "\\NAS\Destination\Directory" /MIR /FFT /COPYALL /W:5 /r:10 /log:"C:\RoboTest\robotest.log" Research…
joebegborg07
  • 869
  • 5
  • 16
  • 24
2
votes
2 answers

Windows Server 2012 R2 Task Scheduler access denied (0x80070005), but command works manually in shell

I have the following problem. On our Windows Server 2012 R2 is a scheduled task which calls a batch file, which in return calls vb scripts. Those scripts just download 5 pictures and stores them into a folder under a specified name. If I call the…
2
votes
1 answer

Trigger a batch file when a user choose "Switch User" in windows

I save log in/out details of all the users to a text file through a .bat file, which is executed by Task Scheduler (on workstation-lock/unlock)/ gpedit.msc (on user logout/login). I want to run the same or any .batfile when Switch User is chosen…
J. Parashar
  • 123
  • 1
  • 4
2
votes
1 answer

Calling a batch file using relative path

Oh gosh, gotta expose myself as a noob here ;) In Windows, I need to execute a batch file in a subdirectory of the working directory. However, just running subdir/foo.bat cmd1 cmd2 does not work, and I get an error saying The command "subdir"…
Franz
  • 135
  • 1
  • 1
  • 6
2
votes
1 answer

how to loop though sub folder to check if folder is empty - batch script?

What I want to do: write a batch script to do the following loop though all dir starting with "01-"... Check if "Pictures" folder is empty or not. skip rest folders If "Pictures" folder is Empty, than print path of empty "Pictures" folders. Output…
mark
  • 21
  • 2
2
votes
1 answer

How can I sleep in a windows batch file within a non-interactive session?

I have a batch script that is executed outside of an interactive command prompt. I want to sleep for 30 seconds between two commands in it? I've read in some responses to similar questions that you can use timeout or choice, but these fail in a…
Jobu
  • 121
  • 1
  • 4
2
votes
1 answer

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 Windows Command Prompt I want to download some things…
DaMonki
  • 121
  • 6
2
votes
0 answers

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 that I run each time a new user is onboarded. For…
2
votes
3 answers

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 notepad++. I have a feeling that I could have clicked…
user288456
  • 21
  • 1
  • 2
2
votes
1 answer

Batch file that kills a certain process

I am using the following script to kill a process in CLOSE_WAIT state that listens to a certain ip and to a certain port. FOR /F "tokens=5 delims= " %%I IN ( 'netstat -ano ^| find "127.0.0.1:5900" ^| find "CLOSE_WAIT"' ) DO ( taskkill /PID…
Chris
  • 107
  • 2
  • 8
2
votes
1 answer

dsadd run from batch file fails with "The specified account already exists" when there is no existing account with the same dn

I am programmatically creating thousands of test users from a txt file containing First Name, Last Name, Username, and Password using the following command (saved as a batch file, run in cmd, modified from this question): FOR /F "tokens=1,2,3,4…
2
votes
1 answer

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…
serdar
  • 127
  • 7
2
votes
2 answers

Creating a service to run RoboCopy

I'm attempting to put together a batch file that will set up a robocopy task as a service in response to user input. The basic idea being that the user will input MyRobocopyBatchFile.bat sourceFolder destinationMachine and from then on the contents…
Klee
  • 141
  • 1
  • 1
  • 5
2
votes
1 answer

PsExec hangs intermittently when calling AppCmd

We have an automated deployment process which is primarily managed by a batch file. One of the first steps in that process is to stop an IIS AppPool so the updated files can be safely copied. To do this, we call PsExec, like this: PsExec.exe…
p.s.w.g
  • 185
  • 2
  • 9