Hi guys just wondering if u can help me modify this script that ive been playing around with, i cant get it to accept wildcard charcters '*'
@echo off
setLocal EnableDelayedExpansion
set /a value=0
set /a sum=0
FOR /R %1 %%I IN (*) DO (
set /a value=%%~zI/1024
set /a sum=!sum!+!value!
)
@echo Size is: !sum! k
Its in a batch file calle...
How can I set an environment variable in WSH jscript file that calls another program? Here's the reduced test case:
envtest.js
----------
var oShell = WScript.CreateObject("WScript.Shell");
var oSysEnv = oShell.Environment("SYSTEM");
oSysEnv("TEST_ENV_VAR") = "TEST_VALUE";
oExec = oShell.Run("envtest.bat", 1, true);
envtest.bat
---...
Hi guys me again :) I have a problem with a batch file I wrote. It works fine on 32-bit, but apparently it doesn't work on 64-bit systems, and I don't know why because I do not have access to a 64-bit system.
This is the code that works on Vista 32-bit system
@echo off
Set Reg.Key=HKLM\SOFTWARE\Malwarebytes' Anti-Malware
Set Reg....
I'd like to get the parent directory of a file from within a .bat file. So, given a variable set to "C:\MyDir\MyFile.txt", I'd like to get "C:\MyDir". In otherwords, the equivalent of dirname() functionality in a typical UNIX environment. Is this possible?
...
When I execute a .bat script from bash in Cygwin, by what mechanism is it running? I understand that if I run a .EXE it will launch, regardless of whether the .EXE is from Cygwin or from a more traditional environment. I understand that when I execute an executable script with #! at the beginning that Cygwin supplies the magic for it t...
Hello,
Has anyone used taskkill on Win XP in an if condition? I want to use it as a watchdog to restart a program in case it leaks memory and grows too big by adding it in an unending loop.
For example with the following command I can kill Internet Explorer if its memory usage is greater than 40kb (will happen every time):
taskkill /...
I'm using a batch file to open a few new windows. Once they complete their processes, I have the /c set they quit. However, I'd like for my main batch process to wait for one window to finish before moving on, instead of doing everything at once.
For example, if my main batch file has:
@ECHO OFF
start "Win1" cmd.exe /c scomp -out ........
How do i launch 2 apps at once in a .bat file? my current text is
cd mydir
my.exe
my.exe difParams
//bat is finished. i dont want my.exe to close
...
The thing is that I need to pass one parameter with question marks in it to a .bat batch file. If I use the question mark the parameter is not well passed. How can I solve this?
I'm having troubles with this line:
script.bat /n"output.owl" /r"http://www.address.com/blog/?feed=rss2"
= symbol might be a problem too.
...
Hey,
I have a batch file I've created which uses xcopy to copy a dir, and child dirs, and merge them into one file. (ie. all my modulised development css stylesheets merged into one production stylesheet).
Everything is good, apart from the fact that when I reference the excludelist.txt, it only excludes the first line, and not the sub...
Hi!
I need a backup script but the executed program after executing asks Y or N for continuing.
How to write a script to automatically insert Y.
for example the program acts like this
c:\tool\backup.exe -b
Continue Y, N?
now I would need that I create a bat script, but how to insert Y automatically?
...
I have directory structure:
DIR
|-component_name
|-source
|-setup.exe
|-another_component_name
|-source
|-setup.exe
|-yet_another_component_name
|-source
|-setup.exe
and so on...
In every directory like "component_name" I have setup.exe file which installs current component to the palette component in Delphi. I need to ma...
I've got a Windows XP batch script which cleans some directories, but I would like to move the deleted files to trash instead of using plain del. How is this done?
It looks like the only languages I can use for this is plain batch or Perl.
...
I have several batch files that I call from a parent batch file. I need to trap if there are any errors that occur in the child batch files. When a child batch file makes a call to an exe file, I am able to trap the error in the child batch file just fine. How do I surface it up to the parent batch file?
...
Is it possible to run a windows xp bat script remotely from a ubuntu machine via command line?
...
I've got a big Windows legacy application composed by many executables interacting with a database.
Executables have 4 main purposes:
(a) parsing and loading a file on a database
(b) transform a file (e.g. encode a file.) Tthis may as well split a file in many parts.
(c) perform some sort of complex updates in the database
(d) produc...
I am using a CAD application which will have monthly updates. For updating, we need to uninstall the current version and install new version which will come with the new patch.
Can we do that?
...
I have a windows bat file which I would like to accept user input and then use the results of that input as part of the call to additional commands.
For example, I'd like to accept a process ID from the user, and then run jstack against that ID, putting the results of the jstack call into a file. However, when I try this, it doesn't wor...
I'm trial and erroring a trivial batch script:
I need to execute the .bat and have it iterate through all the files in the current directory and delete all files (and subfolders) except for itself and two other files.
This works:
@echo off
for /f %%f in ('dir /b c:\d\test') do (del %%f)
This doesn't:
@echo off
for /f %%f in ('dir /...
I have a file (directories.txt) with directory names, each on a single line and I like to expand the line
C:\Documents and Settings\%USERNAME%\My Documents
In my script to the real user name running the script. However the echo comes out exactly the same as the line and %USERNAME% does not expand.
FOR /f "tokens=*" %%X IN (directorie...