bat

'Translate' .sh to .bat

HI! I would like to use this simple script.sh: #!/bin/sh filename=$1 echo $filename | sed 's/\([A-Z]\)/ \1/g'; In a script.bat, but my computer is not Windows, so I can't test it. This one would be correct?? prueba.bat filename=%1 echo %filename% | sed 's/\([A-Z]\)/ \1/g'; Thanks in advance ...

Can a script.bat make changes to Windows PATH Environment Variable

I'm trying to write a script that when clicked will add a couple of entries to the PATH Environment variable in Windows, instead of making the changes manually. I see .bat files being used all the time on Windows for a variety of reasons, so can a .bat script help me with something like that? I actually need to download a zip from a lo...

bat function to edit a file (add line to start of a file)

In my bat script, what do I use to open a file called open.txt and add the following line to the top SOME TEXT TO BE ADDED Can small edits like this be handled in a .bat script ...

How .bat can check if curl or wget exist

In my .bat file, how can I check if wget or curl are available in the system through whatever other previous installations the user may have went through. Is this check possible, and can I have if then else logic in my file to react differently, like we do in normal programming. I basically want to use wget or curl to download a file. I...

bat adds line at specific line number

I'm taking this approach to add a line SOME TEXT TO BE ADDED to the top of an existing file. Is there a way to specify the exact line number to add the new text. For example, before the last line (and add a line break) or after the 3rd line (and add a line break) copy original.txt temp.txt echo.SOME TEXT TO BE ADDED>original.txt type te...

bat read a file line by line

In my bat script, is it possible to access a txt file and read it line by line. The idea I'm having is to check if the line starts with an identifier word (in my case 1 or 2 stars * or **) but to do this I need to read the file line by line. ...

.bat script copy into System32 gives Access Denied

I'm writing a .bat script where I need to copy a file to System32. I change to the folder then attempt to copy the file from a storage folder to the System32 folder. cd C:\Windows\System32 copy %~dp0file.txt file.txt I get an error Access Denied, 0 files copied. I see why this is a problem, because if I try to copy a file to Syste...

.bat current folder name

In my bat script, I'm calling another script and passing it a string parameter cscript log.vbs "triggered from folder <foldername> by Eric" The string parameter as you can see contains the name of the folder from which the script is being called. What's the right way to pass this dynamically insert this folder name to the script? ...

Does a bat file know its name and can it delete itself

At some point in my script, I'd like the bat script to delete itself. This requires that the script know its name and then to use that name to delete itself. Is this possible? ...

after kill application and start , it runs in background

Hi i wrote simple script as .bat file, and if i run this using windows scheduler , it kill the application and restart , but after that application runs in background as a proces, what shoud i do to see it in my screen? taskkill /F /IM program7.exe start D:\AIMR\CS\program.exe ...

Windows Bat file optional argument parsing

I need my bat file to accept multiple optional named arguments. mycmd.bat man1 man2 -username alice -otheroption For example my command has 2 mandatory parameters, and two optional parameters (-username) that has an argument value of alice, and -otheroption: I'd like to be able to pluck these values into variables. Just putting out ...

How to Create Registry key using a batfile

Need to Create a Registry Key using bat file.Can I create Reg Key using Command prompt or a bat file. The main purpose behind this , I want to create envoirment variable using bat file. ...

Can't disable the button from executing .BAT

Can anyone explain why my button keeps launching the associated .BAT file every time I click it, even though I have set it to disabled? Private Sub TabPage3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage3.Click Dim RetBat3 RetBat3 = Shell("c:\QUEEN ANNES REVENGE\SYSTEM\BAT\UNDO_1.bat", 1) ...

real number on gawk

i am using gawk on a windows computer with cygwin what i am trying to do is find min and max from three columns two are lat and lon and the third column is the value this is the code: echo off for /f "tokens=1,2,3 delims= " %%a in ('gawk "BEGIN {maxc = 0} {maxlo=0} {maxla=0} {if ($3>maxc) maxc=$3} {if ($1>maxlo) maxlo=$1}...