Hello!
In Windows Batch files, you can use this syntax to perform search&replace on variables:
set myvar=%myvar:foo=bar%
How to do this, however, when “foo” or “bar” include an equal sign? Escaping it with ^ does not seem to work…
Thank you.
...
trying to create a batch file for setting the user documents folder in windows so that it is accessible from the network like the public folder is by default, pretty much making it shared with everybody
Cant figure out the synthax for it though. So far tried messing with Cacls but without any luck.
Testing it on vista/7
...
Hi,
I'm using .NET to automatically create a user in Active Directory, afterwards I'm using WMI to execute shell commands on another server in the network to create a directory and set its permissions (with cacls) to grant the new user full access to this directory and it works.
However, LDAP is running on two servers in the network and ...
I have a Windows CMD script that accepts a number of parameters and executes an EXE, passing first some hard-coded arguments and then all of the parameters from the user. The CMD script looks like this:
launcher.exe paramX paramY %*
The user would execute the CMD script from the Windows shell as follows:
launcher.cmd param1 param2 pa...
How can i Create a batch (.bat,vbs,js) that can be run from command line in windows to open new URL in existing Internet Explorer window
...
I'm try to find, in only one row, the number of files (*.rar) in a directory.
For doing this I'm using the commands:
for /f "delims=" %i in ('find /c ".rar" "D:\backup e ckpdb ept-icd\test\unload\lista_files_rar.txt"') do echo %i
but the value of %i I have at the end is : D:\BACKUP E CKPDB EPT-ICD\TEST\UNLOAD\LISTA_FILES_RAR.TXT: 8...
I know that %0 contains the full path of the batch script, e.g. c:\path\to\my\file\abc.txt
I would path to be equal to c:\path\to\my\file
How could I achieve that ?
...
I'm running mysqldump and mysql commands from a batch script on Windows to make a backup of a database and restore it.
How could I check in the batch script whether these commands executed correctly or end up with error ? In case of error, I would like to know what the error is.
Thanks !
...
I made many changes to my machine so not sure if wget is available as a result of my changes or it always exists by default on Windows machines. Does it come with Windows
If not, what download function can I use in a Windows .bat script to download a file from the web. This function has to be available by default
...
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
...
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...
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...
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.
...
I'm trying to insert a string that begins with the word title as in title: New string to be inserted
into a file that has the following format. A bunch of text at the top, a block of lines each beginning with the word title:, and a bunch of text at the bottom.
Some content here at the top
And more content
and the titles will begin ne...
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...
Hi all I am new to batch files and struggling.I am using sql server 2008
I have created a single batch file that execute other batch files + sql scripts.
I would like to use variables how can I do that?
I would like to set the path as a variable.
I could have more than one path depending on the script's location.
:On Error exit
CAL...
Hi. I have a ton of files in my source repository which aren't even used in my build. I know a few of them, but I know that there are a ton more. Our build script is pretty antiquated and is a mish-mash of MSBuild, .BAT file, Perl and more. Can anyone tell me if there is a way to run my build, and then output a list of all the files ...
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?
...
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?
...
example 1
@echo off
for %%a in (precomp.exe) do set pc=%%~fa
for /r %%a in (*.pcf) do (
pushd %%~dpa
echo [%pc% -r %%~nxa]
%pc% -r %%~nxa
popd
)
When i run the bat i get precomp.exe is an unknown command I have precomp
in the folder with the script. But it will only work if i copy precompt to every sub directory an...