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

auto set permission on any file copied into folder

I have a batch file that copies folder from a temp directory to a public internet directory. The problem is, once the file is copied, the IUSR account doesn't have read privileges to the file and I get a 500 error. I can manually set permissions…
user66827
  • 215
  • 2
  • 3
  • 9
0
votes
2 answers

Robocopy website deployment script log file name truncated in AM

This is an IIS website deployment script I started to write. It moves files from directory A to directory B and creates a log file with the date/time as the file name. When it's run in the AM hours, the time part of the log file name gets…
JustBeingHelpful
  • 1,964
  • 7
  • 37
  • 53
0
votes
2 answers

How to schedule batch file to run on the desktop in win 2008 R2

I have some backup batch file scripts which I was running in xp and I have migrated to windoes server 2008 R2 where it's not running in front when scheduled with task manager. I struggled a lot to make it run at the scheduled time with task manager…
0
votes
2 answers

batch file to strip numbers from filename and pad to two digits

I have a text file with a list of server names (servers.txt) that looks something like this: server1 server2 server3 I have a feeling this can be done with the FOR command as I use that to perform an action on each name in the file, but I'm not…
ss2k
  • 285
  • 1
  • 3
  • 10
0
votes
3 answers

Batch file function

I need to create a batch file that will purge data from an existing file. Basically SQL server management studios does not overwrite backup data; therefore after the backups have been run and the data transferred, I need to purge the file using a…
GMitch
  • 500
  • 4
  • 12
0
votes
1 answer

Batch Script - Query Filenames From Server Printer

Client: Windows XP Print Server: Ubuntu via CUPS Is there a way to query the printer queue on the server from a client to retrieve the name of the file being printed? Code example would be something like: FOR /F "tokens=* USEBACKQ" %%F IN…
Anthony Miller
  • 457
  • 3
  • 6
  • 19
0
votes
1 answer

Errors running Batch files

I have recently constructed a batch file on my server to zip up data and send it to a backup source for archiving. However when I run the batch file I get the following error... '7z.exe' is not recognized as an internal or external command,…
GMitch
  • 500
  • 4
  • 12
0
votes
2 answers

Batch command to schedule multiple servers to shutdown

Our company is in the middle of a move between buildings. I've been asked to schedule the majority of our servers to shutdown at midday tomorrow. They already have a scheduled task for this, which occurred in the past, and occurred once only. I…
Steve
  • 365
  • 2
  • 7
  • 18
0
votes
2 answers

Access a Network drive from another user from CMD (windows)

I have written PostgreSQL backups scripts that backup all the databases to file. pgAgent.exe (a scheduling daemon) starts the BAT scripts under the local postgres user. The normal setup is to backup to a local drive and get the backup program to…
0
votes
1 answer

Disk Cleanup Batch File With Logs

I was wondering if there is a way to create a batch file that will run a Disk Cleanup (on XP and 7 PC's), and have it create a log file on the local PC that will tell me the details, or that it's run. Thanks for any ideas.
The Woo
  • 579
  • 6
  • 21
  • 39
0
votes
1 answer

It doesn't print the increased value of a variable in the for loop of batch file

As you can see I am new in the batch files, I have written a script in windows 2003 environment for print an increased value of the variable counter and also I have applied the if condition which is not working in the for loop, though outside the…
0
votes
1 answer

pscp (putty) copy only non-existing files/dirs

I'm using PSCP to copy directories from a linux machine to my windows machine. That works great, but I only want to copy those directories that are new and non existent on my windows machine. Is there a way to do this? I'm using a windows batch…
solsol
  • 1,121
  • 8
  • 21
  • 31
0
votes
1 answer

Two-way rsync between two servers

I read about rsync but I want to ask how can I do the following by rsync: I have two files in to different machine (UNIX-AIX) and have the same name. server1 : ..../file.txt server2 : ..../file.txt I want to apply the following in two server to…
Mohammad AL-Rawabdeh
  • 1,612
  • 12
  • 33
  • 54
0
votes
1 answer

how i can read n first bit command output in windows batch file?

i use checksum command in my batch file and the output of command as follow : 69514a29dc44cd83b42658e917ed9baf *file.txt i want to return checksum only so i should store it in variable without file.txt…
Mohammad AL-Rawabdeh
  • 1,612
  • 12
  • 33
  • 54
0
votes
2 answers

Bactch files: if-then-else and for loop syntax on Windows?

I want to write a batch file and we want to use if-then-else and for loop statements, but I don't know it and its option. Please can anyone help me?
Mohammad AL-Rawabdeh
  • 1,612
  • 12
  • 33
  • 54