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

how to change mapped drive label from command line?

How might one control the label for mapped drives as they appear in My Computer, from the command line? The goal is to have the drive letter at the beginning of the phrase instead of the end, so when navigating with the keyboard one simply types the…
matt wilkie
  • 481
  • 4
  • 12
  • 28
2
votes
1 answer

Test Multiple Server for login (WIndows 2008)

I currently run a PING sanity check test (batch file with result file) on over 80 servers in 4 environment. But, even if we "ping" ok 100% of the servers, it doesn't mean that the machine are working properly. We had a couple of instances where a…
2
votes
2 answers

How can I reset settings for Internet Explorer using a script?

I'm looking to reset Internet Explorer back to factory defaults using a batch file. I'd also like to delete: all Downloads, History, Cookies and Cache, plus anything else in a user's IE profile.
Emad Alzaobi
  • 31
  • 1
  • 1
  • 2
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
2 answers

Automate running Cisco VPN Client and RDP

I am trying to automate running the Cisco VPN Client and then a RDP session. What is a good way to do this? Batch File? Powershell? Other I have played with a batch file and this kind of works. cmd.exe /c "C:\Program Files\Cisco Systems\VPN…
Gerhard Weiss
  • 131
  • 2
  • 6
2
votes
4 answers

How can I hide ms-dos window when running a .bat file?

I am running a .bat file for my script (Scheduled Tak (CronJob)) per minute. When it run, seems ms-dos window short period of time. My batch code like this; @ECHO OFF C:\wamp\bin\php\php5.4.3\php.exe -f "C:\wamp\www\tst\index.php" How can I hide…
prestack
  • 35
  • 1
  • 4
2
votes
3 answers

Delete just ASP files

I'm trying to write a Windows Batch Script file that deletes just .asp files. If I do: del *.asp /s This has the side-effect of deleting any files with the extension .aspx. This is bad because I want to preserve files with the aspx extension. Is…
Simon Johnson
  • 405
  • 1
  • 4
  • 9
2
votes
3 answers

Using a for loop in Microsoft cmd.exe, how can I process only the files with a certain extension?

I have a the folder c:\test\ and two files in it a.txt and b.txtv. I would like to process just the files with extension equal to .txt. If I write this commands cd c:\test for %f in (*.txt) do echo %f I will get the result where both a.txt and…
2
votes
1 answer

Shortcut on client to run bat file on a server

Is it possible to place a shortcut on a client which will run a bat (or vbscript) file on a server? (as opposed to the script running on the client) It seems pretty basic, but I'm at a loss how this would be done.
David
  • 439
  • 1
  • 5
  • 17
2
votes
1 answer

Running a batch script as network services on windows

On linux I know you can run files under different users pretty easily but on Windows how do you do it? Do I have to log in under that user? Can I run it with the schedule system? I need to be able to run a batch type file under another user.
2
votes
2 answers

Running Linux Script from Windows in backgound

I'm using following script from my windows machine to run on linux and do backup. @ECHO off :: run remote command plink.exe username@myserver /home/username/do-backup.sh Problem with this script is that, i have to keep my session live. as backup…
Kashif
  • 493
  • 9
  • 20
2
votes
1 answer

Pass PIDs from tasklist and kill processes with tasklist

This relates to my thread Pass the PID from tasklist into taskkill to kill a process by the .dlls it's holding open. I am trying to do something like what was discussed in that thread: FOR /F "usebackq tokens=2 skip=2" %i IN (`tasklist |findstr /r…
Guiness
  • 21
  • 2
2
votes
3 answers

How to execute a batch file each time a user logins?

I've written a batch script which copies of some files in the CommonAppData folder (C:\ProgramData) to the logged in User's Local AppData. What I would like to do is to execute this script for every user every time they login. I found many articles…
user841923
  • 143
  • 1
  • 1
  • 5
2
votes
3 answers

I need to clear out the same directory on multiple servers across a network. How do I do this?

On multiple (about 20) servers, there exists the same directory C:\Deployments. This directory has multiple subfolders which contain more subfolders and files. The C:\Deployments directory itself does not contain files. I have a batch file that,…
blashmet
  • 19
  • 2
2
votes
3 answers

find file newer than yesterday using batch script

I am trying to write a batch script that can find the files created/modified/newer since yesterday and/or any specific day from today in a particular folder. Then those files need to be copied to different location. I tried to use the forfiles…
newbie
  • 31
  • 1
  • 2