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
1
vote
1 answer

Windows findstr with AND condition

Hi i searched few older posts but didnt find exact solution. so posting new question. I need a single a windows command to search two words using AND condition. Will findstr works for combination of words? im searching for WORD1 followed by WORD2.(…
srinath
  • 13
  • 4
1
vote
1 answer

How can I confiuger a windows service from the command line

I have a windows service that I've written. I'd like to make it easy for my server team to install it. So I'm building a little batch script. One of the things that I require is for it to be setup with "Log on as:" set to "Local System account" By…
BIBD
  • 1,866
  • 10
  • 30
  • 44
1
vote
2 answers

Win2012r2 Services Recovery Tab documenation refuses to launch

Services Recovery Tab Help will not launch. [ On the "Recovery" tab in Windows Services.msc, clicking on "Help me set up recovery actions" results in "An internal error occurred (INVALID_HANDLE)" Original title was "Win2012r2 Services Recovery…
1
vote
3 answers

Batch file error when executed from Task Manager

I'm new to windows batch scripting, but I was able to get something working that I needed. It works when executing it manually, but when Task Manager executes the script, it doesn't complete. The Last Run Result is "(0xff)." The script is…
1
vote
1 answer

How to write a dos batch script to create a folder structure?

I would like to be able to have a dos batch script that I could utilize to create a specific folder structure below what ever directory I may be in at any given time. The specific folder structure that I need is: [Directory:\]…
David Negron
  • 155
  • 1
  • 4
  • 6
1
vote
1 answer

how to Install java run-time /jre on a custom path using a Batch script?

Im trying to create a bat file to make an unattended installation with sccm. I downloaded jre-7u55-windows-i586.exe from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html (jre-7u55-windows-i586 is…
1
vote
2 answers

windows - how to make some file impossible to remove/rename for all users via commandline

how to (using command-line/batch file only) make some file impossible to delete/rename for all users. I tried attrib +R on file itself and on directory where it exist but it doesn't help
szemi
  • 11
  • 5
1
vote
1 answer

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 "c:\temp\file-%date%.zip" The system cannot find the path…
rahrahruby
  • 587
  • 6
  • 12
  • 21
1
vote
1 answer

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 find the file" by sleeping for 10 seconds and…
1
vote
1 answer

WMIC Command works, but doesn't work in powershell script

#Get Data Rate wmic "/OUTPUT:'C:\Users\user\Documents\DATE RATE\Data_Rate-ts8"+".txt" nic where 'NetEnabled = True' 'get Name,MacAddress,Speed'" Running this in the console directly works. That is only because in the console, I can do this: ps…
Faahmed
  • 113
  • 4
1
vote
1 answer

Using XCACLS to set permissions with long filenames

We need to set permissions on users' directories on a Windows 2000 Server. This happens regularly enough and they must also be set in the order below or the backups crap out. This is the basic script: XCACLS foldername /g Administrators:OF /T /C /Y …
Seanchán Torpéist
  • 1,868
  • 2
  • 14
  • 10
1
vote
6 answers

Newby question: How do I automate copying files to a remote computer?

Firstly, I have the utmost respect for programmers & IT professionals. I'm a newby/wanna-be. I'm looking for help on developing a small program/script that helps me with the task I have detailed below. I am NOT submitting this as homework. This…
Brandon C.
1
vote
1 answer

Clearing Out SCCM Cache On Client Machine Automatically

I would like to run a script that clears out the SCCM cache on a client computer automatically. To do this, I have written a simple batch file: if exist %Windir%\ccmcache ( RMDIR %Windir%\ccmcache /S /Q ) I have deployed this as an…
yhussain
  • 317
  • 2
  • 7
  • 15
1
vote
1 answer

Run Bat file in Administrator Mode in Windows Server 2008

runas.exe /profile /user:administrator "C:\temp\SQLSP3.bat" will run the SQLSP3.bat file in Administrative Prompt and it is asking Adminstrator password in Windows Server 2008. SQLSP3.bat file has following code C:\Temp\SQLSP3.exe /qs…
1
vote
1 answer

How to auto-run batch file as specific user (not scheduled task, not a duplicate)

I am an enterprise admin (Sr. Network Engineer), but my team does not manage Active Directory, so I am a little unfamiliar with policies and what is required to do what I am trying to achieve, and even the AD admins are failing me when it comes to…