### cmd - Batch Job continues running in Control-M even though the task is completed

Hi I am have created a batch job in windows server. The task of the batch job is to ftp a file using PSFTP. When I am running the .bat file directly its working fine after the script is run the windows closes. but when I am running through our CTRL-M it stays in running status even though i receive the file via psftp. No idea what to do. Below is the script file. your help is highly appreciated.ECHO welcomecd C:\Putty\putty\start ShortcuttoPAGEANTSET INPUT_FILe_PATH="\\...\Somefilename.csv"SET YEAR=%DATE:~-4%SET MONTH=%DATE:~-7,2%SET DAY=%DATE...Read more

### batch file - Why is the value of my variable always zero?

I am trying to change the colors of the command prompt with two choice commands. I know that choice sets the error level, but when I select any number, only 0 is returned. What am I doing wrong? choice /c 0123456789abcdef /D 0 /t 25 /n /M "Choose background color: 0:Black 1:Blue 2:Green 3:Aqua 4:Red 5:Purple 6:Yellow 7:White 8:Gray 9:Light Blue A:Light Green B:Light Aqua C:Light Red D:Light Purple E:Light Yellow F:Bright White" if errorlevel 16 set back=f if errorlevel 15 set back=e if errorlevel 14 set back=...Read more

I have a batch file that runs several python scripts that do table modifications. I want to have users comment out the 1-2 python scripts that they don't want to run, rather than removing them from the batch file (so the next user knows these scripts exist as options!)I also want to add comments to bring to their attention specifically the variables they need to update in the Batch file before they run it. I see that I can use REM. But it looks like that's more for updating the user with progress after they've run it. Is there a syntax for mo...Read more

### Ghostscript - PS to PDF - Selecting multiple input files?

I created a batch file using the following code to convert PS to PDF, it works well. As an example: The input files have their names set as input.ps input1.ps input2.psetc..gswin64c.exe -dNOPAUSE -dBATCH -q -dSAFER -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="C:\test\bat/output.pdf" input.ps input1.ps input2.psBut my use is that i have the multiple PS files that are present in the path with different filenames(sometimes with random names generated) that i wish to convert to one combined PDF. How can I select an input method i...Read more

### How Close task in batch file

I've a Intranet with an asmx Page to do some works. I need to execute it, each day. I make a batch file, put it in task manager of my server. It's ok to run... But I add a part to kill this one after severals minutes and the problem is here.This is my batch file... Where is my error... I use a label (ImportToDo) to create a task and ask it to kill@echo offstart "ImportToDo" iexplore.exe http://MySrv:MyPort/interne/Import.asmx/ImportationTimeout /T 80 /NoBreak>NULtaskkill /F /IM "ImportToDo" /T > nulThanks for yours helps...Read more

### command line - How to request Administrator access inside a batch file

I am trying to write a batch file for my users to run from their Vista machines with UAC. The file is re-writing their hosts file, so it needs to be run with Administrator permissions. I need to be able to send them an email with a link to the .bat file. The desired behavior is that when they right-click on the file and say Open, they will get one of those UAC dialogs that makes the screen go dark and forces them to answer whether they want to give the application permission to run as administrator. Instead, they are just seeing "Access den...Read more

### How can I pass arguments to a batch file?

I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file.Here's what the command line looks like:test.cmd admin P@55w0rd > test-log.txt...Read more

### Creating m3u8 playlist of all *.ts files in a directory (using batch scripting)

I would like to create a HLS playlist from 300-400 *.ts segments in a directory. The file names are not continuous numbers (e.g. 0005.ts, 0014.ts, 0024.ts, 0035.ts, etc).I'm not really familiar with the possibilities of batch files, I could only make the following command: dir /o:n /b *.ts > playlist.m3u8, but the result is obviously not a playlist, only a file list.I need to add extra lines before and in between the file names:#EXTM3U#EXT-X-TARGETDURATION:10#EXT-X-VERSION:3#EXT-X-MEDIA-SEQUENCE:0#EXTINF:10.000,0005.ts#EXTINF:10.000,0014.ts#...Read more

### Set a path variable with spaces in the path in a Windows .cmd file or batch file

I'm new to script writing and can't get this one to work. I could if I moved the files to a path without a space in it, but I'd like it to work with the space if it could. I want to extract a bunch of Office updates to a folder with a .cmd file. To make the batch file usable on any computer, I set a path variable which I only have to change in one place to run it on another machine. The problem is that the path has a space in it. If I put quotes around the path in the definition, cmd.exe puts them around the path before it appends the file...Read more

### cmd - '' is not recognized as an internal or external command, operable program or batch file

Whenever I try and run mycommand.exe from my windows cmd.exe terminal, I get this error: ''mycommand.exe' is not recognized as an internal or external command, operable program or batch file'ThenI also experienced a similar error when I tried to run C:\Program Files\My-App\Mobile.exe ''C:\Program' is not recognized as an internal or external command, operable program or batch file'...Read more

### serialization - Automate the Barcode Batch printing using batch programming

Hi I am trying to automate my serial barcode printing by using .bat files. My barcode contains a 13 digit number with 4 digits as constant from the left side (for example "WXYZ000000000" where WXYZ are constant and serialization is from 000000000 to 999999999). For this I have created a PRN file which is <xpml><page quantity='0' pitch='25.1 mm'></xpml>SIZE 46.4 mm, 25.1 mmGAP 3 mm, 0 mmDIRECTION 0,0REFERENCE 0,0OFFSET 0 mmSET TEAR OFFSET CUTTER OFFSET PARTIAL_CUTTER OFF<xpml></page></xpml><xpml><page...Read more

### cmd - Batch to return line if a dynamic string is repeated

Trying to figure out a way to have batch return a line from a log file if a string is repeated. The string contains a time stamp, so the string changes.I made an example log.I wish to identify both lines when time stamped string repeats within the same second so I can record the Event# and time stamp from both lines : \\10.xx.xx.x0\c$\PATH\file.log:2017-12-15 07:48:25 Event: UNIQUE EVENT# 12456\\10.xx.xx.x0\\c$\PATH\file.log:2017-12-15 07:48:25 File Read Begin: UNIQUE EVENT# 12456\\10.xx.xx.x0\\c\$\PATH\file.log:2017-12-15 07:48:25 WinRead Re...Read more

### ssh - plink find string in remote .xml file via .bat

I am experiencing a strange issue with SSH, plink, find command and .bat execution.I want to check a setup.txt file on all my remote machines via putty/plink for a specific string. (around 50-400 putty SSH sessions, depending on my environment)@ECHO offSETLOCAL EnableDelayedExpansion(...)SET searchPattern="1234567890"SET fileToCheck="C:\foo\bar\setup.xml"(...):SEARCH_PATTERNplink -load !session! -l user -pw password find /c /i %searchPattern% %fileToCheck%>>result.txt(...)The variable session is being populated beforehand and contains a n...Read more

### Using a batch file for find a replace

I have the following batch file, (this is an example, the real one if about 20mb) in size - Code:ECHO Assigning Aircraft Registrations to HEX/MODES codes.ECHO This may take some time....pausecopy input.csv backup1.csvpausecall :FindReplace "342086" "EC-ISY" input.csvcall :FindReplace "0006AB" "I-AMCH" input.csvcall :FindReplace "00412D" "Z-WPF" input.csvcall :FindReplace "00415C" "Z-WPE" input.csvcall :FindReplace "00600A" "C9-AUL" input.csvetcits taking forever, its been running since 8am........ its now nearly 4pm.can anyone suggest a faster ...Read more

### find - Copying a specific column and line from a text file: BATCH

I have the following text file from a find command---------- TEXT.TXT[7]testI would like to copy the 7 from in this text file using columns and lines. I was thinking I could do something like this.set /p line=text.txt cols=2 lines=2This clearly does not work....Read more