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

Batch Script With SQLCMD Usage

Hi All I am Writing a Batch Script Which has to read a set of SQL Files which exists in a Folder then Execute Them Using SQLCMD utiliy. When I am Trying to execute it does not create any output file. I am not sure where I am wrong and I am not sure …
user52128
  • 1
  • 1
0
votes
1 answer

Windows Batch File

I am trying to execute a Set of SQL scripts using a batch bile. When I try this Windows batch file it doesn't run. Please tell me know how to write the script to loop through the files? My script: sqlcmd -S tcp:LENOVO-GH1C00\SAM -U UserName -P…
Venkat
0
votes
2 answers

Batch syntax issue. Not quoting or escaping correctly?

There's some syntax that I'm missing here. Running this batch file: for /d %a in ("c:\Documents and Settings\*.*") do mkdir "%a\Application Data\vlc" for /d %a in ("c:\Documents and Settings\*.*") do echo qt-privacy-ask=0 > "%a\Application…
Luca Matteis
  • 548
  • 4
  • 11
  • 21
0
votes
3 answers

Zip and FTP a File via a batch script

I am trying to ZIP and FTP a file in one batch file. The Zip part works, but the FTP application reads the entire batch script, rather than just the lines below the FTP commands, causing errors If these files are nor read sequentially, how do I Zip…
mmcglynn
  • 355
  • 2
  • 4
  • 14
0
votes
2 answers

Batch File help needed for PsList/PsKill when a process is over a specific age (elapsed time)

I'd like to request some help in creating a Batch file to run on a windows server which will monitor processes which sometimes get "stuck" and linger after they should be killed. Specifcally, I can see the "age" of a process in the Elapsed Time…
zeroasterisk
  • 275
  • 1
  • 4
  • 10
0
votes
4 answers

Iterating through folders and files in batch file?

Here's my situation. A project has as objective to migrate some attachments to another system. These attachments will be located to a parent folder, let's say "Folder 0" (see this question's diagram for better understanding), and they will be…
Will Marcouiller
  • 256
  • 2
  • 5
  • 16
0
votes
2 answers

Windows command line built-in compression/extraction tool?

I need to write a batch file to unzip files to their current folder from a given root folder. Folder 0 |----- Folder 1 | |----- File1.zip | |----- File2.zip | |----- File3.zip | |----- Folder 2 …
Will Marcouiller
  • 256
  • 2
  • 5
  • 16
0
votes
1 answer

Copy file to all users desktop

I want to copy a file to all users desktop on Windows 7 by using a batch file with the command: COPY C:\FOLDER\FILE.TXT %AllUsersProfile%\Desktop But the message "Permission Denied" is shown. How can i get the batch file to request evaluated…
883VV
0
votes
3 answers

Schedule a batch file with parameters containing spaces

I need to schedule a task in Windows Server 2003 that executes this script that deletes files older that n days in the specified folder. The script needs 3 parameters: %1 path to folder where files need to be deleted %2 file names (es. *.log) %3…
Danilo Brambilla
  • 1,031
  • 2
  • 15
  • 33
0
votes
1 answer

Dump SVN file revisions for a repository

I need a script to go through my working copy and for each file and folder dump its SVN revision and whether it is modified or not. Anything working out of the box?.. Need both Windows and Mac versions.
Michael Pliskin
  • 225
  • 1
  • 12
0
votes
2 answers

batch for loop with bracket in the command

I have a batch file with the following code: for /f "tokens=*" %%a in ('dir /b /a-d') do ( echo Processing %%a >>%LOG% dtsrun /S(local) /NNotesLoad /A"FilePath:8="%NOTESDIR%\%%a" /AClientID=%1 >>%LOG% echo Deleting %%a >>%LOG% del %%a…
benPearce
  • 321
  • 5
  • 11
0
votes
4 answers

FTP from batch file

I'm trying to use a batch file to download a package off my FTP server. echo username >ftp.txt echo >>ftp.txt echo cd directory >>ftp.txt echo get filename >>ftp.txt ftp -s:ftp.txt server.com The server is set to allow anonymous logins on…
Buzkie
  • 195
  • 4
  • 11
0
votes
1 answer

Create Batch file for laptops to copy templates

I am new to batch file programming and need an expert help to find out something. I want to create a batch file that runs at login and compares a local copy of the templates to what we have on the network. We have templates on a mapped network drive…
Hemal
  • 325
  • 1
  • 3
  • 11
0
votes
0 answers

How can I remove the first character of a variable from For and Tokens in a batch script?

With a batch script to set variable from For and Tokens and remove the first char: for /f "tokens=1,2,3,4,5,6,7,8" %A in ( 'net user %username% /domain ^| find "Global Group memberships"' ) do set groupname=%D:~1% The groupname is like…
0
votes
1 answer

How do I know if robocopy skipped the file I am copying?

I am using a batch file to copy a database backup file using robocopy (on Windows 7/2008) and need to restore (with replace) the database only after the backup file is really changed (not skipped by robocopy). robocopy \\server\share . foo.bak /TBD…
user26088