Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

3251.

Solve : Opening bat files remotely?

Answer»

Hi I'm new here and I was wondering if it's possible to open a bat FILE remotely on another computer in your home network.

So help me out if you canQuote from: delibrete on April 13, 2009, 05:56:04 PM

Hi I'm new here and I was wondering if it's possible to open a bat file remotely on another computer in your home network.

So help me out if you can
Post count+possible danger=We're not helping you.

Innocent until proven guilty, but we don't have to help you do something possibly dangerous!I'm not TRYING to do anything dangerous.

I'm working on a LAN Messenger that uses net send and I was wondering if it's possible to either send or open that batch file from another computer.Quote from: delibrete on April 13, 2009, 06:06:28 PM
I'm not trying to do anything dangerous.

I'm working on a LAN Messenger that uses net send and I was wondering if it's possible to either send or open that batch file from another computer.
A LAN Messenger...wow. Using Net Send? I can make one in less than 3 minutes that uses text files on a network drive, but I've never personally used net send...

And to answer your question, I don't think it's possible UNLESS you use remote destop CONNECTION...Hmmm, I'm not sure what your trying to say about net send but thanks for the helpQuote from: delibrete on April 13, 2009, 06:13:07 PM
Hmmm, I'm not sure what your trying to say about net send but thanks for the help
What do you mean. I just said that I've never used net send before, and that I can make a LAN Messenger in less than 3 minutes.oh ok

if you curious about what I'm doing then here it is

(Note: it's not completed and it looks very n00bish)

@echo off
net start messenger
:main
cls
TITLE Lan Messenger v1.0 BETA
color 02
echo #######################
echo Lan Messenger v1.0 BETA
echo #######################
echo Welcome
net users
net view
set /p n=Select User:
echo You are chatting with %n%
goto A
:A
echo -
set /p m=Type message:
net send %n% %m%
Goto AQuote from: delibrete on April 13, 2009, 06:24:58 PM
oh ok

if you curious about what I'm doing then here it is

(Note: it's not completed and it looks very n00bish)

@echo off
net start messenger
:main
cls
TITLE Lan Messenger v1.0 BETA
color 02
echo #######################
echo Lan Messenger v1.0 BETA
echo #######################
echo Welcome
net users
net view
set /p n=Select User:
echo You are chatting with %n%
goto A
:A
echo -
set /p m=Type message:
net send %n% %m%
Goto A
You can remove the FIRST goto A, as it will go to A anyway.oh yeah,

silly me

thx

helpmeh, how would you make a Lan messenger?Quote from: delibrete on April 13, 2009, 06:53:09 PM
oh yeah,

silly me

thx
Lol, it's a common mistake.

Do you have a network drive, (files shared between all the computers)?well,

I'm not connected to any home networkQuote from: delibrete on April 13, 2009, 06:58:07 PM
well,

I'm not connected to any home network
Will you be soon/some time in the almost near future?Hopefully,

I'm trying to convince mum to get a wireless router and some adaptersQuote from: delibrete on April 13, 2009, 07:05:52 PM
Hopefully,

I'm trying to convince mum to get a wireless router and some adapters
Well, here is a 2-part LAN Messenger (I use it at school a lot)

File one:
CODE: [Select]@echo off
set /p usr=Username:
:loop
cls
set /p msg=Message:
echo %usr%^: %msg% >> FILEONNETWORK.EXTENSION
goto loop
File two:
Code: [Select]@echo off
:loop
cls
type FILEONNETWORK.EXTENSION
ping localhost -n 2 -w 1000 > nul
It's bare-bones, but it works. You can add any fancy stuff you want to it.
3252.

Solve : Partition Resize From Command line??

Answer»

Is there a program that I can run in DOS on the command line that I can shrink an NTFS volume? I'd like to make it so I can put it on a CD and it will automatically run after making a batch script so there WONT be any user intervention. (This is for large hard drives with little data on them so data loss shouldn't be a problem)

I want to shrink the volume so i can put a small FAT32 partition at the end of the disk.I've never heard of a way to resize a partition from the command line.
Just make sure that you back up anything critical if you do go with a Windows solution THOUGH.DiskPart will do it but it's pretty dangerous utility in the hands of those unfamiliar with it...Diskpart will work in dos even though it's part of windows ?Quote from: MikeBAM on November 05, 2009, 07:58:34 PM

Diskpart will work in dos even though it's part of windows ?
Read the link Patio posted.
Or this one:
"DiskPart Command-Line Options"
http://technet.microsoft.com/en-us/library/cc766465(WS.10).aspx Diskpart maybe command line but it cannot operate outside of windows like MS-DOSif you can get you hands on a Linux boot CD there a utilities that will do what you are looking for.

A different option WOULD be to get your hands on a ERD Commander from systools. some very good tools and utilities in a windows like ENVIRONMENT that hooks into the reg of the host COMPUTER. The ERD is put on a boot CD or USB so it runs outside of windows. pure DOS cannot access hard drives larger then... well, I forget the exact value, but I don't think it exceeds around 64 GB.

Also it does not recognize NTFS partitions.


There is no pure DOS command line utility you can use for resizing partitions. The closest you can get is probably fdisk, excluding the good number of tools available for this purpose (I believe there are tools for resizing partitions that will run on DOS... but they wil lbe too old to recognize NTFS, I think.

However as suggested there are a number of already existing boot CD solutions that posess this ability.Thanks for your suggestions guys. I already do have a ubuntu bootable disk and an EDR commander. They are great utilities. I know they can resize partitions by hand, but how can i automate the task? Because that's really the goal here.
3253.

Solve : How Extract Value between Parethesis?

Answer»

I need to extract the value between parentheses into a variable, I am not sure if there an easy way to do it.

STRING="QMNAME(testqm) STATUS(Running)"

How can I get the following:
var1=testqm
var2=Running

This must be done in DOS only....

ThxI am hoping you mean NT family COMMAND prompt & not real MS-DOS...

1. Batch code

Code: [SELECT]@echo off
set STRING="QMNAME(testqm) STATUS(Running)"
for /f "tokens=1-4 delims=()" %%A in (%string%) do (
set var1=%%B
set var2=%%D
)
echo var1=%var1%
echo var2=%var2%

2. Output

Code: [Select]var1=testqm
var2=Runningyou can use vbscript
Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
str1 = objArgs(0)
s=Split(str1,")")
For i=LBound(s) To UBound(s)
c=InStr(s(i),"(")
If c > 0 Then
WScript.Echo Mid(s(i),c+1)
End If
Next

save as test.vbs and on command line:
Code: [Select]C:\test>cscript /nologo test.vbs "QMNAME(testqm) STATUS(Running) BLAH(blah blah) "
testqm
Running
blah blah


what tool are you using to display running PROCESS status? Quote from: et_phonehome_2 on November 09, 2009, 02:50:22 PM

I need to extract the value between parentheses into a variable, I am not sure if there an easy way to do it.

STRING="QMNAME(testqm) STATUS(Running)"

How can I get the following:
var1=testqm
var2=Running

This must be done with Batch only....

Thx

There is no doubt that the batch solution is much better than the the VBS attempt above. Plus Et_Phone, the original poster, requested Batch.

VBS needs a board of its own.

p.s.: VBS failed to assign testqm and running to variables.

Casper failed to read instructions from the original poster? Quote from: billrich on November 09, 2009, 05:29:39 PM
There is no doubt that the batch solution is much better than the the VBS attempt above. Plus Et_Phone, the original poster, requested Batch.
no, you lost soul. the vbscript gets all text between parenthesis , no matter how many. The batch only gets 2nd and 4th.

Quote
VBS needs a board of its own.
tell that to the administrator of the site.

Quote
p.s.: VBS failed to assign testqm and running to variables.
trivial trivial. you are always harping on trivial things. you sound like a woman to me.

Quote
Casper failed to read instructions from the original poster?
the OP says DOS only, which i will assume he meant cmd.exe , so until he says "i don't need a vbscript", i will still keep posting vbscript solutions.. so what you gonna do about it ? go suck a thumbSalmon Trout, thanks for the response, I never realize that with DELIM, one can specify more than one expression.

Thanks to all for your response. The reason I did not ask for VBScript, its because none of my servers have VB on it....Quote from: et_phonehome_2 on November 10, 2009, 05:48:17 AM
its because none of my servers have VB on it....
its vbscript, not VB.!! what WINDOWS server version are you running ?
3254.

Solve : i need script?

Answer»

Hi all

I have the following file ( router access list)

ip access-list extended access-1-1
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.5
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.6
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.4
permit ip host 172.16.8.6 host 192.168.1.10
deny ip any any log-input
ip access-list extended access-1-2
permit tcp host 192.168.1.4 172.16.2.0 0.0.0.255 eq telnet
permit tcp host 192.168.1.5 172.16.2.0 0.0.0.255 eq telnet
permit tcp host 192.168.1.6 172.16.2.0 0.0.0.255 eq telnet
permit tcp host 192.168.1.10 eq 443 host 172.16.8.6
permit tcp host 192.168.1.10 eq 443 host 172.16.9.142
deny ip any any log-input
ip access-list extended access-2-1
permit ip host 172.16.12.4 host 192.168.1.11
permit ip host 172.16.12.4 host 192.168.1.13
permit ip host 172.16.12.4 host 192.168.1.14
deny ip any any log-input
ip access-list extended access-2-2
permit tcp host 192.168.1.11 eq tacacs host 172.16.12.4
permit udp host 192.168.1.13 eq syslog host 172.16.12.4
permit tcp host 192.168.1.13 host 172.16.12.4 eq telnet
permit tcp host 192.168.1.4 host 172.16.12.4 eq telnet
deny ip any any log-input


I NEED to SEPARATE it into 4 files .txt .
Each begins with the phrase "IP access-list extended"
and then the name (access-1-1, 1-2 ... and so on).

all end with "deny ip any any log input"

i.e File access-1-1.txt

ip access-list extended access-1-1
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.5
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.6
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.4
permit ip host 172.16.8.6 host 192.168.1.10
deny ip any any log-input


any idea about a script that can do this??

Please help. Thanks.This looks possible with a FOR loop...if you can download Gawk for windows (see my SIG), here's an alternative.
Code: [Select]C:\test>gawk "BEGIN{d=1}/deny/{print>d\".txt\";d++;next}{print>d\".txt\"}" file.txt

output:
Code: [Select]C:\test>more 1.txt
ip access-list extended access-1-1
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.5
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.6
permit ip 172.16.2.0 0.0.0.255 host 192.168.1.4
permit ip host 172.16.8.6 host 192.168.1.10
deny ip any any log-input

C:\test>more 2.txt
ip access-list extended access-1-2
permit tcp host 192.168.1.4 172.16.2.0 0.0.0.255 eq telnet
permit tcp host 192.168.1.5 172.16.2.0 0.0.0.255 eq telnet
permit tcp host 192.168.1.6 172.16.2.0 0.0.0.255 eq telnet
permit tcp host 192.168.1.10 eq 443 host 172.16.8.6
permit tcp host 192.168.1.10 eq 443 host 172.16.9.142
deny ip any any log-input

C:\test>more 3.txt
ip access-list extended access-2-1
permit ip host 172.16.12.4 host 192.168.1.11
permit ip host 172.16.12.4 host 192.168.1.13
permit ip host 172.16.12.4 host 192.168.1.14
deny ip any any log-input

C:\test>more 4.txt
ip access-list extended access-2-2
permit tcp host 192.168.1.11 eq tacacs host 172.16.12.4
permit udp host 192.168.1.13 eq syslog host 172.16.12.4
permit tcp host 192.168.1.13 host 172.16.12.4 eq telnet
permit tcp host 192.168.1.4 host 172.16.12.4 eq telnet
deny ip any any log-input

batch version:
Code: [Select]@echo off & setlocal enabledelayedexpansion

set n=0
for /f "tokens=*" %%a in (ip.txt) do (
set a=%%a
if "!a:~,2!"=="ip" set/a n+=1 & cd.>"File access-1-!n!.txt"
>>"File access-1-!n!.txt" echo %%a
)

type "File access-1*.txt"Quote from: gh0std0g74 on April 07, 2009, 06:37:13 PM

if you can download Gawk for windows (see my sig), here's an alternative.

Bloody *censored*! Have you got shares in Gawk, Inc? (or a word that rhymes?)
Quote from: Dias de verano on April 08, 2009, 12:58:22 AM
Bloody <censored>! Have you got shares in Gawk, Inc? (or a word that rhymes?)

you should just go fly a kite. Code: [Select]@echo off
setlocal enabledelayedexpansion
for /f "tokens=1-4* delims= " %%a in (input.txt) do (
echo %%b | find "access-list">NUL && (
set filename=%%d.txt
echo Creating !filename!
if exist "!filename!" del "!filename!"
echo %%a %%b %%c %%d %%e>>"!filename!"
)
echo %%b | find "access-list">nul || (
echo %%a %%b %%c %%d %%e>>"!filename!"
)
)
Quote from: Dias de verano on April 08, 2009, 01:52:21 AM
Code: [Select]@echo off
setlocal enabledelayedexpansion
for /f "tokens=1-4* delims= " %%a in (input.txt) do (
echo %%b | find "access-list">nul && (
set filename=%%d.txt
echo Creating !filename!
if exist "!filename!" del "!filename!"
echo %%a %%b %%c %%d %%e>>"!filename!"
)
echo %%b | find "access-list">nul || (
echo %%a %%b %%c %%d %%e>>"!filename!"
)
)

dias, good eyes, i just notice that the filename is from the contents of txt file. i need a pair of good eyes too

you can actually combine the echo|find && || , INSTEAD of 2 seperate check. multiple call of echo|find does a quick job, but i find the trick is somehow slow for large files.

Quote from: Reno on April 08, 2009, 02:04:40 AM
i find the trick is somehow slow for large files.

indeed.

however...

Code: [Select]@echo off
setlocal enabledelayedexpansion
set true=1
set false=0
for /f "tokens=1-4* delims= " %%a in (input.txt) do (
set firstline=%false%
echo %%b | find "access-list">nul && set firstline=%true%
if "!firstline!"=="%true%" (
set filename=%%d.txt
echo Creating !filename!
if exist "!filename!" del "!filename!"
echo %%a %%b %%c %%d %%e>>"!filename!"
) else (
echo %%a %%b %%c %%d %%e>>"!filename!"
)
)

thank you all .... The scripts worked perfectly well
Thanks again
3255.

Solve : Swap text file colomn?

Answer»

Dear EXPERTS,
In Dos batch scripting,
How to swap text file colums,
I am having text file as follows,

abc.txt
11 26 2009
10 23 2008
05 15 2009

and required output as follows WITHIN text file,
2009 26 11
2008 23 10
2009 15 05

basically wanted to replace COLUMN no 3 with coloumn no 1 and vice-versa.
please advise how to go about it.
Thanx in advance.Code: [Select]for /F "tokens=1,2,3" %%i in (abc.txt) do @echo %%k %%j %%i >> new-abc.txt

RUN from a cmd prompt:

for /?


for complete information on the 'for' command.Best to have this line to start

if exist new-abc.txt del new-abc.txt

otherwise, each time you run it (because of using the >> [append] redirection operator) new-abc.txt will grow in size

Yogesh, you manged to spell "column" 4 different ways!


C:\batextra>type tokswap.bat
Code: [Select]@echo off

for /f "tokens=1,2,3 delims= " %%a in (abc.txt) do (echo %%c %%b %%a)
Input:
C:\batextra>type abc.txt
11 26 2009
10 23 2008
05 15 2009

Output:
C:\batextra>tokswap.bat
2009 26 11
2008 23 10
2009 15 05

C:\batextra>if you can use gawk for windows
Code: [Select]c:\test> gawk "{print $3,$2,$1}" file
C:\batextra>type swapawk.bat

Code: [Select]c:\BIN\awk "{print $3,$2,$1}" abc.txt
OUTPUT:

C:\batextra> swapawk.bat

C:\batextra>c:\bin\awk "{print $3,$2,$1}" abc.txt

2009 26 11
2008 23 10
2009 15 05

INPUT:

C:\batextra>type abc.txt
11 26 2009
10 23 2008
05 15 2009

__________________________________
C:\batextra>cd ..

C:\>cd bin

C:\bin> Usage: awk [-f programfile] [-Fc] [program] [var=value ...] [file ...]

C:\bin>

MKS Toolkit Commands – vi, sed, grep, awk, tar, gnu binutils, sh ...
Familiar environment enables UNIX/Linux developers to be equally productive on Windows with tools like vi, sed, grep, awk, tar, gnu binutils, sh, ksh, csh, ...
www.mkssoftware.com/products/tk/commands.asp?product.

3256.

Solve : How to invalid invalid string input?

Answer»

Hi,

I have BATCH file and i want it to identify the invalid user input, it should validate the user input given and should
return the message saying that "You have entered invalid Environment"
Please HELP how it is possible with below CODE..

REM Please Enter Environment DETAILS Options are
REM ricdb
REM cfgcent
REM cmd
REM wld

Set /P Ename=Enter Environment Name^>

IF '%Ename%'=='wld' GOTO WLD
IF '%Ename%'=='cmd' GOTO CMD
IF '%Ename%'=='cfgcent' GOTO CFGCENT
IF '%Ename%'=='ricdb' GOTO RICDB

Thanks & Regards

Uday BholeCode: [Select]REM Please Enter Environment Details Options are
REM ricdb
REM cfgcent
REM cmd
REM wld

:start
Set /P Ename=Enter Environment Name^>

IF '%Ename%'=='wld' GOTO WLD
IF '%Ename%'=='cmd' GOTO CMD
IF '%Ename%'=='cfgcent' GOTO CFGCENT
IF '%Ename%'=='ricdb' GOTO RICDB
echo sorry invalid variable
pause
goto start

Something like that?

FB

3257.

Solve : Ask User for Input String and then play with IF clause?

Answer»

Hi,

I have BATCH file and i want it to ask for the User input (String) like below thing, i know how to do it for a NUMBER input but do not know how to do it with String input.
Logic should be like these

REM Please Enter Environment Details Options are
REM ricdb
REM cfgcent
REM cmd
REM wld

SET CHOICE
set /p choice=Type the Environment to deploy
if not '%choice%'=='' set choice=%choice:~0,1%

IF '%choice%'=='wld' GOTO WLD
IF '%choice%'=='cmd' GOTO CMD
IF '%choice%'=='cfgcent' GOTO CFGCENT
IF '%choice%'=='ricdb' GOTO RICDB
ECHO "%choice%" is not valid please try again


Choice does not work in these case.
Please HELP regarding the same.

Thanks &AMP; regards

Uday Bhole

double post see other thread

3258.

Solve : Time, in FOR [SOLVED]?

Answer»

I am trying to get the hours and minutes of the current system time in FOR, and SET the hours as %h% and the minutes as %m%...

For some reason, I can't set m=%%B in
Code: [SELECT]for /F "delims=:" %%a in ("%time%") do set m=%%bor
Code: [Select]for /f "delims=:" %%a in ("%time%") do set h=%%a & set m=%%b
Why is it not working??? I have a FEELING it is something obvious...

Just looked through the FAQ (I was bored) and found the solution!

Code: [Select]FOR /f "tokens=1-2 delims=/: " %%a in ("%time%") do (
set h=%%a
set m=%%b
)
echo %h%
echo %m%Quote from: Helpmeh on April 13, 2009, 05:46:57 PM

Just looked through the FAQ (I was bored) and found the solution!

You're supposed to do that before you ask the question. Quote from: Dias de verano on April 14, 2009, 11:15:20 AM
You're supposed to do that before you ask the question.
BUT, (and this is a good reason) some people may have the same problem and not know that the FAQ exists. I actually didn't know that there was a FAQ for MS-DOS.
3259.

Solve : Break line while appending files?

Answer»

Hi
Is there any way we can add a break LINE while appending *.txt to some other file?
for example
test1.txt contents
a b c d
TEST2.txt contents
1234
test3.txt contents
a b c d
**********
1 2 3 4

COPPY test1 + test2 test3 appends the files but I want to add break line in between.
echo ***************>>test3 adds at the end of line but I need a break line while each file is appending.
Please advice.Don't USE COPY.

Use TYPE to avoid the last line problems.
Code: [Select]
TYPE test1.txt > test3.txt
echo ***********>>test3.txt
TYPE test2.txt >> test3.txt

Dias,
this SOLUTION works good for two files where we can mention file name but I need for all *.txt in a folder.
Any idea please??YES. Use FOR loop to parse output of DIR with appropriate switches and append files one by oneOh! thanks for the tip Dias

3260.

Solve : Laptop Printer preview help?

Answer»

I have a Dell Pentium III Microsoft Windows XP LAPTOP. It shares a HP photosmart 1115 series printer with a Dell Pentium 4 Microsoft Windows XP computer. I have both COMPUTERS set up to show HP print previews, however, the preview only appears on the computer, even when I print from the laptop. Can anyone give me some suggestions on how I can get the preview to show on my laptop when I print from it? Welcome to the CH forums.

Is there some hidden reason why you have POSTED your query in the 'Microsoft DOS' forum, are you expecting a Command Line solution?

Any suggestioins on a better location? Should be on the hardware forum.
You need to install the HP CD on the laptop.I wasn't sure where the problem lay, that makes sense.

Thank you for the help!

3261.

Solve : Permanently change the PATH from within a DOS Batch File?

Answer» QUOTE from: iONik on April 15, 2009, 03:41:46 PM
Here's my mountain of code to do the job I was after...

Code: [Select]@echo off
set vara=%PATH%
set varb=;%SYSTEMROOT%\sysfiles
set VARC=%vara%%varb%
setx PATH %varc% -m
set vara=
set varb=
set varc=
not really sure the set vara=, set varb=, set varc= is necessary.



Nope. To add \dir to path: (you append it)

set path "%path%;\dir"

see here:

http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=setx+path&btnG=Google+Search&meta=lr%3D

Quote from: Dias de verano on April 15, 2009, 03:48:58 PM
Nope. To add \dir to path: (you append it)

set path "%path%;\dir"

see here:

http://www.google.co.uk/search?source=ig&hl=en&rlz=&=&q=setx+path&btnG=Google+Search&meta=lr%3D



My "mountain of code" (not really) does do the trick, but you have cut that BACK about as far as it can go I'd guess.

But I will need SETX

Code: [Select]setx PATH "%PATH%;C:\Windows\newdir" -m
3262.

Solve : extract string from file to variable?

Answer»

I wish to extract a date/time string from a text file into a variable which I can test against the current MACHINE date/time.

Can this be done in DOS or is VB a better bet?Quote from: gavinkuit on November 11, 2009, 11:23:07 AM

Can this be done in DOS or is VB a better bet?
SHOW what you want to do, with SAMPLE file examples and output text file line 3 looks similar to this:

abcde dd/mm/yyyy hh:mm:ss

I want to extract the date/time and compare it against current machine time so that if machine time is greater I can call another program.handling date is a chore using DOS(cmd.exe), its better if you learn to use vbscript. Check my sig for vbscript tutorial link. Inside, you can look up various Date functions. While you are at that, if you are not restricted, you can download GAWK for windows(ALSO my sig) and try this script.

Code: [Select]BEGIN{
now=systime()
}
NR==3{
strdate=$(NF-1);strtime=$NF
m=split(strdate,d,"/")
n=split(strtime,t,":")
thedate = d[3]" "d[2]" "d[1]" "t[1]" "t[2]" "t[3]
if ( mktime(thedate) > now ){
print "file date greater than system date"
}else{
print "system date greater than file date"
cmd="mycmd args1 args2" # put you command and arguments here.
system(cmd)
}

}
save the above as myscript.awk and on command line
Code: [Select]c:\test> gawk.exe -f myscript.awk file
3263.

Solve : Password Hiding?

Answer»

Quote

basically, it's impossible to package a batch as a PURE EXE- and if somebody "needs" too, then there is something amiss.

Who said that? This idea was to hide the password from those who would not be motivated to use EXTRA ordinary METHODS. That can be done with a batch file converter.Quote from: Geek-9pm on April 15, 2009, 04:01:11 PM
Who said that? This idea was to hide the password from those who would not be motivated to use extra ordinary methods. That can be done with a batch file converter.

Opening the resulting exe file in a TEXT editor I don't think would count as a "extraordinary" method.Quote
Opening the resulting exe file in a Text editor I don't think would count as a "extraordinary" method.
There are other versions of BAT2EXE that make the original stings meaningless in a text editor. The does not mean it is totally secure, but out of the reach of many advanced power users.
Is this worth pursuing?
Another alternative is to have a custom program to deploy passwords over a NETWORK. The original question was if you can hide a password in a BATCH file. The short answer is no. The long answer is you can make an utility that is easy to use and get the job done. And it can be put in a batch file.And the batch can be deployed over a network and not revel the password .
Was this a homework exercise?
3264.

Solve : XP Recovery HELP!?

Answer»

Hello,

I am running XP Home Edition. My PC has crashed and I can only navigate in DOS. When I turn the computer on I am directed to system recovery where I have 3 choices, the 3rd being C:Windows. I've chosen that path and am asked what my administrator password is, UNFORTUNATELY for me I have forgotten it and have tried every password that I can think of,lol. And to make things worse I have lost my system recovery CD. Is there any way to trick the computer using .dos commands to find my password or to recover my computer? Any help to these questions is much appreciated.Do you have your XP Installation CD?Try booting into safe mode and use the Admin controls in Control Panel to reset the password.
If this does not produce any joy-joy i'm afraid you are going to need to acquire an XP CD of the same version and do a REPAIR Install...
How did you lose your Admin password ? ?My PC didn't come with a recovery CD, I made one years ago but can't find it. I haven't lost my password, rather can't remember it or the system has rebooted to its original, if thats possible.if you in dos screen the password default is just press (enter)dont put anything

or try borrowing a version of windows and doing a rewpair not install....
I've tried hitting "enter" as the default password, it comes up as invalid password. And yes, I think my only hope is to find another copy of windows.Quote from: boffy1970 on May 04, 2009, 12:09:25 PM

if you in dos screen the password default is just press (enter)dont put anything

or try borrowing a version of windows and doing a rewpair not install....


Enter won't do anything, and a different copy of Windows won't work.Quote
I haven't lost my password, rather can't remember it

This is a contradiction...also the basis of your dilemna.
How do you go about losing an Admin password ? ?He could try a Emergency Boot if he has another computer with Win XP on it.you can try this:

at logon press ctrl+alt+del TWICE, there should pop up a message to enter username and password, type administrator as username and leave password blank, press enter

or boot into safe mode and use master admin account (but i think in first suggestion its using that account)as i stated a oem windows disc and correct SETUP in bios i.e the first boot priorty is cd-rom then this will overwrite any windows as it will format your drive but has to be oem version and have your boot in bios set up for cd-rom first then hdd ETC....get to bios press delete on start...Control-Alt-Delete restarts my PC. I am directed to a screen that says; Microsoft Windows XP Recovery Console with three options; 1: D:\MiniNT 2: D:\I386 3: C:\Windows. I type 3, then it asks for the Administrator Password, which might be something I used 5 years ago for security reasons but don't use anymore. I've tried all passwords which I thought it might be, no luck. Pressing enter just says "Invalid". Do you have another computer with a CD burner or atleast it has Win XP on it?
3265.

Solve : Runtime error 217 at 0281F57D and 216?

Answer»

Runtime error 217 at 0281F57D and 216

I'm obtaining these errors when I try to run the ylaunch2 bat with the lines of the programs with the option window minimized.

The content

rem M:\Archivos de programa\AutoCAD 2002 Esp\acad.exe
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\AutoCAD 2002 Esp.lnk
ping -n 1 -w 25000 1.1.1.1 >nul
wait
"M:\Archivos de programa\Procuno\BTwin\BtWin.exe"
rem "M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\BTwin. Baja Tensión.lnk"
ping -n 1 -w 25000 1.1.1.1 >nul
Y:\Ingenieria
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
Y:\GABINETE\PROYECTOS
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\RunGoldmine.bat
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\mm\Menu Gabinete.doc
rem M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\Acceso directo a Menu Gabinete.doc.lnk
ping -n 1 -w 50000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf


The screenshots








I created direct LINK and in the PROPERTIES : window minimized, but I obtain these errors.

the screenshots



[attachment deleted by admin]I suspect one of the .exe is throwing this error. I suggest you add a pause statement before each to narrow down which one doesn't like it. Once you know you can decide how to work around it.

Quote from: uSlackr on May 04, 2009, 02:14:11 PM

I suspect one of the .exe is throwing this error. I suggest you add a pause statement before each to narrow down which one doesn't like it. Once you know you can decide how to work around it.



I do inmediately and will comment

I try this :

rem M:\Archivos de programa\AutoCAD 2002 Esp\acad.exe
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\AutoCAD 2002 Esp.lnk
pause
ping -n 1 -w 25000 1.1.1.1 >nul
wait
pause
"M:\Archivos de programa\Procuno\BTwin\BtWin.exe"
pause
rem "M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\BTwin. Baja Tensión.lnk"
ping -n 1 -w 25000 1.1.1.1 >nul
Y:\Ingenieria
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
Y:\GABINETE\PROYECTOS
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\RunGoldmine.bat
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf
pause
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\mm\Menu Gabinete.doc
pause
rem M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\Acceso directo a Menu Gabinete.doc.lnk
ping -n 1 -w 50000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf


But I don't see stop or pause. Certainly I'm doing something BAD. I don't remember what to do.

Can you help me ?

I try the code above and receive no error.

After I try with this code and received the error :

rem M:\Archivos de programa\AutoCAD 2002 Esp\acad.exe
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\AutoCAD 2002 Esp.lnk
echo ejecutado autocad
pause
ping -n 1 -w 25000 1.1.1.1 >nul
wait
pause
"M:\Archivos de programa\Procuno\BTwin\BtWin.exe"
echo ejecutado btwin
pause
rem "M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\BTwin. Baja Tensión.lnk"
ping -n 1 -w 25000 1.1.1.1 >nul
Y:\Ingenieria
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
Y:\GABINETE\PROYECTOS
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\RunGoldmine.bat
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf
echo ejecutado mostrar escritorio
pause
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\mm\Menu Gabinete.doc
echo ejecutado menu gabinete.doc
pause
rem M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\SOFTWARE TECNICOS\Acceso directo a Menu Gabinete.doc.lnk
ping -n 1 -w 50000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf

I tried putting

@echo off , at the beginning, but I don't see any window and can't key nothing.


Sometimes the SCRIPT give me error and other don't give me error.
3266.

Solve : Upper and Lower case both should be accepted?

Answer»

Hi,

my bat file does not accept the values given by the user in upper CASE.
Please guide on below what changes should be done so that
bat should should accept both lower and upper case values.


@ECHO off
:start
Set /P Ename=ENTER Environment Name and then Press Enter^>

IF %Ename%==wld GOTO WLD
IF %Ename%==cmd GOTO CMD
IF %Ename%==cfgcent GOTO CFGCENT
IF %Ename%==ricdb GOTO RICDB
echo Hello You Have entered wrong Environment
pause
goto start
Before the expression in an If STATEMENT you can add the /I switch to tell IF to ignore Case.

Example:
Code: [Select]If /I '%value%'=='Test' echo Test
Hope this Helps
,Nick(macdad-)Don't work for me!Quote from: Geek-9pm on April 14, 2009, 02:33:43 PM

Don't work for me!

Code: [Select]C:\Users\_CORE>if /I 'cat' equ 'cat' echo OK
OK

C:\Users\_CORE>if /I 'CAT' equ 'cat' echo OK
OK

C:\Users\_CORE>if /I 'CaT' equ 'cAt' echo OK
OK

C:\Users\_CORE>if 'CaT' equ 'cAt' echo OK



How it can't work ?Quote from: devcom on April 14, 2009, 02:51:54 PM
How it can't work ?

YEAH, right!

Code: [Select]C:\>if /i "GeeK"=="gEEk" echo OK
OK
What do you mean, Geek-9PM? You should know better than to give that OLD "doesn't work" stuff here.

Quote
Code:
C:\>if /i "GeeK"=="gEEk" echo OK
DUH, do not work for me.
leave out C:\> OH!

Learn something everyday Quote from: Geek-9pm on April 15, 2009, 05:34:54 PM
DUH

You said it...

3267.

Solve : a batch with delete backup file in directory?

Answer»

I need an help for delete in the directory c:\backup the 5th day older file RESPECT the current DATE

ex:

c:\backup\a.zip (date 12/11/2009)
c:\backup\b.zip (date 13/11/2009)
c:\backup\c.zip (date 14/11/2009)
c:\backup\d.zip (date 15/11/2009)
c:\backup\e.zip (date 16/11/2009)
c:\backup\f.zip (date 17/11/2009)

the current date is 20/11/2009, i run the batch PROGRAM end the result in directory is:

c:\backup\d.zip (date 15/11/2009)
c:\backup\e.zip (date 16/11/2009)
c:\backup\f.zip (date 17/11/2009)

Thank you for your help.
fabio

Fabio



see here example 2. Its SIMILAR, just change 30 to 5thank you

I TRY

3268.

Solve : re problem?

Answer»

if you have an OEM version of windows and your boot order is set-up correct in bios this can be CHECKED by pressing (delete) key on boot placing cd-rom as first boot then this will overwrite any windows as it formats the drive anyway...

what im GOING on about is this this site is crap its PUT my post in wrong place as it was a reply 2 someone else also im not on crap xp im on windows 7 ultimate....so this site needsd work...sorry but i just clicked reply to an e-mail.... What are you going on about?

3269.

Solve : Searching through a .zip folder with DIR?

Answer»

Anybody have a clue how to find all .TXT files within a .zip file? Hopfully using the dir command in MS-DOS?zip files are- files, not directories.

Without a command-line zip tool, you will be unable to view the contents of the zip on the commandline, with dir or otherwise.Ahhhhh...
Memories of PK-Zip come flooding back.......
indeed!

Code: [SELECT]pkunzip -vt myzip.zip | more




Wait couldn't the dir command work there as welll ? ?
Been awhile.well- you can use dir to see the zip file, but not it's contents. Even with the "zipped folders" extensions with XP and Vista.I used to know the PKZip COMMANDS by heart...as i SAID...been awhile.

3270.

Solve : How can I get File Modified time with 10 mSec resolution ??

Answer»

I am using cscript code that has a 1 second RESOLUTION with
f = fso.GetFile(wscript.arguments(0))

Some files get modified "simultaneously".
It would assist my determination of cause and effect if resolution could be improved.

I understand that Windows creates file times with 100 nSec resolution,
and FAT32 can hold 10 mSec resolution. ref
http://msdn.microsoft.com/en-us/library/ms724290(VS.85).aspx

How EASY is it for me to improve resolution ?
I am hoping for a simple cscript enhancement.

I spent years before retirement using Assembler and 'C' for real-time software on embedded systems, and used a Borland 'C' compiler for a couple of small utilities to run under Windows 98. I STILL have the compiler, but I doubt Windows XP would survive if I did a heavy meddle ! !

Regards
Alan.
VBscript MAY not support that level of accuracy. i found this reference
http://classicasp.aspfaq.com/date-time-routines-manipulation/can-i-get-millisecond-accuracy-in-asp.html

\\uSlackr

3271.

Solve : How to check for files and folders in a directory?

Answer»

Hi All,

I have some folder 'X'.
Each time new files/folders will be created in 'X'
I have a batch file which copies the NEWLY created files/folders to another folder 'Y'.
we will not delete any files from 'Y' folder.
While copying from 'X' to 'Y' it should copy with the same folder structure as in 'X'.
And also if some file is already there in 'Y', It should move the file to 'YBKUP' folder (with same folder structure as in 'Y') before overwriting.





Please help meWhat do you have so far ? Hi gpl,

Thanks for your reply.

I have simple copy command in it which copies only files in 'X' folder.
I am unable to do it with similar folder structure(including subfolders).
It should copy the files with similar structure as in 'X'.


can you please help me...please reply me...CHECK the xcopy command (xcopy /? at the command prompt) - this will enable your to copy a directory structureThanks gpl...

Thing is, before copying it should take up backup of the files which are there in 'X' with same folder structure and then it should copy accordingly, it should not take all the files backup each time.

And moreover xcopy is not working in my system.
I am using MS windows XP professional 2002 version.

Please GUIDE me...Please help me...If You type help xcopy at the dospromp you will GET help. ypu might be told to use the command robocopy instead

3272.

Solve : Executing a program, folder, document after a time specified?

Answer»

Oh thanks, Devcom. Completely forgot about that. Quote from: Carbon Dudeoxide on May 03, 2009, 08:18:47 AM

You might want to have a look at the WAIT command (not included with Windows).

That command is used in the bat created by Startup Manager, but it's not with time, only begin the next when the last has finished.
Quote from: devcom on May 03, 2009, 10:22:22 AM
or you can use this:

Code: [Select]ping -n 1 -w 5000 1.1.1.1 >nul
it will wait 5 sec, so you can use this a wait

I'll try. Now I have a little problem. I don't remember how to resolver but I have resolved in the past.
I see the DOS windows while i'm executing the bat. I would like an invisible command window.

Where can i find more information about ping ?

Thanks
Excuse my LANGUAGE. I'm from Canary Islands
try ping /? in cmd, ping is used to test connection etc., but this is the easiest way to make wait Quote from: devcom on May 03, 2009, 12:45:32 PM
try ping /? in cmd, ping is used to test connection etc., but this is the easiest way to make wait

okis, a trick
I'm using ping, but in this bat I don´t get the CLEAN window finally .
What can i do ?

M:\Archivos de programa\AutoCAD 2002 Esp\acad.exe
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
"M:\Archivos de programa\Procuno\BTwin\BtWin.exe"
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
Y:\Ingenieria
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
Y:\GABINETE\PROYECTOS
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\RunGoldmine.bat
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\mm\Menu Gabinete.doc
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
ping -n 1 -w 5000 1.1.1.1 >nul
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf
M:\Documents and Settings\JOSE\Datos de programa\Microsoft\Internet Explorer\Quick Launch\Mostrar escritorio.scf

******
Mostrarescritorio.scf is equivalent to ShowDesktop.scf in english

Thanks
Excuse my language. I'm from Canary Islands The batch file doesn't make any sense.

All the 'waiting' is useless and unnecessary.

What is the batch file SUPPOSED to do. Can you talk us through it?@Esgrimidor
ping -n 1 -w n*1000 1.1.1.1 >nul

where n is number of seconds to wait

and what do you mean by "clean window", you mean cls command ?Quote from: Carbon Dudeoxide on May 04, 2009, 07:00:44 AM
The batch file doesn't make any sense.

All the 'waiting' is useless and unnecessary.

What is the batch file supposed to do. Can you talk us through it?

Is for open a lot of programs I use in my WORK to be prepared.
Quote from: devcom on May 04, 2009, 07:10:08 AM
@Esgrimidor
ping -n 1 -w n*1000 1.1.1.1 >nul

where n is number of seconds to wait

and what do you mean by "clean window", you mean cls command ?

A fellow answer that is

Start work.bat /MIN

this parameter is not possible in the bat created with yLaunch2
but it's possible inside the bat created.

Perhaps is better express as Show Desktop
3273.

Solve : kill a batch?

Answer»

Hi,

I want to execute batch file.
I am execute it from Java.
I am executing this command:
CMD /c start test.bat

Is there a way to limit the time it's running meaning that if the run CONTINUE over 1 hour for EXAMPLE to stop the run ?

Thanks
I believe there is a way to pass variables to a batch file when you run it from the command line. If you can do that, you can construct a loop in the .bat file to only run for a certain amount of time.I am executing another program from the batch and the timeout is actually on this program so making a loop will not help.You could start a Stopwatch or Timer in your Java program then once the Stopwatch hits an Hour then it checks to SEE if the batch is still running, and if it is then kill that proccess

Don't know much about Java, but that's just my suggestion of how to do it.

3274.

Solve : Need help using the copy command?

Answer»

Hello, does anyone know if there is a SWITCH that can be used with the copy command to update the Date Modified to the current datetime on the destination?No there is not.
I just found something on the Microsoft site....have you seen copy /b?This does not seem to be working for me but this is what I found on Microsoft.....

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

...
Changing the time and date of a file

If you want to assign the current time and date to a file without modifying the file, use the following syntax:

copy /b Source+,,
I stand corrected.

Code: [Select]C:\Program Files\gzip\bin>dir znew
Volume in drive C is WinXP
Volume Serial Number is FC8E-1A32

Directory of C:\Program Files\gzip\bin

03/04/2007 10:59 4,956 znew
1 File(s) 4,956 bytes
0 Dir(s) 3,556,474,880 bytes free

C:\Program Files\gzip\bin>copy /b znew+,,
1 file(s) copied.

C:\Program Files\gzip\bin>dir znew
Volume in drive C is WinXP
Volume Serial Number is FC8E-1A32

Directory of C:\Program Files\gzip\bin

12/11/2009 20:19 4,956 znew
1 File(s) 4,956 bytes
0 Dir(s) 3,556,474,880 bytes FREEI have been testing this:

copy /b g:\WO_CompletionFinal_Trigger.txt \\'ServerName'\CFCSourcing\WO_CompletionFinal_Trigger.txt

Any suggestions as to why this does not work?

Does this work?

Code: [Select]copy /b g:\WO_CompletionFinal_Trigger.txt \\'ServerName'\CFCSourcing
Do you have write access permission on the target drive?

Yes. I have been placing other files there as well and the Date Modified on the destination retains the create date (Date Modified) from the source. I was thinking I had something wrong syntactically?You missed out the plus sign and the two commas.

I think you would have to apply the copy /b source+,, syntax once the file has been copied over like this

so try this

Code: [Select]copy g:\WO_CompletionFinal_Trigger.txt \\'ServerName'\CFCSourcing\WO_CompletionFinal_Trigger.txt
copy /b \\'ServerName'\CFCSourcing\WO_CompletionFinal_Trigger.txt+,,
KISS

D:\$A>copy junk + "" test /b

junk keeps date
test has today's date
Both are same size
no space between quotes
This is in the XP command ine
I really appreciate the feedback Salmon, unfortunately the "copy /b \\'ServerName'\CFCSourcing\WO_CompletionFinal_Trigger.txt+,," added to the batch file did not work.

I have the destination mapped on the source computer and am viewing the files with Explorer. Do you think its just a Windows 'thing' that shows the same date on the same file? I have asked for someone to verify the Date Modified on their side (destination) to see if it is in fact the same, or later as a result of my testing (and I just can't see it on the destination side while looking at it from the source). Thankfully other processes are dependent upon its EXISTENCE only and not the date it was placed on the destination. But I think that it would still be useful, short of creating a time log.

Geek-9pm,

How would I apply the syntax you provided to this statement?...

copy /b g:\WO_CompletionFinal_Trigger.txt \\'ServerName'\CFCSourcing\WO_CompletionFinal_Trigger.txt

This statement works, however the date is not changing on the destination, (from what I can TELL...see above)
Here is the model:
copy source + "" target /b

Long stings of text make it hard for me to DEBUG. The computer is faster taht me, so let it do some of the work.

Inside a batch I would put
edit: correction made on code lines below
Code: [Select]set source=g:\WO_CompletionFinal_Trigger.txt
set target=\\'ServerName'\CFCSourcing\WO_CompletionFinal_Trigger.txt
copy %source% + "" %target% /b


Well I wish I could tell you it worked but it did not.

I appreciate the responses!corrections made above.Quote from: SQLGuy on November 12, 2009, 12:45:53 PM

Hello, does anyone know if there is a switch that can be used with the copy command to update the Date Modified to the current datetime on the destination?
You can do it natively through vbscript. assuming you already map to e:\

Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
strFileToCopy = objArgs(0) 'file to copy
strDestination = objArgs(1) 'copy to destination
strComputer = "10.10.10.10" 'your remote computer IP
Set objShell = CreateObject("Shell.Application")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set ColDate = objWMIService.ExecQuery("Select * from Win32_LocalTime")
' Get remote computer date and time
For each strDate in ColDate
strDateToChange = CDate(strDate.Day & " " & strDate.Month & " " & strDate.Year)
strTimeToChange = CDate(strDate.Hour & ":" & strDate.Minute & ":" & strDate.Second )
Next
' copy the file over to destination
objFS.CopyFile strFileToCopy,strDestination & "/" & strFileToCopy
Set objFolder = objShell.NameSpace(strDestination)
' set the file time stamp to that of the remote
objFolder.Items.Item(strFileToCopy).ModifyDate = strDateToChange & " " & strTimeToChange
Set objWMIService = Nothing
Set objFolder = Nothing
Set objShell = Nothing
usage:
Code: [Select]c:\test> cscript /nologo modifydate.vbs "file.txt" "e:\destination"

3275.

Solve : Editing file names using bat files??

Answer»

First off I would like to thank the forum and knowledgable poster for there help here.
I got my little file done by reading here in the help batch files section and reading many other post,
but the last thing I would like to do but I just can not figure out, and that is how to read a file name into
a variable so I can edit the file name, not just rename it.
What I want to do is read an existing file name which consist of a name and a version# and replace the name
part of the file but keep the version #.
EX. oldfilename_001.abc to newfilename_001.abc

Thanksyou mean:
Code: [Select]ren oldfilename_*.abc newfilename_*.abc
??

anyway you can use for to get filenames...

Code: [Select]for /F %%F in ('dir /b *.abc') do echo %~nFQuote from: devcom on April 14, 2009, 04:10:56 PM

you mean:
Code: [Select]ren oldfilename_*.abc newfilename_*.abc
??

anyway you can use for to get filenames...

Code: [Select]for /F %%F in ('dir /b *.abc') do echo %~nF

Thanks for the reply, your 2ND example is beyond me, I did SEE that in another post and it did work as far as echoing to the screen but I was not able to modify it to work for me, however your first example( can`t believe I did not think of it) should do just fine.

ThanksWell the rename as simple as it seemed I was not able to use as it is a little more complicated than just renaming a file.
In my bat file, which runs under a CMD window in Vista, the original file gets copied then archived away. The copied file has
changes made to it and is then named for use. At this point I really have no way of TELLING which file goes with which file so I
hoping to take the version # out of the original file and have it added to the new file name. Simply renaming does not work.
The 2nd method devcon provided me does not work under my CMD window. I get "The syntax of the command is incorrect". After trying it in immeditate mode on the command line the %%F causes a "%%F was unexpected at this time error". Removing one of the % does allow it to work and changing the command "echo" to "set f =" does MAKE it an environmental variable showing the file name. That is what I was looking for and I assume at this point it would be easier to edit and just take the version # from the orginal file name. However that only worked when TYPE on the command line.
Any idea what is causing the syntax error when the bat file is run?

Thankswhat is it that not working?

ren oldfilename_*.abc newfilename_*.abc
this will work as long as string length of oldfilename equal to string length of newfilename

type: dir/b *.abc
and post the few lines of the screen output here

single % is used on command prompt, when you write the code into batch file you use double percent %%.Again, I am lost.
What did you need FOR for?
Code: [Select]RENAME *_???.abc NewName_???.abc
Seems to be that Dev's for loop is to find all files in the current directory and sub-dirs that have the abc extension, and everytime it finds a file with that then show the name of the file.

if he means %~nl instead of %~nFThanks guys without your help as I would never had gotten this without it.

Code: [Select]for /F %%F in ('dir /b *.zip') do set 1 = %%F
This gives me environmental variable 1, as seen under set command, = oldfilename_date_version_type.zip.
I assume I can edit the variable 1 to take date_version_type from the old file and add that to the new file
after changes are made to the file to give me newfilename_date_version_type.abc.

Thanks for the help and I`ll see if I can edit the variable tonight.
3276.

Solve : Finding multiple strings in a text file?

Answer»

Batch example:

gh0std0g74's scheme for stepping back the strings to store the previous 3 lines read from source FILE acknowledged.

FOR line written thus to avoid (documented, apparently) problem of for /f SKIPPING blank lines

[Details in alt.msdos.batch.nt thread headed "Bug in For /F" (long Google Groups link shortened)]: http://tinyurl.com/cwr484

I wondered why the line numbers in my output didn't match those from gh0std0g74's VBscript, but then I noticed that my batch was skipping blank lines in the input file. They match now.

Code: [Select]
@echo off
setlocal enabledelayedexpansion
set string3=
set string2=
set string1=
set i=0
set f=0

set patt3={ACAD_REACTORS
set patt2=330
set patt1=C
set patt0=102

set inputfile=dwg.txt

for /f "tokens=1* delims=]" %%a in ('find /n /v "" ^<%inputfile%') do (
set /a i+=1
set string0=%%B
if "!string0!"=="%patt0%" (
set seq=1
if "!string3!"=="%patt3%" set /a seq+=1
if "!string2!"=="%patt2%" set /a seq+=1
if "!string1!"=="%patt1%" set /a seq+=1
)
if !seq! equ 4 (
set /a f+=1

echo !string3!
echo !string2!
echo !string1!
echo !string0! [Line !i!] [!f!]
echo --------------------------

set seq=0
)
set string3=!string2!
set string2=!string1!
set string1=!string0!
)



3277.

Solve : xms alloc error?

Answer»

I am currently working on a boot disk that will load drivers and such onto a ram drive. I am using xmsdsk.exe to make the drive.

I have the following in my config.sys file:

DEVICE=C:\DOS\HIMEM.SYS /TestMem:Off
DEVICEHIGH=c:\DOS\ifshlp.sys
files=30
DOS=HIGH,UMB
lastdrive=z

my batch file that LOADS the drivers has the following:

set PATH=R:\;R:\NET;C:\DOS
set TEMP=R:\net\TEMP
LOADHIGH=C:\dos\XMSDSK.EXE 2048 r: /T /Y
cd c:\PCI\net\B57
c:\dos\xcopy32 *.*/s r:>r:\temp.log
CD\
cd c:\PCI\net\Net
c:\dos\xcopy32 *.*/s r:\net>r:\temp.log
r:
LH \net\net initialize
\net\netbind.com
c:\dos\aname.exe
\net\tcptsr.exe
\net\tinyrfc.exe
\net\nmtsr.exe
\net\emsbfr.exe
CLS
\net\net start
\net\Net USE Z: %netloc%
Z:
C:\dos\mouse.com
C:\dos\XMSDSK.EXE /U /Y
C:\ghost\ghost.exe -auto -sure -z3
goto _END




The issue occurs when the following commad is ran.
LOADHIGH=C:\dos\XMSDSK.EXE 2048 r: /T /Y

I receive the xms alloc error

any ideas?

thank you,
Waynei found this:
Quote

This error appears on computers which have more than 32MB RAM, as most computers in our days do. Aladdin 'thinks' that it has too little RAM, and refuses to run. This error seems to pop up in pure DOS MODE only, not when you run the game under Windows. However, under Windows, you may EXPERIENCE sound problems, so you might want to run it in pure DOS. In which case, use the EATXMS program, as suggested by et2k, to occupy all the RAM except the last 32 megabytes.
Quote
search for the file eatxms.exe/com on search engine.after you get it,you have to "eat memory".for aladdin you need less then 32 mega.so if you have 64 megabyte,you should write something like eatxms 17000.now run aladdin normaily.for some sound cards,you have to wait for 1-2 min before the game starts.
ok but I am trying to run this on multiple systems. They will very in the amount of ram they have available to them.what is wrong with using RAMDISK.SYS to create a RAM disk?

it supports a switch for using extended memory.nothing I figured it out. We were using the /T switch on xmsdsk.exe. That works fine until you have more memory then 2048. I removed the switch and it now works fine.
3278.

Solve : Batch file to run a program?

Answer»

Hi
I am trying to use a batch file for inputting variables into a program and it works for the variables which are input before running the code, but not after. Here's how I approach it:
1- make a batch file containing this line:
code.exe < input.txt
2- enter variables in the input.txt, e.g:
yes
2
input.in
1

output.out
3- run the batch file. It reads the input variables and runs the code, but after finishing the code, doesn't write the results into output.out

Any idea?
Thanks
It can make a difference knowing which program you are using.
The DOS redirection option expects the a program use the standard input/output. I believe in C it is in the directive conio.h ...
or something like that.

A program WRITTEN for Windows may use another method of getting keyboard input. Also, some programs purge the keyboard input until an appropriate time. Don't ask them why they do this, but they do.
A viable ALTERNATIVE is to use some type of macro key program that will emulate the actual keystrokes you would use with a program. This will guarantee that the keystrokes go through the Windows operating system the way the application expects it to. Does this make any sense?I am running a code written in quick basic. C:\>type input.txt | code.exe > output.txt

or

C:\>code.exe < input.txt > output.txt

Rem tryit.bat
Code: [Select]@echo off

type input.txt | code.exe > output.txt

rem or

code.exe < input.txt > output.txt
http://support.microsoft.com/kb/q110930/



@OP it depends on how your quick basic program is written. Is it programmed to accept standard input and input redirection? If it does not, then of course you won't be able to use "|" pipes, or "<" .. logical?Hello again.
Well, I see you are using QBasic.nothing wrong with that, in fact it is easy way to solve some problems is otherwise quite difficult using just the DOS commands.
Here's an example that might be of some HELP to you.
Let's say I write a very simple program in QBasic that looks like this:
Quote

Microsoft Windows XP [Version 5.1.2600]
d:\bin>type test.bas
PRINT " this is a test"
INPUT a$
PRINT a$
SYSTEM
As you can see here I have named it "test.BAS".
Now I can run the program using the following command line option:
Quote
d:\bin>qbasic /run test
The output will be like this:
Quote
this is
? HELLO
HELLO

d:\bin>
Of course, I had to enter the text "HELLO" and the program at code my response. Now, using the editor I will make a small program that I just CALL "inpu" and save it. The content is as follows:
Quote
d:\bin>type inpu
thisis inpu

d:\bin>
Now I am ready to test the redirection feature of the, actually the command line in Windows XP, as follows:
Quote
d:\bin>qbasic /run test <inpu
this is a test
? thisis inpu
thisis inpu

d:\bin>
Works like a happy puppy!

Hope this is of some help to you.
Please note this is QBasic, not the compiler.




3279.

Solve : Setting a variable qual to two other variables?

Answer»

I am trying via a DOS window (XP) to set a third variable equal to two other variables.

example:

Code: [Select]set VAR1=12345
set var2=67890
set VAR3=%var1%%var2%(...and this is where I am having trouble)
ECHO %var3%

results - 1234567890

any clue?

Nevermind! I GOT itwhat do you mean after all?He was asking a question, but then SOLVED it

3280.

Solve : Record size?

Answer» HELLO FOLKS,

In a document about cp/m operating system, it says that
information was saved on the MEDIA in RECORDS of 128 bytes,
and the sector size was 128 bytes as well. In present time,
the sector size is 512 bytes:

What is the correct definition for "record" and "record size"?

Thank you

ziloo
3281.

Solve : Batch - How to Read text file variables in a loop?

Answer»

What he's doing is pure trollery. Needs banning.
Quote from: Salmon Trout on November 14, 2009, 09:00:02 AM

ABC.txt with 1500 lines (XP SP3, 3. 0 GHZ P4 Prescott, Seagate Free Agent 320GB usb external HDD)

Code: [Select]S:\Test>(
More? echo %date% %time%
More? ltime3.bat
More? echo %date% %time%
More? )
14/11/2009 15:57:24.06
14/11/2009 15:57:32.41
if you see my gawk code, its makes use of associative arrays. every time the same entry is encountered, the key is "overwritten" and CURRENT value is stored. At the end of file iteration, all it has is just latest entry of each computer name. I think batch can "simulate" this kind of behaviour using delayed expansion. Just feel that its nicer to go through memory than file i/o.Quote from: Salmon Trout on November 14, 2009, 09:05:12 AM
What he's doing is pure trollery. Needs banning.


No, the fishman is the fake and Troll.

And now Casper is using vulgar language.

Again no one reading this thread knows what Salmon Trout is talking about.

Yogesh123, the original poster, wrote:

"How does it works exactly?
what is *.pqr & 'type %%B' & %%~nB"The original post seems pretty clear that it indeed the last time entry for each machine name that they wanted It is in bold.

Of course we could simply print out the very same thing being used as input and call it a day, but that's treading awfully close to what a politician might do (which is quite close to nothing).

This is all well and good everybody makes mistakes such as this, or misunderstands posts. But to then turn around, and for the sole reason that one was unable to understand the query, accuse others of having multiple accounts to justify in their mind that they were in fact at a disadvantage is nothing short of childish.


Billrich: your claims that they are the same person are based on a self-deluded fantasy that the provided solution does not meet the request PUT forth by the OP, when, in fact, it does. Additionally, the very portion that you missed in your solution was bold.

And lastly, Yes, I KNOW I provided no solution. But is it not true that no solution is better then a wrong one? At least I admit that I did not post a solution, there is no admittance to the clearly obvious fact that you omitted a few key requirements from your original response. This is no problem, a good number of your solutions, while provided in an unorthodox way do solve the OP's problem and they are content. However one cannot say they are perfect all the time, especially when one tries to cover so many threads; as you've said yourself, you are LEARNING, we all are. It never hurts to concede when somebody is better at something, and I have to say from reading many of his posts (I think it's technically in the tens of thousands now, actually) I am not ashamed to say that his abilities with batch(especially regarding the NT extensions), and I'm sure many other things, is far greater then mine; the same goes for ghostdog and his reportoire of script languages; for me to not concede these truths is not a sign of strength in my abilities but rather a folly in that I cannot see my own weaknesses. When one cannot see their own weaknesses, they do not know whereupon to build strength.

hmm, that got a little weird... anyway, basically, when one finds one solution to be inadequate to the original query, it is not a sign of weakness to say, "hey, I suppose I read wrong or was mistaken", and the same goes for solutions that do work but a better alternative is presented (I believe ghostdog has outscripted me on one or two threads , there is no reason the defend a inferior solution unless it has distinct advantages that are applicable to the Original Posters question.

curses, why must my posts be so long...

and lastly, the original posters follow-up question was answered.Quote from: gh0std0g74 on November 14, 2009, 09:06:58 AM
if you see my gawk code, its makes use of associative arrays. every time the same entry is encountered, the key is "overwritten" and current value is stored. At the end of file iteration, all it has is just latest entry of each computer name. I think batch can "simulate" this kind of behaviour using delayed expansion. Just feel that its nicer to go through memory than file i/o.

I agree; my code is, I freely admit, nothing more or less than a quick hack. Personally, I would rather tackle the requirement using VBscript. Quote from: BC_Programmer on November 14, 2009, 09:25:39 AM
When one cannot see their own weaknesses, they do not know whereupon to build strength.

That is an extremely true and profound remark. Further, a person who is (obviously!) painfully aware of their own weaknesses, but out of pig-headedness and vanity refuses to see or address them is in an even more pitiful position.Quote from: billrich on November 14, 2009, 09:12:37 AM
Again no one reading this thread knows what Salmon Trout is taking about.
i do. Got it! I knew there must be a way that does not involve files. You have environment space to play with. Remembered about the 'am' & 'pm' part of the time as well. (Why won't people use the 24 hour clock like we do here in Europe? makes things so much simpler.)

Code: [Select]@echo off
for /f "tokens=1,2,3 delims= " %%A in (ABC.txt) do call set lastentry_%%A=%%B_%%C
for /f "tokens=1,2,3,4 delims=_=" %%A in ('set ^| find "lastentry"') do echo %%B %%C %%D >> logfile.txt

logfile.txt (after 1 run) - note that using append >> operator will MAKE logfile.txt grow each time the batch is run

Code: [Select]WST123 11:27 pm
WST456 03:27 pm
WST567 07:27 pm
WST789 12:27 pmQuote from: Salmon Trout
Got it! I knew there must be a way that does not involve files.
congrats. now how about one that uses delayed expansion. would like to see how it can be used to solve this.
3282.

Solve : XCOPY PLEASE HELP?

Answer»

i'm after a batch file which will copy only those files that have changed today or as a part of this build and deploy them to target servers. if the files to copy are images, globalsources, css etc then then need to copy as normal. If there dlls they need to register them on the target server.... and you think shouting IN CAPITALS is going to make people willing to help?
Hi salmon i didn't intend to shout. I was just concerned if my post would miss a notice from other viewers or people who want to help. anyways have u got any idea how i can ACHIEVE this?

regards
Shouting in titles is a breach of forum etiquette and is COUNTERPRODUCTIVE; it says "Hey! my problem is more important than all the others!" and that puts peoples backs up. Also your whole tone is "Hey, you! Do my work for me!". Still, you may get some replies.
Sorry Salmon
I'll make sure the forum rules are followed to the maximum. Can u please help me with the scripts as i'm a newbie and quite struck with how to resolve this

regards
Quote from: captedgar on November 14, 2009, 05:23:40 PM

i'm after a batch file which will copy only those files that have changed today or as a part of this build and deploy them to target servers. if the files to copy are images, globalsources, css etc then then need to copy as normal. If there dlls they need to register them on the target server.


C:\>XCOPY /?
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
[/EXCLUDE:file1[+file2][+file3]...]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set,
doesn't change the attribute.
/M Copies only files with the archive attribute set,
turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date.
If no date is GIVEN, copies only those files whose
source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. Each string
should be in a separate line in the files. When any of the
strings match any part of the absolute path of the file to be
copied, that file will be excluded from being copied. For
example, specifying a string like \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/G Allows the copying of encrypted files to destination that does
not support encryption.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/N Copies using the generated short names.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

C:\>
3283.

Solve : Converting Batch (sub exe)?

Answer»

I was having a little trouble with a batch file after I converted (notice how I did not compile it) it to an exe. When I TRY to run getpassword.exe (in the script I just put Code: [Select]getpassword) but when I convert it, once it reaches that stage, it crashes. Any help?
don't convert it?

it probably crashes because the stub EXE is re-writing your batch file into your TEMP folder- and when it runs the batch it changes the directory to the TEMP folder. your "getpassword" program isn't there.

just a guess, though.Quote from: BC_Programmer on May 02, 2009, 08:27:25 PM

don't convert it?

it probably crashes because the stub EXE is re-writing your batch file into your TEMP folder- and when it runs the batch it changes the directory to the TEMP folder. your "getpassword" program isn't there.

just a guess, though.
Ohh...I see...so if I change it to "C:\Documents and Settings\User\Desktop\getpassword.exe" it should work?

Although it doesn't give a file not FOUND error or a not-command error, it just crashes.Batch converters cannot use all the features of cmd, sometimes they "just crash" and the problem is that the AUTHORS don't always tell you what to avoid. This is another reason why they are a bad idea.
Quote from: Dias de verano on May 03, 2009, 12:44:09 AM
Batch converters cannot use all the features of cmd, sometimes they "just crash" and the problem is that the authors don't always tell you what to avoid. This is another reason why they are a bad idea.

Could I START getpassword, and pause the script, and continue on with the script when the user presses a BUTTON?
3284.

Solve : Copy Specific Folders - Please Help newbie here?

Answer»

Hi there
We use CVS called Accurev and everytime there are changes made to code, we build and deploy those changes using perforce and nant.
what i'm after is to copy only specific files that have changed in this build and deploy them to a target server
is there a batch files that can do this please.
I have started with xcopy and looking into robocop but not much help though.

So to summarise, i'm after a batch file which will copy only those files that have changed today or as a part of this build and deploy them to target servers. if the files to copy are images, globalsources, css etc then then need to copy as normal. If there dlls they need to register them on the target server.
C:\>xcopy /?
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
[/EXCLUDE:file1[+file2][+file3]...]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set,
doesn't change the attribute.
/M Copies only files with the archive attribute set,
turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. Each string
should be in a separate line in the files. When any of the
strings match any part of the absolute path of the file to be
copied, that file will be excluded from being copied. For
example, specifying a string LIKE \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not DISPLAY file names while copying.
/F Displays FULL source and destination file names while copying.
/L Displays files that would be copied.
/G Allows the copying of encrypted files to destination that does
not support encryption.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/N Copies using the generated short names.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).
/Y SUPPRESSES prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

C:\>

3285.

Solve : FINDING MY DELETED EMAILS ON DOS?

Answer»

I have Windows Vista and I know how to find DOS. I have deleted some emails that I need to restore. I have misplaced my DOS for Dummies book and need to know how to find my GMAIL, live & yahoo emails . I found all the directories that windows has and there was no google, yahoo, gmail or MSM files. Where are they and how do I find them? I used the type and then either the directory or file name and had no luck finding the email files.Quote from: codan7 on May 02, 2009, 07:59:29 PM

I have Windows Vista and I know how to find DOS. I have deleted some emails that I need to restore. I have misplaced my DOS for Dummies book and need to know how to find my gmail, live & yahoo emails . I found all the directories that windows has and there was no google, yahoo, gmail or MSM files. Where are they and how do I find them? I used the type and then either the directory or file name and had no luck finding the email files.
Email? As in you had emails and you deleted them? You can't get them back...at least not with Dos (or what you think is DOS)...Gmail & Yahoo & MSM are hosted on web sites, the emails are not on your computer anyway.
I wonder if he means MS DOS, or Command Prompt.

Either way, it doesn't matter at all. Correction-I meant to say command prompt. The only PC I have that can access DOS is the OLDER one.If I'm not mistaken, emails on Yahoo, MSN, Gmail and the like are stored not on your computer but on their server. If you delete them, there's no way to retrieve them unless somehow you hack into the server and hope that they have some method of making backups...? That's all I can think, and I wouldn't have the foggiest where to begin.

If you had a program like Outlook or Thunderbird, that might be a different story, since at which point the emails ARE being saved to your computer. However, retrieving them after they've been deleted still poses a problem.. it comes down to being able to retrieve any file after you've deleted it, and whilst that does become the new problem, I still haven't the foggiest on how to solve it, with or without a .bat file. The most I can say WOULD be to take it to a technician.. but I don't know how deleted data is able to be retrieved. That's something I've YET to look up.
3286.

Solve : Close programs with a batch file?

Answer»

Quote from: Esgrimidor on May 03, 2009, 06:28:50 AM

(y el otro pantallazo. Es que los dos no me cabían por imperativo del foro. )
Gracias de nuevo.


Sorry, what?

I think you are unable to kill the PROCESS because it ran through Startup Delayer.

Try taskkilling yLauncher2.exe before KILLING AgendaMSD.Traduction : and the other screenshot. Both don't goes well because of the size limit) Thank again.

yLauncher2.exe is the process I need to kill agendaMSD

His content :


rem Colocar aquí el cierre preceptivo de residentes
rem RSSBandit,AgendaMSD,Emule,Clamwin,CobianBackup,msgtag,popupwisdom,SyncNotes,Stickies,Shoot,Autohotkey,MemInfo
rem RamIdle,Webshots,TimePanic,Quitometro
taskkill /im /f popupwisdom.exe
taskkill /im AgendaMSD.EXE /f
taskkill /im notepad++.exe /f
M:\Archivos de programa\AutoCAD 2002 Esp\acad.exe
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\mm\Menu Gabinete.doc
"M:\Archivos de programa\Procuno\BTwin\BtWin.exe"
Y:\Ingenieria
Y:\GABINETE\PROYECTOS
M:\Documents and Settings\JOSE\Escritorio\Utilidades Varias\RunGoldmine.bat
taskkill /im AgendaMSD.EXE /f

yLauncher is a freeware for launch several programs, folders, and documents or processes.

If you think is because Startup Delayer I'll revised.

It's not in the processes at the PRESENT moment. I'm using Startup Manager.

Do you think is for Startup Manager ?

Proof :
1. Close Startup Manager
2. repeat the launching with yLaunch2


I made several proofs.

If you are right must be something in the windows register affected even when the startup managers are closed (Startup Delayer or Startup Manager)

I put now a screenshot of my actual msconfig.exe



[attachment deleted by admin]And the second screen shot

As you see many processes now are under control of Startup Manager and don't appear in msconfig.exe

I think I must reiniate to clarify the situation and observ the results.

Then I can try again

See you later I hope . Best regards Carbon Dudeoxide

[attachment deleted by admin]Whoops. I have just realized you have two topics running with a similar question. One wants to close programs, the other wants to open programs.

Now that is just dang confusing.

Can we solve the other topic before doing this one?I reiniated the system.
I forgot another program in proofs : The trial from Chameleon Startup Manager.
This programs accepts perfils and when the system begin offer an additional windows to select : work, general, ocium, etc.....
I PREFER enter with the last selected perfil.

I'm going to disable Chameleon Monitor and startup again.

See you later please.
3287.

Solve : Clean up my backup directory, in DOS?

Answer»

I have a batch file that COPIES all "My Documents" files to a second, backup, hard drive.
It copies only new files and ones that have been updated.
I use XCOPY for this process. ( it really works fast and efficient)

Now I've cleaned out a number of files from my main drive and I'd like to also clean up my backup drive in like manner.

Can I write a batch file to compare the two directories and remove the files from the backup directory that no longer exist in the primary directory?

Dos has changed a lot since I learned it in the early '80's so I would surely like some help here.

Thanks in advance,
The Shadow you can try this vbscript . comment out objFS.DeleteFile(strFilePath) before running it and check if its what you want. then uncomment it for actual removal.Wow!

I'm barely a DOS guy and definitely NOT a vbscript guy, so that's all greek to me.
But I'll seriously try to decipher it and see if I can make it work for me.

I regret that I never learned Visual Basic scripting, but I was really too busy fixing computers, for the past 29 years.

On first glance it looks like it wants to delete files in drive A that already exist in drive B.
That's exactly the opposite of what I want to do.

I want to delete the files from drive B that no longer exist in drive A. (old backup files)
Or more specificly, I want to delete the files on Drive D: , my backup drive, that I've already deleted from Drive C:.

I feel certain that this can be done with a simple batch file but my knowledge of DOS is just too limited for me to write this batch file. Sorry!

The Shadow that can be changed easily by reversing equal sign. Instead of checking for equal, now you check for not equal. anyway, since you want batch, use the if statement with exists to check for files. see if /?I am trying to make a basic batch file to copy files from C to E drive, similar to what TheShadow did. I opened Notepad and used the following:
copy C:\users\walt\documents\excel\(source doc) e:\backups\excel
pause

The error I get is that the system can't FIND the file specified. I checked the properties of the source doc to make sure the path is correct and it appears to be OK. I'm sure I am missing SOMETHING easy and would appreciate any guidance. ThanksQuote from: walt13 on November 15, 2009, 03:36:44 AM

I am trying to make a basic batch file to copy files from C to E drive, similar to what TheShadow did. I opened Notepad and used the following:
copy C:\users\walt\documents\excel\(source doc) e:\backups\excel
pause

The error I get is that the system can't find the file specified. I checked the properties of the source doc to make sure the path is correct and it appears to be OK. I'm sure I am missing something easy and would appreciate any guidance. Thanks


C:\>xcopy /?
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
[/EXCLUDE:file1[+file2][+file3]...]

source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set,
doesn't change the attribute.
/M Copies only files with the archive attribute set,
turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. Each string
should be in a separate line in the files. When any of the
strings match any part of the ABSOLUTE path of the file to be
copied, that file will be excluded from being copied. For
example, specifying a string like \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/G Allows the copying of encrypted files to destination that does
not support encryption.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/N Copies using the generated short names.
/O Copies file OWNERSHIP and ACL information.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

C:\>As it turns out, I had a problem with a "long file" name. After I changed it to "on*.xls" it recognized it fine. Thanks for the xcopy info - I'll do some experimenting with it.
3288.

Solve : IF THEN statement in a Batch file?

Answer»

So I am looking for some help. I need to do an IF THEN in a batch file. I currently have the below script removing some printers and installing others. But I would like to add an IF THEN so that if the new printer is installed, the bat file ends.

Any ideas?

Quote

@echo off
REM Date: 01/29/2009
REM Created By: John Wilganowski
REM Comments:
REM
REM The EXAMPLE removes
REM the calpine MACHINE that was
REM connected to hou-02svr and
REM connect the calpine on hou-17svr.
REM It uses the PRNMNGR.vbs that comes with windows
REM It will use the local copy of PRNMGR.vbs

REM EXAMPLE BELOW:

REM Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-CalPine-PCL"
REM Cscript %windir%\system32\prnmngr.vbs -ac -p "\\hou-17svr\HOU-Calpine-PS"
REM exit




Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-WhiteHouse-PCL"
Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-WhiteHouse-PS"
Cscript %windir%\system32\prnmngr.vbs -ac -p "\\hou-02svr\HOU-Parthenon"

Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-Pentagon-PCL"
Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-Pentagon-PS"
Cscript %windir%\system32\prnmngr.vbs -ac -p "\\hou-02svr\HOU-Menil"
exit
Could you explain a bit more clearly what you want?

That isn't really a batch file, it's more a LIST of CALLS to the prnmngr VBS script.

Did you mean "if the new printer is already installed"? Please explain what you're doing and why and what you want to do and why.

He wants to have an IF statement that goes off when a new printer is added..

This doesn't seem possible unless you try printing a test page in a FOR loop and use ERRORLEVEL to indicate that the file couldn't be printed, thus saying that no new printer was installed, this would only work if he didn't already have a printer connected.See Comments in Red


Quote
@echo off
REM Date: 01/29/2009
REM Created By: John Wilganowski
REM Comments:
REM
REM The Example removes
REM the calpine machine that was
REM connected to hou-02svr and
REM connect the calpine on hou-17svr.
REM It uses the PRNMNGR.vbs that comes with windows
REM It will use the local copy of PRNMGR.vbs

REM EXAMPLE BELOW:

REM Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-CalPine-PCL"
REM Cscript %windir%\system32\prnmngr.vbs -ac -p "\\hou-17svr\HOU-Calpine-PS"
REM exit



IF \\HOU-02SVR\HOU-Parthenon EXISIT
THEN GOTO STOP
ELSE



Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-WhiteHouse-PCL"
Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-WhiteHouse-PS"
Cscript %windir%\system32\prnmngr.vbs -ac -p "\\hou-02svr\HOU-Parthenon"

Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-Pentagon-PCL"
Cscript %windir%\system32\Prnmngr.vbs -d -p "\\hou-02svr\HOU-Pentagon-PS"
Cscript %windir%\system32\prnmngr.vbs -ac -p "\\hou-02svr\HOU-Menil"
exit



:STOP
EXIT

Quote from: Woogi on April 14, 2009, 03:52:33 PM
See Comments in Red


Wrong syntax. IF EXIST \\HOU-02SVR\HOU-Parthenon GOTO STOP

That's PROBABLY why...Quote from: Helpmeh on April 14, 2009, 04:45:56 PM
Wrong syntax. IF EXIST \\HOU-02SVR\HOU-Parthenon GOTO STOP

That's probably why...

Well I am not saying that would even work, but that is the just what I am trying to do. I am trying to have the batch file check to see if a network printer is already installed, and if it is, quit the script, but if it isn't, then continue.Quote from: Woogi on April 14, 2009, 08:03:57 PM
Well I am not saying that would even work, but that is the just what I am trying to do. I am trying to have the batch file check to see if a network printer is already installed, and if it is, quit the script, but if it isn't, then continue.
Well, I just glanced over it, and that's what I saw.Woogi, you could use a vbs to enumerate the printers on a particular server and do something based on whether or not the printer you are asking about is in the list.

Quote from: Dias de verano on April 15, 2009, 12:16:06 AM
Woogi, you could use a vbs to enumerate the printers on a particular server and do something based on whether or not the printer you are asking about is in the list.



Yeah not that good with VBQuote from: Woogi on April 15, 2009, 07:40:03 AM
Yeah not that good with VB

But you are running admin scripts?

Quote from: Dias de verano on April 15, 2009, 10:12:35 AM
But you are running admin scripts?



And how do the two correlate?Code: [Select]cscript//nologo prnmngr.vbs -l | find/i "\\hou-02svr\HOU-Menil" || (
Cscript %windir%\system32\prnmngr.vbs -ac -p "\\hou-02svr\HOU-Menil"
)untested

however code will run faster in full vbscript.Quote from: Woogi on April 17, 2009, 07:49:21 AM
And how do the two correlate?

You are like a person paid as a truck driver who does not know how to operate the gears or clutch.Quote from: Dias de verano on April 17, 2009, 09:26:49 AM
You are like a person paid as a truck driver who does not know how to operate the gears or clutch.

No, I am like a truck driver who cant build a transmission. Ons inability to do one, does not prevent him from doing the other.Quote from: Reno on April 17, 2009, 09:19:20 AM
Code: [Select]cscript//nologo prnmngr.vbs -l | find/i "\\hou-02svr\HOU-Menil" || (
Cscript %windir%\system32\prnmngr.vbs -ac -p "\\hou-02svr\HOU-Menil"
)untested

however code will run faster in full vbscript.

Thank you for your help, I will try this out.
3289.

Solve : Disable YH! ads?

Answer»

Hi all,
i just register this forum today. I love BAT Script. hope everyone help me to be master in this. Nice to meet all.
My script

:: yahoo version 9
echo. > "C:\Program Files\Yahoo!\Messenger\cache\urls.xml"
convert c: /fs:ntfs
:: to make sure the C driver in NTFS filesystem.
cacls urls.xml /D Everyone /E


:: yahoo version 8

@ECHO OFF
> %TEMP%.\noYMads.reg ECHO REGEDIT4
>>%TEMP%.\noYMads.reg ECHO.
>>%TEMP%.\noYMads.reg ECHO [HKEY_CURRENT_USER\Software\Yahoo\Pager\YUrl]
>>%TEMP%.\noYMads.reg ECHO “Messenger Ad”=”*”
>>%TEMP%.\noYMads.reg ECHO “Webcam Upload Ad”=”*”
>>%TEMP%.\noYMads.reg ECHO “Webcam Viewer Ad”=”*”
>>%TEMP%.\noYMads.reg ECHO “Webcam Viewer Ad Big”=”*”
>>%TEMP%.\noYMads.reg ECHO “Webcam Viewer Ad Medium”=”*”
>>%TEMP%.\noYMads.reg ECHO “Change Room Banner”=”*”
>>%TEMP%.\noYMads.reg ECHO “Conf Adurl”=”*”
>>%TEMP%.\noYMads.reg ECHO “Chat Adurl”=”*”
>>%TEMP%.\noYMads.reg ECHO “Y Content”=”*”
>>%TEMP%.\noYMads.reg ECHO [HKEY_CURRENT_USER\Software\Yahoo\Pager\Locale]
>>%TEMP%.\noYMads.reg ECHO “Enable Messenger Ad”=”0?
REGEDIT /S %TEMP%.\noYMads.reg
DEL %TEMP%.\noYMads.reg
ATTRIB -R “%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml”
ECHO “” >”%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml”
ATTRIB +R “%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml”
[/tt] I don't suggest anybody runs this script. For a start if your C:\ drive is FAT it will merrily convert it to NTFS, which may not be what you want. Secondly, it makes alterations to the registry which may or may not be a good thing.

Quote

My script

It actually came from here:

http://www.mydigitallife.info/2006/08/04/remove-disable-and-turn-off-yahoo-messenger-ads/



Quote
I don't suggest anybody runs this script

OK. But please explain what does he want to do with this?
Curious minds need to know. Quote from: Geek-9pm on April 16, 2009, 01:13:47 PM
OK. But please explain what does he want to do with this?
Curious minds need to know.

It does what it says on the can, I expect. But he or she didn't write it, and why it gratuitously converts the C drive to NTFS I don't know.
Let i explain for everyone to understand my script. i just want someone to know my script is safe sorry to ppl already known.
First in Yahoo version 9, all the ads in your Y!M is saved in URLS.xml file in "C:\Program Files\Yahoo!\Messenger\cache\urls.xml". So the command
echo. > "C:\Program Files\Yahoo!\Messenger\cache\urls.xml"
change the urls.xml file to empty. But i don't know how to set the file to be "NULL", so i choose echo.
convert c: /fs:ntfs
As i SAID yesterday this command to make sure the C driver in NTFS filesystem. convert from FAT to NTFS will not harm your data (it will if you change back). If you still scare losting data, ok just remove it here. If your filesystem is FAT, you can not run the next command because no security, i mean the permission of file. and if your partition already is NTFS, the result of this comand just return a sentence like : your filesystem is already NTFS.
cacls urls.xml /D Everyone /E
This command is the most important to disable Y!M ads. The urls.xml is store in ....yahoo\messenger\cache\ , Y!M can automatic download new ads from the server and save into urls.xml. So my solution here is deny YM! permission to change the file.

In version 8
@ECHO OFF
> %TEMP%.\noYMads.reg ECHO REGEDIT4
>>%TEMP%.\noYMads.reg ECHO.
>>%TEMP%.\noYMads.reg ECHO [HKEY_CURRENT_USER\Software\Yahoo\Pager\YUrl]
>>%TEMP%.\noYMads.reg ECHO “Messenger Ad”=”*”
>>%TEMP%.\noYMads.reg ECHO “Webcam Upload Ad”=”*”
>>%TEMP%.\noYMads.reg ECHO “Webcam Viewer Ad”=”*”
>>%TEMP%.\noYMads.reg ECHO “Webcam Viewer Ad Big”=”*”
>>%TEMP%.\noYMads.reg ECHO “Webcam Viewer Ad Medium”=”*”
>>%TEMP%.\noYMads.reg ECHO “Change Room Banner”=”*”
>>%TEMP%.\noYMads.reg ECHO “Conf Adurl”=”*”
>>%TEMP%.\noYMads.reg ECHO “Chat Adurl”=”*”
>>%TEMP%.\noYMads.reg ECHO “Y Content”=”*”
>>%TEMP%.\noYMads.reg ECHO [HKEY_CURRENT_USER\Software\Yahoo\Pager\Locale]
>>%TEMP%.\noYMads.reg ECHO “Enable Messenger Ad”=”0?
I CREATE a file in your temp folder. The file name is noYMads.reg:
REGEDIT4

[HKEY_CURRENT_USER\Software\Yahoo\Pager\YUrl]
“Messenger Ad”=”*”
“Webcam Upload Ad”=”*”
“Webcam Viewer Ad”=”*”
“Webcam Viewer Ad Big”=”*”
“Webcam Viewer Ad Medium”=”*”
“Change Room Banner”=”*”
“Conf Adurl”=”*”
“Chat Adurl”=”*”
“Y Content”=”*”
[HKEY_CURRENT_USER\Software\Yahoo\Pager\Locale]
“Enable Messenger Ad”=”0?

REGEDIT /S %TEMP%.\noYMads.reg
run the REG to change the key in register.
DEL %TEMP%.\noYMads.reg
After that delete the file in temp folder
ATTRIB -R “%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml”
ECHO “” >”%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml”
ATTRIB +R “%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml”
Once again, change urls.xml data and set permission.
My BAT file work same as the link "Dias de verano" give
http://www.mydigitallife.info/2006/08/04/remove-disable-and-turn-off-yahoo-messenger-ads/
This is not all my work, I just research on internet how to disable ads in Y!M and try to make a BAT file to automatic do it.
Sorry for my bad English.
Regards,
Mr.Ton.I noticed that there is some stuff in there that messes with your registry. If you are not 100% sure what you are doing I would suggest you do not do anything that changes the registry.

It all sounds like a lot of trouble to go thru just to disable the ads in Yahoo messager seem ppl here have little knowledge about regedit and dont know how to backup register....Quote from: tonlo on April 17, 2009, 06:52:43 AM
seem ppl here have little knowledge about regedit and dont know how to backup register....

You're missing the point entirely. Most members here will know how to backup, and even tamper with the registry. But, PEOPLE who are new to computers don't.Quote from: tonlo on April 15, 2009, 10:54:26 PM

cacls urls.xml /D Everyone /E


Forgive me if I'm wrong but deny permissions take priority over allow and given that you are denying all permissions here won't that mean that no-one [even you] will be able to edit / delete the file. So if you later decide to uninstall Y! Messenger for whatever reason you won't be able to delete this file.

Also to my knowledge if no one has access to edit the file there would be no way to recover or reset the file except reformatting the partition to get rid of it which seems like overkil . . . .

Quote from: Amadeus2k8 on April 17, 2009, 02:50:27 PM
Forgive me if I'm wrong but deny permissions take priority over allow and given that you are denying all permissions here won't that mean that no-one [even you] will be able to edit / delete the file. So if you later decide to uninstall Y! Messenger for whatever reason you won't be able to delete this file.

Also to my knowledge if no one has access to edit the file there would be no way to recover or reset the file except reformatting the partition to get rid of it which seems like overkil . . . .


Hi Amadeu2k8, yes with deny all permissions no one can access or delete the file. I am agreed in this point. But it doesn't mean noway to recover the permission. If you are the administrator of your machine, You can take ownership the file. And i am 95% sure you are in administrator GROUP of your machine. It is automatic add you in admin group when you install M$ OS (event in Linux)
@kpac: yeah, maybe i am wrong. i thought all of people here have wide knowledge in IT , so i thought i could improve more skill in BAT script here. But it is OK, your people here so nice, reply my topic so quickly
3290.

Solve : Deploying .sql via batch file?

Answer»

I have written the first part of this that will take in the list I need run and then execute some command. I plan on using the osql or isql depending on which command my work's environment will allow. However I cannot get any database to test on because I have no error handling in it and am unable to delve into the isql or osql commands to see if they have built in error handling. I need to be able to exit the process if an error occurs (which I'm guessing I could do an ErrorLevel==1 if statement and give an exit command). But I need to know if EITHER isql or osql will print the error to a log (id assume the output portion of the command would allow it, but I need to be able to say with 100% certainty to my supervisor).

ThanksQuote from: Grimbear13 on November 16, 2009, 07:33:42 AM

But I need to know if either isql or osql will print the error to a log (id assume the output portion of the command would allow it, but I need to be able to say with 100% certainty to my supervisor).

Thanks
look at the usage of osql or isql in the documentation for more info. yes, there is option output to file. isqlw.exe has the -o param, this writes out to a LOGFILE the messages that would have been printed if you had run it from query analyser -- -oLogFileName.txt
If you are running multiple commands, APPEND the logfile to a master log as it will be overwritten on each execution of isqlwThank You, is my understanding of how ErrorLevel works correct as well? I have never had to use it as I'm just starting with batching and am teaching myself.Ive just checked on my favourite sql site - www.sqlteam.com - a poster there quotes using errorlevel with ISQLW.exe

testing errorlevel can be odd - it returns 0 for ok, anything else means an error - you would test this with
Code: [Select]if errorlevel 1 goto ErrorHandling
this means if errorlevel is 1 OR MORE process the error, it its 0, then it is ok and CONTINUES to the next line
3291.

Solve : Debug error?

Answer»

Common Language Runtime Debugging Services

I use an application which is not supported by the supplier. I have used the application for the last year with only occasional problems. For no apparent reason I am now getting Debugging issues when attempting to RUN the application. the application is simply an MS Access database.
I am getting the following ,message
Application has GENERATED an exception that could not be handled
Process id=0x1584 (5508), Thread id=0x1b8 (440).
Click OK to terminate the application
Click CANCEL to debug the application
When i try to CANCEL i then get the following message

Registered JIT debugger is not available. An attempt to launcha JIT debugger with the following command resulted in an error code of 0x2 (2). Please check computer settings.
cordbg.exe !a 0x1750

Click on retry to have the process wait attaching a debugger manually.
Click on Cancel to abort the JIT debug request.

I have followed some instructions about debug thro MSDOS but then not sure what action to take against the error list it produces. Every time i try and run the application the actual error "codes" change.
Appreciate any help I can be given.
Thanks
bromerzz
The lack of replies suggests no one knows or its such a simple problem no one can understand why I cant sort it myself.
Seriously anybody got any ideas...maybe even post it on another forum.
ThanksMaybe your coyness about what the app is actually called has resulted in nobody wanting to get involved?Thanks for your reply, the application is an access database for a commercial golf course grading SYSTEM. If that helps.
It is not a commercial product.Quote from: bromerzz on April 10, 2009, 01:22:31 PM

Thanks for your reply, the application is an access database for a commercial golf course grading system. If that helps.
It is not a commercial product.

A quick Google foound this thread, which may or may not be relevant

http://www.pcreview.co.uk/forums/thread-1326003.phpOnce again thanks but no solution as yet.error code 0x2 might be file not found.

assuming it's a error returned from GetLastError().

sounds like a coding bug. One of the files the access database opens is missing.

A friend has suggested this problem may be down to 2 fixes for microsoft.net.framework 3.5 which updated mid Feb 09. That seems to fit the timeframe when the programme I need became unuseable.
Not being sufficiently savvy on the subject, could I remove these fixes? Are they critical updates that will effect the running of other programs.
Thanks for your time.
3292.

Solve : problems with taskkill?

Answer»

ok. first off i wuld lyk to ask for assistance from anyone who can help

what im trying to do is kill EXPLORER.exe and i know how to do it using cmd and am successful at it. But what i WANT to do is kill it using a batch file. here is how i did it.

@echo off
color 0a
title taskkill

taskkill /f /im explorer.exe


then what i did was save it as taskkill.bat

now when i open it up the cmd comes up for a minute then goes away, but the problem is that it DIDNT kill explorer.exe


any help?May I ask why you want to do this?this is because you need explorer.exe to RUN a batch file Why do you want to do this, like Calum says?YEAH I'm trying to do the same thing...i mean i got it to work on my other computer the taskkill explorer thing but the cmd pops up for a sec and goes away...it only worked once...i want to know how to do this
i know a little about batch files like the basics and deleting stuff...but i cant really get down the taskkilll... please can anyone help? TY! We don't help with pranks.

3293.

Solve : how to run commands automatically?

Answer»

TYPE LEDS.DBG return
o 78 00
q

i remove @echo off

so code is
Code: [Select]If "%1"=="" GOTO error

If %1==on goto IsOn
If %1==off goto IsOff
goto error

:IsOn
>leds.dbg Echo o 78 00
goto continue
:IsOff
>leds.dbg Echo o 78 07
goto continue

:continue
>>leds.dbg Echo q

debug32.exe < leds.dbg

goto EOF

:error
echo You must SAY on or off!
:EO
so after remove @echo,i type leds on
it return
C:\>If on=="" goto error
C:\>
C:\>If on==on goto IsOn
C:\>leds.dbg Echo o 78 00
C:\>goto continue
C:\>leds.dbg Echo q
then debug32.exe run and stop for user further input (e.g o 78 00)

I'm not sure what is debug32...serching google some info
The only Debug32.exe I know is the one that came with "Pentium Processor
Optimization Tools" a book by Michael L.Schmit Academic Press
Professional 1995 ISBN 0-12-627230-1


DEBUG23 is a 32-bit debugger included on the disk with this book.
Debug32 is quite similar to DOS's DEBUG, but provides a number of minor
improvements and many advanced features, such as
32-bit register and addressing support
protected-mode debugging
DPMI application support
EMS memory support
i attached the debug32 here

[Saving space, attachment deleted by admin]Debug as you QUOTE SHOWS comes with windows, try replacing debug32.exe with debug.exe to see if that makes a difference.

Thanks for posting debug32, Ill take a look at it

3294.

Solve : For loops and If?

Answer»

I'm not quite sure if this will work, but it works in theory.

Here is what I have:
Code: [Select]:loop
set /p name=Name^:
for /f %%a in ("I\_Common\Unknown_Folder\Names") do (
if %name%==%%a echo Name exists! & pause > nul & goto loop
)
rest of code here
Now, I think this will work, but I got one of those feelings that it doesnt...can someone prove one thought right and the other wrong?Looks good.

Set /p is fine.
And your for loop is looking good.

No Problems that I found.QUOTE from: macdad- on April 16, 2009, 05:23:41 PM

Looks good.

Set /p is fine.
And your for loop is looking good.

No Problems that I found.
Thanks!

But now I have a different problem, I have a list of (possibly over) 30 names (first and last).

The user is supposed to enter their first name and last name. If the first and last names match, then the script continues, but if the first and last name matches NONE of the name combinations(each name combonation has it's own line and it needs to match both) then it displays a message. But if I use if and else, then will it repeat for each line?First how do you have the files in the Names folder laid out.

Like this:
Sam Sample.txt?

Or are all the names in one FILE?
Quote from: macdad- on April 16, 2009, 08:02:36 PM
First how do you have the files in the Names folder laid out.

Like this:
Sam Sample.txt?

Or are all the names in one file?

All the names are in one file. It's called list.txt.alright, here's your code:

Code: [Select]@echo off
cd <location of the list.txt file>
echo First Name?
set /p first=?
echo Last Name?
set /p last=?
findstr /I %first%" "%last% list.txt
pause

You can drop the /I switch, I just added it in there in the case that the name's case was wrong(Like: sAM)

Hope this helps
,Nick(macdad-)Quote from: macdad- on April 18, 2009, 03:35:14 PM
alright, here's your code:

Code: [Select]@echo off
cd <location of the list.txt file>
echo First Name?
set /p first=?
echo Last Name?
set /p last=?
findstr /I %first%" "%last% list.txt
pause

You can drop the /I switch, I just added it in there in the case that the name's case was wrong(Like: sAM)

Hope this helps
,Nick(macdad-)
Ok...It doesn't SEEM to work...It just keeps on asking for the first and last names...But I think I could do this with 2 for loops...I'll post the answer if I get it.

My code is, and I think it should work...but it's not not accepting wrong names...

Code: [Select]@echo off
set num=0
set num2=0
set fname=list.txt
:loop
cls
set /p first=First name^:
set /p second=Second name^:
for /f "delims= " %%a in ("%fname%") do set /a num+=1
for /f "tokens=1-2 delims= " %%b in ("%fname%") do (
if /i "%first%"=="%%b" if "%second%"=="%%c" goto correct
set /a num2+=1
if %num%==%num2% echo Your name is not REGISTERED^!& pause > nul & goto loop
pause
)
:correct
echo Your name is registered, please continue.
pauseDid you replace:
Code: [Select]<location of the list.txt file>
with the actual location of the file?Quote from: macdad- on April 18, 2009, 04:35:44 PM
Did you replace:
Code: [Select]<location of the list.txt file>
with the actual location of the file?
They're both in the same directory, so I just REMOVED the CD part.
3295.

Solve : The DOS "AT" command does not work?

Answer»

I USE XP HomeSP3 with 256M Ram and 1Gig free space on the HDD. I have all MS updates automatically. I use CA antivirus and windows firewall.

The XP Scheduler works perfectly. Start, All Programs, Accessories, System Tools and click Scheduled Tasks. We can also reach Scheduled Tasks through the Control Panel.

But when I attempt to schedule a task with the Dos "AT" command, it appears to WORK and then fails to return any output or error messages. When the batch file runs from the command prompt it works but does not work from the AT command. For example:

C:\>type test06.bat
@echo off
Code: [Select]dir /b | find ".bat" /c >> test07.txt
rem dir /b | find ".bat"C:\>type test07.txt

C:\>dir /b | find ".bat" /c >> test07.txt
C:\>type test07.txt
60
C:\>

C:\>at 12:22pm test06.bat
Added a new JOB with job ID = 1
C:\>at
Status ID Day TIME Command Line
-------------------------------------------------------------------------------
1 Today 12:22 PM test06.bat
C:\>type test07.txt

C:\>time
The current time is: 12:20:37.94
Enter the new time:
C:\>time
The current time is: 12:23:17.73
Enter the new time:
C:\>type test07.txt

C:\>
1. Review these notes

2. Take the steps recommended

3. Report results

http://support.microsoft.com/kb/308558

Dias de VERANO,

The AT command works now.

Quote from: billrich on April 18, 2009, 03:06:17 PM

Dias de verano,

The AT command works now.



3296.

Solve : problem with dos?

Answer»

hello all u smart computer people... i have never USED a forum before but i am a retard and i need help with a computer problem so i FIGURED id ask the experts...

this is the problem...
i am running windows 98.... some how i restarted my computer in dos mode. and cant get back to windows. please help.. and for those u who do help please explain it ..as if ur speaking to someone who regularly rides the short bus.

thankyou

crystalAt the DOS mode C: prompt type CD\Windows and hit Enter...
At the C:\Windows prompt type win and hit Enter.thanks a bunch .... short bus signing out. EXIT Quits the CMD.EXE program (command interpreter).
EXIT Quits the command.com program (command interpreter).Quote from: billrich on MAY 02, 2009, 03:49:05 PM

EXIT Quits the CMD.EXE program (command interpreter).
She is in MS-DOS mode...not CMD.EXE. You might have read 6TH line if you read the post. CMD.EXE and MS-DOS are different things.Helpmeh wrote:
Quote
"You might have read 6th line if you read the post. CMD.EXE and MS-DOS are different things."

And if Helpmeh would have read the the last line, Helpmeh would know the poster is a lady.

Quote
Thank You

Crystal
Quote from: billrich on May 02, 2009, 08:14:09 PM
Helpmeh wrote:
And if Helpmeh would have read the the last line, Helpmeh would know the poster is a lady.

That was a typeo. I will edit that...
3297.

Solve : USE DROP CAP in command prompt?

Answer»

How to display the text as drop cap in command prompt

Example

I want to display the text as Sri Software in command line

S is common to both Sri and Software.

so i want to display Single S for both Sri and Software

How? in command prompt ----> how i USE drop cap in command line



Drop cap is possible in the command prompt, but i forgot -- please help to do this in command promptWhat exactly do you mean by drop cap ?

In the command prompt, you pretty much get what you see - with few FONT selections availableLike remove all capitals in the input?

You could create 26 lines of this (changing it as NEEDED).

Set variable=%variable:A=a%Example

I want to display the text as Sri Software in command line

S is common to both Sri and Software.

so i want to display Single S for both Sri and Software

How? in command prompt ----> how i use drop cap in command line--If I said that you cant, it wouldnt help -- you could try special line drawing characters to make up the S
Code: [SELECT]┌──
└─┐ ri
──┘ oftware
I understand what a drop cap is. You cannot do this using the fonts available in the command window.



However you can do something fairly crude like this in a batch file

Code: [Select]echo.
echo ######
echo # #
echo # ri
echo ######
echo # oftware
echo # #
echo ######
echo.

or this

Code: [Select]echo.
echo
echo @ @
echo @ ri
echo
echo @ oftware
echo @ @
echo
echo.

If you have a text EDITOR with search/replace it is easy to try different characters like x, * @, # or whatever you want. it will be a lot easier (!) to visualise the final result if you set the editor to use monospaced fonts such as Courier New or Lucida Console.

3298.

Solve : copy file from server to new server location?

Answer»

I have a file called mtcdata.csv located on \\server01\arthur\mtcdata.csv

I need to copy this file to \\serverweb\file\data\mtcdata.csv

then I want to set a scheduled task to copy the file every NIGHT at midnight to the new location.

I am guessing I need to map drives copy the file then remove the drive mapping??

Help please.

Thanks,
TinaYes... Drives will have to be mapped & permissions set to allow for writing to the destination which is more secure than creating a batch that CREATES the maps and DISPLAYS the credentials in a NET USE fashion.

If you create the maps in Windows or Windows Server environment and write a batch that will perform the copy from say Drive Map Y: to Z: and then add this batch into a windows scheduled task, you should then be all set.

Other issues you can run into without use of maps is UNC CALL issues.

IF the server01 was Y: and serverweb was Z: with map directly to roots of the pickup and drop location ( FULL path ) a batch like below would work best.

Code: [Select]XCOPY Y:\mtcdata.csv Z:\*.* /s/d/y
Whereas the mtscdata.csv file would be overwritten if the next execution of this batch held a newer date/time stamped mtcdata.csv file. If the date/time stamp hasnt changed then it will ignore a copy, and if the file does not exist at the destination it will also write the file to Z:\ if the file does not exist at Z:\.

If say you wanted all files and folders at Y:\ copied to Z:\ and updated by scheduled task you can simply change Y:\mtcdata.csv to Y:\*.* for wildcard to grab and backup all to Z:\

3299.

Solve : Delete text files where accessed date is different the created?

Answer»

How to read created, last accessed, and last written DATE/time stamps in a batch file.

Code: [Select]@echo off
setlocal enabledelayedexpansion

set mask=*.*

for /f "delims=" %%F in ('dir /b /a-d %mask%' ) do (

set filename=%%F

for /f "tokens=1-2 delims= " %%A in ('dir /tc !filename! ^| find "!filename!"') do set cstring=%%A %%B
for /f "tokens=1-2 delims= " %%A in ('dir /ta !filename! ^| find "!filename!"') do set astring=%%A %%B
for /f "tokens=1-2 delims= " %%A in ('dir /tw !filename! ^| find "!filename!"') do set wstring=%%A %%B

if "!cstring!" EQU "!wstring!" (set wmatch=YES) else (set wmatch=NO)
if "!cstring!" EQU "!astring!" (set amatch=YES) else (set amatch=NO)

echo File name : !filename!
echo Creation date stamp : !cstring!
echo Last accessed stamp : !astring!
echo Last written stamp : !wstring!
echo Last ACCESS = creation : !amatch!
echo Last written = creation : !wmatch!

echo.

)



good batch effort, but sad to say, it would be inefficient when run for directory with many files. imagine for 1000 files found, it makes calls to "dir" and "find" 1000*3 =3000 times (or is it??) ... And how would you eliminate the filesystem accesses?
Quote from: Dias de VERANO on May 02, 2009, 07:28:04 AM

And how would you eliminate the filesystem accesses?

get all the information you need with only 1 loop. you can take the vbscript i posted as reference. it only loop once and at the same time, you can get creation date, modified date and access date in the same loop. Too bad native batch do not come with tools equivalent to that of , eg stat in *nix. (unless of course, one can find such command line tools for batch..resource kit maybe??) stat.exe is in the GNU Core Utils

Code: [Select]S:\>stat test1.txt
File: `test1.txt'
Size: 70 Blocks: 8 IO Block: 4096 regular file
Device: 2c51aa7fh/743549567d Inode: 2251799813704926 Links: 1
Access: (0666/-rw-rw-rw-) Uid: ( 0/ Mike) Gid: ( 0/ UNKNOWN)
Access: 2009-05-02 15:41:27.942125000 +0100
Modify: 2009-05-02 12:35:08.723375000 +0100
Change: 2009-05-02 12:25:10.348375000 +0100
Code: [Select]S:\>stat --help
Usage: stat [OPTION] FILE...
Display file or file system status.

-f, --file-system display file system status instead of file status
-c --format=FORMAT use the specified FORMAT instead of the default
-L, --dereference follow links
-t, --terse print the information in terse FORM
--help display this help and exit
--version output version information and exit

The valid format sequences for files (WITHOUT --file-system):

%A Access rights in human readable form
%a Access rights in octal
%B The size in bytes of each block reported by `%b'
%b Number of blocks allocated (see %B)
%D Device number in hex
%d Device number in decimal
%F File type
%f Raw mode in hex
%G Group name of owner
%g Group ID of owner
%h Number of hard links
%i Inode number
%N Quoted File name with dereference if symbolic link
%n File name
%o IO block size
%s Total size, in bytes
%T Minor device type in hex
%t Major device type in hex
%U User name of owner
%u User ID of owner
%X Time of last access as seconds since Epoch
%x Time of last access
%Y Time of last modification as seconds since Epoch
%y Time of last modification
%Z Time of last change as seconds since Epoch
%z Time of last change

Valid format sequences for file systems:

%a Free blocks available to non-superuser
%b Total data blocks in file system
%c Total file nodes in file system
%d Free file nodes in file system
%f Free blocks in file system
%i File System id in hex
%l Maximum length of filenames
%n File name
%s Optimal transfer block size
%T Type in human readable form
%t Type in hex

Report bugs to <[emailprotected]>.

Of course, as we have seen, the "last access" stamp in NTFS is pretty useless, and is disabled on many systems.
3300.

Solve : logging bat file?

Answer»

hi
at the moment my computer has been having alot of problems and i SUSPECT that sombody is using the computer without me knowing so if any one knows how to make alogging bach file PLZ post it

and if you can can it make a file with what time what date logged on and what time logged off plz because ive had to wipe the computer 3 times in the past 4 days and if you can can you make it so it logges what programes that they open plz thanks (sorry i know its alot but this is getting rediculus with my computer)Code: [SELECT]@echo off
cd "%userprofile%\My Documents\"
echo Logged In>> Log.txt
echo %userprofile% >> Log.txt
echo %Date% %time% >> Log.txt
echo _________>> Log.txtThis will only log when they log on and it will STORE a .txt documents in your documents. You need to make this program run on logon.What MAKES you think some one is using your comp?you should just use the event logs. Quote from: mroilfield on April 19, 2009, 06:00:41 AM

What makes you think some one is using your comp?
I think he said why.Quote from: gh0std0g74 on April 19, 2009, 06:04:10 AM
you should just use the event logs.
This would work fine also.