Giter Site home page Giter Site logo

batch.scripts's Introduction

batch.scripts

batch.scripts's People

Contributors

chris-e-watson avatar denisbider avatar leuchte avatar npocmaka avatar stybi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

batch.scripts's Issues

Print several times

Thanks, works brilliantly! Is it possible to get some documents to print in twofold, threefold, ... ?

Suggestion for better and faster .net batch prologue

There is some suggestions to improvement on .net batch prologue.
(as a source screenCapture.bat was used)

  1. If screenCapture.exe already exist, better to call immediately, skipping search for csc.exe
  2. screenCapture.bat produces screenCapture.exe at the place where it called, not where screenCapture.bat is located. if called from multiple laces produces many screenCapture.exe
  3. if you call it from "another.bat" file located in the same folder using "sibling" pattern "call %0..\screenCapture", it will not compile (as ".bat" extension may not be added to "%0" inside screenCapture.bat under Win7)

Here is updated prologue I use:

// 2>nul||@goto :batch
/*
:batch
@echo off
if exist "%~dpn0.exe" (
"%~dpn0.exe" %*
exit /b %errorlevel% 
)

setlocal
:: find csc.exe
set "csc="
for /r "%SystemRoot%\Microsoft.NET\Framework\" %%# in ("*csc.exe") do  set "csc=%%#"

if not exist "%csc%" (
   echo no .net framework installed
   exit /b 10
)

call %csc% /nologo /r:"Microsoft.VisualBasic.dll" /out:"%~dpn0.exe" "%~dpn0.bat" || (
   exit /b %errorlevel% 
)

"%~dpn0.exe" %*
endlocal & exit /b %errorlevel%

*/

Speedup optimisation for .net batch files

Absolutely great job!

Just one suggestion to speedup operation in .net bat files:
Add if exist "%~n0.exe" %~n0.exe %* just after begin of bath body, so it will not search for .net framework if to compile .net part if it is already compiled (if compiled .exe exists, it will run it immediately):

Was:

:batch
@echo off
setlocal

Faster:

:batch
@echo off
if exist "%~n0.exe" (
"%~n0.exe" %*
exit /b %errorlevel% 
)
setlocal

PS: Edited: Added exit after execution

Capture screen not working as scheduled task

I am using your caputre screen script and it is working great if I start it manually. However ist das not work when it is started by a scheduled task. I am getting no error, but the image file is not being created.

Trying to get response using winhttpjs.bat but there is something wrong I'm doing

Hi
I'm Trying to get response from my website using your tool "winhttpjs.bat" but it's not working, what I'm doing wrong? sorry... I have poor knowledge about api and batch file.

files:
1-call.bat
call winhttpjs.bat https://*********** -method POST -body-file body.json -saveTo response.txt
2-body.json
{ "email":"****@****.***", "key":"*******************" }
3-and your tool: winhhtpjs.bat

when I run call.bat the cmd popup for a second and then an EMPTY response.txt file created!!
the email and key info are correct but for testing only.

how do you replace multiple strings with replacer.bat ?

Is there a way to replace multiple strings with a loop using replacer.bat?

call replacer.bat "content.txt" "foo" "bar" "xyz abc" "bla fart"
call replacer.bat "content.txt" "foo\bar" "xyz\abc" "bla\fart"

These commands don't work, the help isn't very helpful, and executing a command for each replacement is not something very optimized

mouse.bat positions dont work

I'm using windows 10 and the screen res is 1600x900

position arg returns correct XxY co-ordinates
but moveTo doesn't move exactly like the co-ordinates provided.

I need to enter 65000x65000 to reach (moveTo) near the bottom-right corner.

Need separate 'zip' / 'unzip' .bat files

Some users don't want all that extra information or features that you have in your file.

Me personally, I just need to have your file, but in a way that I can use them like on a POSIX system.

Virus?

Hi,
This tool would be really useful for me, but VirusTotal claims all converted batch files as malicious. Is there any technical reason for this?

Use SystemTrayNotification.bat to display a balloon notification to all logged in users?

Is it possible to use SystemTrayNotification.bat to display a balloon notification to all logged in users? Or at the very least direct it to a different user other than the logged in user?

I'm using this on an RDS machine commonly used by 3 people simultaneously. It would be awesome to pop up subtle notifications between users that don't interrupt work flow.

In batch scripts based on JScript .NET generate .exe file near .bat file

Lets concider FileTimeFilerJS.bat as example.

If I call it in different directories and call FileTimeFilerJS.bat by absolute path:

cd testdir1
/path/FileTimeFilerJS.bat . -hh -10
cd testdir2
/path/FileTimeFilerJS.bat . -hh -10

In each directory where I call it new unnecessary .exe file will be created.

My suggestion to avoid it is to create .exe file only in directory where FileTimeFilerJS.bat is located.

To do it enough just to replace:

"%~n0.exe"

To

"%~dp0%~n0.exe"

in all /hybrids/.net/*.bat files

If you agree, I can make a pull request.

.

.

impossible to use relative path for source with "unzip"-option

zipjs.bat unzip -source test.zip -destination testdir gives an error: "Either the target does not exist or is not a correct type"

The reason is the check in line 551: if(!Shell.Application.ExistsFolder(source) ){

I suggest replacing it with if(!Scripting.FileSystemObject.ExistsItem(source) ){

DragTo inaccurate

I just modified the following lines inside the DragMouseTo funcion:

replaced

mouseInput.mkhi.mi.dx = x;
mouseInput.mkhi.mi.dy = y;

for

mouseInput.mkhi.mi.dx = CalculateAbsoluteCoordinateX(x);
mouseInput.mkhi.mi.dy = CalculateAbsoluteCoordinateY(y);

And now works correctly

Post Fields by command line

hi,, i need to submit a form post, with one field. until now i was able to get value of field.. but i dont now how to submit a post request with one input value., thanks

Fix Suggestion

When the javaDetect.bat script is run after a new CMD session is opened, the following error occurs:

Environment variable JAVA_VERSION not defined

To fix this error, the comment lines assigning to the JAVA_VERSION variable have been removed.

Click to see the code.

@ECHO OFF

SET __COMPAT_LAYER=RunAsInvoker 
:: Export java settings from registry to a temporary file
START /W REGEDIT /E %Temp%\java.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft" 

IF NOT EXIST "%Temp%\java.reg" (
    START /W REGEDIT /E %Temp%\java.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft"
)

IF NOT EXIST "%Temp%\java.reg" (
    ECHO Java NOT installed 
    EXIT /b 1
)

:: Find java location
FOR /F "tokens=1* delims==" %%A IN ('TYPE %Temp%\java.reg ^| FIND "INSTALLDIR"') DO SET JAVA_HOME=%%B
SET JAVA_HOME=%JAVA_HOME:"=%
SET JAVA_HOME=%JAVA_HOME:\\=\%
SET JAVA_HOME
 
:: Get java version
FOR /F "tokens=1* delims==" %%A IN ('TYPE %Temp%\java.reg ^| FIND "CurrentVersion"') DO SET JAVA_VERSION=%%B
SET JAVA_VERSION=%JAVA_VERSION:"=%
SET JAVA_VERSION
SET JAVA_VERSION=%JAVA_VERSION:.=%
SET JAVA_VERSION=%JAVA_VERSION:_=%
SET /A JAVA_VERSION=%JAVA_VERSION%

FOR /f tokens^=2-5^ delims^=.-_^" %%j in ('%JAVA_HOME%\bin\java.exe -fullversion 2^>^&1') do set "JAVA_VERSION=%%j%%k%%l%%m"
 
:: Delete temporary file
DEL %Temp%\java.reg /S /Q > NUL 2>&1
set JAVA_VERSION

:: Check java version compatibility
IF %JAVA_VERSION% LSS 16020 (
    ECHO.
    ECHO YOU NEED AT LEAST JAVA WITH VERSION 1.6.0_20 -- this is just an example echo.
    GOTO :EOF
)
 
PAUSE

exe2bat Reverse

Hi, i´ve just used your https://github.com/npocmaka/batch.scripts/edit/master/hybrids/iexpress/bat2exeIEXP.bat , I have to say is awesome.
Now the problem is that I dont know if some malware ( or a colleague of mine ) deleted all my *bats, although I still have the generated Exes but none of their respective sources.
Do you have a file to reverse the process? Or indicate an app/ online site that could decompile it? so I can have access to de code again?
Thanks a lot and again, great tool!

bat2exe.bat

The script is run in the temp folder how to transform into .exe running in the local folder where the .bat was converted?

scale.bat dosnt work anymore

Hey ther. i used the scale.bat and its worked since long time and now its dont scale it :(

since 2 days the scale.bat dosnt scale my .jpg anymore. i tryed with 1 line comands and with only defaults sets. nothing worked.
if ther any updates on windows 10 i missed to check or is somthing else? i cant explain it on me.

both systems (pc and laptop(windows 10 on both)) have this problem.

i used the scale.bat in original with only changed this defaults
var maxWidth=300;
var maxHeight=300;
var force=true;

and i call it with this line:
for /f "delims=" %%X in ('dir /s /a-h /b *Folder.jpg') do (call scale.bat -source "%%~dpXFolder.jpg" -target "jpg") & (attrib +H "%%~dpXFolder.jpg")

in system\monitorInfo.bat file opener is missing

In between endlocal and del ~.txt /q /f >nul 2>nul, ~.txt is missing. On its current state, the file won't open any file. Also, adding if EXIST in the first deletion command would make everything cleaner.

Final state of the file:

@echo off
if EXIST ~.txt del ~.txt /q /f >nul 2>nul
start "" /w dxdiag /t ~
setlocal enableDelayedExpansion
set currmon=1
for /f "tokens=2 delims=:" %%a in ('find "Current Mode:" ~.txt') do (
echo Monitor !currmon! : %%a
set /a currmon=currmon+1

)
endlocal
~.txt
del ~.txt /q /f >nul 2>nul

I would have opened a pull request but I have no idea on how to do it.

( I'm a beginner ) I need help with a program I want to write

I want to write a batch script that will start a website if it isn't started and detect if it is closed and reopen it again, I'm not sure if this is possible but im really intrigued to find out so far I'm stuck on how to get it to loop as in constantly check if the website is open or if it is closed right now I'm going somewhere along the lines of this but I get stuck on trying to figure out how to loop it to where it will reopen the website if closed

@echo off
Color 09
Title Website Checker
Goto start

:start 
Taskkill /T "msedge.exe"
Cls
Echo press any key to launch website.com
Pause
Start www.website.com
Timeout /t 15
Pause

sendKeys.bat does not work if the window is minimized

I am trying to use sendKeys to bring a window to foreground by sendKeys "window title" "" but seems it only works if the window is hidden, if it is minimized, then this will not work..
is there a way to add this feature of restore minimized window?

How to continue scripting in windows batch?

Thanks very much for the script.
I don't understand how to continue scripting after saving to external file the script output.

once the output has been saved to external file, the script closes and I can't execute other code after the winhttpjs,bat.

Is there a way to bypass this behaviour?

Thank you in advance.
Giuseppe

Suggestion for better and faster .net batch prologue without redundant .bat output

There is some suggestions to improvement on .net batch prologue, future improvement of (#25)

It runs .exe files immediately if .exe file is located near .bat file.
It does not generate output // 2>nul || at the begin

Here is updated prologue I use, attached to hello world example:

@goto :batch_start_label_cs_hybrid
/*
@:batch_start_label_cs_hybrid
@echo off
if exist "%~dpn0.exe" (
"%~dpn0.exe" %*
exit /b %errorlevel% 
)

setlocal

:: Additional options to csc.exe (like /r:"references")
set CSC_OPS=

:: Runner options
set CS_FAIL_EXIT_CODE=1001

:: find csc.exe
set "csc="
for /r "%SystemRoot%\Microsoft.NET\Framework\" %%# in ("*csc.exe") do  set "csc=%%#"

if not exist "%csc%" (
   echo Error: no .net framework installed
   exit /b %CS_FAIL_EXIT_CODE%
)

set BAT_START_LINE=batch_start
set BAT_START_LINE=%BAT_START_LINE%_
set BAT_START_LINE=%BAT_START_LINE%label_cs_hybrid

call findstr /V "%BAT_START_LINE%" "%~dpn0.bat" > "%~dpn0.bat.cs"
if not exist "%~dpn0.bat.cs" (
   echo Error: fail to prepare executable
   exit /b %CS_FAIL_EXIT_CODE%
)

call %csc% /nologo %CSC_OPS% /out:"%~dpn0.exe" "%~dpn0.bat.cs" || (
   exit /b %CS_FAIL_EXIT_CODE%
)

del "%~dpn0.bat.cs"

"%~dpn0.exe" %*
endlocal & exit /b %errorlevel%

*/
using System;

public class Program
{
    public static int Main(string[] Argv)
    {
         Console.WriteLine("Hello, world!");
         return 0;
    }
}

I use this prologue in zip.bat utility:
https://github.com/openlab-vn-ua/BatArt/blob/master/zip.bat

pinnerJS does not work windows 10 pro

call pinnerJS.bat Regshot.exe startmenu
return

pinning Regshot.exe to start menu

Regshot is not pinned
not in folder %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu
not in C:\ProgramData\Microsoft\Windows\Start Menu
not in C:\ProgramData\Microsoft\Windows\Start Menu\Programmes

Thanks for fix

Option -keep no is unreliable

Hi,
Thank you for this great script!

The option -keep no doesn't seem to be reliable though. Sometimes the source folder remains to exist; some of its contents was deleted, but not all if it.
I've worked around this by performing an RD of the source folder aftwerwards.

Best regards,
Johan

Microsoft Defender Alert!

It alerts me everytime I run/edit one of your batch files

We protect your PC

Are you 100% sure that your batch files are safe?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.