In my batch file I have the script:
set myVar=/someLabel:"%1"
I want to write the if command for the above script that have the same meaning as below.
if <%1 not null> {
myVar=/someLabel:"%1"
}
else
{
myVar=""
}
How can I do this? Please help!
[Edit]
The answer from user hfs works for me.
The full details of the if and set ...
I'm guessing this is a basic DOS question, its with the del command. All I want to do is delete a file.
C:\Documents and
Settings\matthewe\Desktop\testfolder>del
C:\Documents and
Settings\matthewe\Desktop\testfolder\test.pdf
The system cannot find the path
specified.
I can guarantee that test.pdf exists, and the fact I'v...
Why does ERRORLEVEL behave differently in these two circumstances?
From the command line:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>aescrypt.exe -v 2> NUL
C:\>echo %errorlevel%
9009
Versus from batch file:
@echo off
set /P C="> "?
set or=
if "%C%"=="a" set or=1
if "%C%"=="A" set or=1
if ...
Hi, I have a fairly simply batch file to backup a Directory on Server 2008 using cwrsync to a Linux server, and to restore.
Backup script:
@ECHO OFF
SETLOCAL
SET CWRSYNCHOME=C:\Program Files (x86)\cwRsync
SET CYGWIN=nontsec
SET HOME=%HOMEDRIVE%%HOMEPATH%
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\BIN;%PATH%
rsync -e "ssh -i new.key"...
I have the following windows batch code:
for %%i in (iidbms iigcc iigcd dmfacp dmfrcp rmcmd qwerty) do (
tasklist | findstr /i %%i
echo %errorlevel%
if %errorlevel% == 0 (echo %%i ok process found %errorlevel%)
if %errorlevel% == 1 (echo %%i no process found %errorlevel%)
)
But it doesn't work as I expect.
...
i use cpanel to upload everything to my websites... but the problem is that i have to browse select and upload each and every image. page or file individually... is there a way i can do this in batch
...
I want to write a script that loads a url (eg. http://google.com) automatically. But I don't want to install any 3rd party libraries or programs to the server. what's the easiest way to do this?
I just my options are batch script, vb script or powershell right?
...
@echo off
SET first=0
FOR %%N IN (hello bye) DO (
SET first=1
echo %first%
echo %%N
)
It seems that the variable "first" is always 0. Why?
...
I am just beginning to learn command line scripts, and I have an assignment for school in which the first part is to create a batch file that accepts two integers as parameters. The integers will be subsequently manipulated throughout the question, and I am not looking for any help with that. I have googled this many different ways, an...
AIR doesn't permit launching .bat files as a native process directly, so apparently i'm suppose to set CMD.exe as my startupInfo executable and pass my .bat file and it's arguments.
i can't get it to work, so i'm hoping it's a syntax problem. here is my code:
var testStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo(...
There is a way with the IF command to include a variable in a set of values?
What I mean is:
IF %%i in (abc 123 opl) echo first set
IF %%i in (xyz 456 bnm) echo second set
...
The following assignment:
set ora=%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%
returns the value " 9194234" when the time is 9.19.42,34.
How can be squeezed the value or better to have the value "09194234"?
...
I have a folder with sequentially named images (a0001, a0002, a0003, etc.) and I was wondering if there was a way to delete every 3 files without touching the others.
So for example, I have: a0001, a0002, a0003, a0004, a0005 a0006, a0007, a0008, a0009
And after I would like to have: a0001, a0005, a0009
...
Hello
I have a DOS batch file that performs an action for files beginning with text "SP", as follows:
FOR /F "tokens=*" %%A IN ( 'DIR SP*.sql /s /b' ) DO ECHO .compile_file = "%%A" >> output.txt
The key bit here is obviously:
DIR SP*.sql /s /b
I need to do a similar thing before the "FOR" line above, but for all other files not st...
Hi
im using a .bat File via windows Shortcut to tag freshly created files vith a prefix containing the actual date.
Id like to run this while saving any file in whatever application.
set var= %DATE%
set datu=%var:~7,4%%var:~4,2%%var:~1,2%_
echo %datu%|clip
now when I run the shortcut my cursor exits from the actual input field. I'll...
Hello all,
I have a problem with GOTO command and affiliated labels.
Facts: Given a bunch of files from a folder (they are log errors) I need to open them and check if they contain a specific string. If yes then eliminate some characters (all the chars after the last appearance of "_", including itself) from the file names and do othe...
I would like to change the following batch file to use spaces instead of underscores. However, when I do that the directories come out weird. I've tried using quotation marks, but they come out wrong.
md Sample_sample
md Sample_sample\sample
md Sample_sample\sample2
md Sample_sample3
md Sample_sample2
md Sample_sample\sample\sample
PS...
If I know I have n records, and I want to do something to a group of r records at a time (basically do stuff to n in batches because n is really large), what is the algorithm for that? Any language is OK (though I'm using PHP).
The algorithm should keep in mind that in the final iteration, there may not be enough records to create a co...
Hi,
How can i write a MS dos ftp batch file to:
download files from the server to my local pc
remove these files from the server after download
cheers!
Edit
ok so far i have...
Batch file:
ftp.exe -s:ftp.txt
FTP.txt:
open domain.com
usernamehere
passwordhere
cd /httpdocs/store/files
need get, list an...
Hi guys, trying to make a .bat script, and need to get some strings working properly.
This is what I've got so far
@echo off
for /r %%i in (*.csv) do (
set str=%%i
set str=%str:csv=rar%
echo %%i
echo.%str%
)
Say I've got this running in C:\, and got 5 csv, 1.csv, 2.csv... 5.csv
First time I run it, I get output of:
C:\1.csv
C:\2.c...