batch

can't call .bat file from within another - "not recognized as an internal or external command" error

hi guys, i tried looking at the other questions regarding this, but no go. i've tried a straight call to the other bat file ("otherBat.bat," for instance), a "call" command, and even a "start" command. all of these are failing though, and i'm at a loss as to why. both .bat files are within the same folder, and i'm not changing directori...

.bat file - cd to a directory with a space in its name and also using a variable?

ive written a quick .bat file that reads in the name of a directory typed in by the user, i store that variable in a variable, and then i want to actually cd to that directory. i've tested it out with simple directories like "C:," for instance, and that works. however, when i'm dealing with the user entering in something like "C:\Docume...

Batch/Powershell to determine network ID

i need to write a script that allows a network drive to be attached on a certain network ...

Batch file to wait for other program to load/initialize, then execute command?

I need some assistance writing what should be a fairly basic .BAT file. I load my main program, but that program takes ~20secs to load and be initialized. I have another command-line API I can execute to interact with this above program, but obviously until the above program is loaded and initialized there's no point in trying. If the...

AD Stopping a Script and Writing a Value to a User's AD Account PPT Presentation

‘This will launch the PPT in a GPO Dim ppt Set ppt = CreateObject("PowerPoint.Application") ppt.Visible = True ppt.Presentations.Open "C:\Scripts\Test.pptx" ‘This is the batch file at the end of the PPT that records the date, time, computer name and username echo "Logon Date:%date%,Logon Time:%time%,Computer Name:%computername%,Us...

Change a files md5 number using a batch file

I'm a really newbie, so sorry if the title isn't grammatically correct :p Anyway... Can I change a files md5 number using a batch file ...

Gracefully trap error on start cmd

On a cmd prompt or bat file, I issue the following: start textpad myfile.txt and it works fine. If the program textpad does not exist on the computer, then an error sound and a popup occurs which the OK button must be pushed. I desire to trap this error so that I could do something like start textpad myfile.txt || start notepad myf...

JDBC batch insert performance

I need to insert a couple hundreds of millions of records into the mysql db. I'm batch inserting it 1 million at a time. Please see my code below. It seems to be slow. Is there any way to optimize it? try { // Disable auto-commit connection.setAutoCommit(false); // Create a prepared statement String ...

store SID in a variable

Hi, I need a way to store the current user's SID in a variable, I tried a lot of variants of: setlocal enableextensions for /f "tokens=*" %%a in ( '"wmic path win32_useraccount where name='%UserName%' get sid"' ) do ( if not "%%a"=="" set myvar=%%a echo/%%myvar%%=%myvar% pause endlocal None are working wmic path win32_useracco...

Software/Batch/Something that connects to web and downloads

Hello, does it exists a Software/Batch/Something for Windows OS that could access the web and download a file (like a xml) in a specified folder, recursively in time (like 1 time a day)? ...

Batch number variable setter.

I need help with this batch file I'm working on, Basically everytime it does a task it should plus the variable %number% by one which works fine and all and then repeat over again doing a different task until its completed. This is the code which it uses to repeat I need a way of settings basically: set svn=%svn%%number% set svnlink=...

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 zipped/compressed. I want my batch script to be called like so: BatchScript.bat "c:\temp\usd\...

Batch file script for attrib

I want to create a batch file for run attrib script for pen drive. But problem is pen drive changes. batch file that 1st ask to write drive letter Then run attrib script for that drive. (my pendrive gets virus from class that i want to clear at home by aplying attrib script below everyday attrib -r -a -s -h /s /d ...

copying a file into photoshop directory using a batch file

Hi, I am trying to modify a batch script that installs a simple script file into the users photoshop directory. The basic process of the installer is to copy the bulk of the products files into the %APPDATA% folder, then this batch script runs post-install that copies a little hook script into photoshop\presets\scripts. However we'...

bat script to delete file older than 7 days

hi guys i have a bat script in which gets all files in a folder and then converts this folder with its contents into a one RAR file. This script also adds the current date once it makes a copy and moves it this file into a backup folder, i am planning to have this bat file run by a windows scheduler task every day. My question is there...

how to remove trailing and leading whitespace for user-provided input in a batch file?

I know how to do this when the variable is pre-defined. However, when asking for the user to enter in some kind of input, how do I trim leading and trailing whitespace? This is what I have so far: @echo off set /p input=: echo. The input is %input% before ::trim left whitespace for /f "tokens=* delims= " %%a in ("%input%") do set inpu...

How do I wait for a service/process to start before continuing a batch script?

I am writing a windows batch script to uninstall some software. However I need to wait after the uninstaller has finished for a service to be restarted before continuing with the next uninstall. I can make the script wait for the uninstaller to finsh using:- for /f "usebackq" %%M in ('tasklist /nh /fi "imagename eq %process_1%"') do...

Prevent command "del /s" from entering a folder

I need to recursively remove unnecessary files from a svn repository and i have the following batch file to do this: @echo on del /s ~*.* del /s *.~* del /s Thumbs.db However, this is also deleting the entries under the .svn/ subfolders. Is there any way to prevent this commands from being executed under the .svn/ folders so that it d...

Windows batch script to delete everything in a folder except one

I have a script to delete all subfolders and files in a folder: FOR /D %%i IN ("D:\myfolder\*") DO RD /S /Q "%%i" DEL /Q "D:\myfolder\*.*" And it works great! Only problem is that I would like to exclude one or more folders, like the XCOPY exclude feature. I just cant figure how I could add that to the script. ...

Batch Image compression tool for optimizing thousands of images

Hi all, I'm maintaining a site that has thousands of images that have not been compressed nearly enough. The homepage weighs in at 1.5 Mb currently, and it could easily be way less that half that. I'm looking for some kind of tool that'll take a folder full of JPG pictures and will recompress them to their "optimal" compression value. ...