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.

6301.

Solve : need help!!!!! guys?

Answer»

net command doesnt WORK in my dos prompt.
error its displaying:'net' is not recognized as an INTERNAL or EXTERNAL command.
windows xp works on my computerWelcome to the CH forums.

Net.exe is an external command and Net.exe should reside in your C:\Windows\System32 folder. Check that the folder contains Net.exe and confirm your Path environment variable is setup correctly.

Good luckthanks man,got that clearedThanks for COMING back at us to report your success even after a bit of a delay.

Good luck

6302.

Solve : Using .bat to tranfer data to MS Access (.mdb)?

Answer»

Hi GUYS!!!

I am a newbie here. I just want to make friends and need some help about my nightmares.
Here is my problem.

I use a batch file to transfer my DATA from a barcode device to a MS Access.
But Unfortunately, I got stuck in how to transfer the data to MS Access.

This is what I made.

Echo off
C:\BARCODE\test1.mdb %1 %2 %3 %4

For other details on the MS Access side.

File Name: test.mdb
Table Name: data
Fields: field1,field2,field3,field4

I really need your advice on this situation.

Thanks and I really appreciate any advice regarding this problem.

pralphsave ur data into a .csv file and then do this command then it will open the wizard for u

start MSACCESS.EXE c:\filename.csv

u can save ur data in to a csv file simply by doing this

echo %first_feald_name%,%secound_feald_name%,%thrd_feald_name% >c:\filename.csv
echo %feald1_data%,%feald2_data%,%feald3_data%>>c:\filename.csv
echo %feald1_data%,%feald2_data%,%feald3_data%>>c:\filename.csv
echo %feald1_data%,%feald2_data%,%feald3_data%>>c:\filename.csv

infact i am not fameliar with msaccess put in oracle u can us the sql loader to load data into ur database , u should search if access got the import facility

i hope its usfu :)l


Hi .bat_man,

Thanks for your advice....You really saved my skin.

I will try to execute the command that you gave me. And if it works,lets have some beer!

Thanks, I hope to HEAR from you one day again.

pralphwelcom and i hope it works after u make ur csv file, create a macro in access to transfer the file from the csv to the access table. the action command in access is transfertext. Also add an action of Quit with an exit option, Then in ur bat file start access and call the macro. This is done by

"C:\Program Files\Microsoft Office\Office11\msaccess.exe" "\your database.mdb" /x yourMacroname

This STARTS access and opens ur database. it will run the maco you passed which will transfer the data in the csv file to the table u specify in the transfer text commandCayuga Bob,

Thanks for the advice....I really appreciate your ideas that you gave me...It was helpful too.

.bat_man,

It worked!!!...I guess its the same as Oracle...thanks .bat_man...wish could give you some beers!!!


Pralph

6303.

Solve : Copying Issue?

Answer»

when i TRY to run this COMMAND


C:\>copy \\bar-it-hosts\Shared\putty.exe C:\Documents and Settings\All Users\Desktop

The syntax of the command is incorrect.


how do i fix it???hey,

if you want to have spaces in the file or FOLDER path, you have to wrap them around " " otherwise the command promt will SEE them as the END of the command.

Code: [Select]C:\>copy \\bar-it-hosts\Shared\putty.exe "C:\Documents and Settings\All Users\Desktop\putty.exe"

oh, and i added the file name that your copying.


btw, putty rules!!

6304.

Solve : How do I move multiple files of a certain type..???

Answer»

Quote from: gumbaz on March 23, 2008, 09:50:38 PM

how would i code a bat script to search a certain DIRECTORY that has multiple sub-folders & files in it for a specific file type like .JPG and then move all of those found .JPG files to a specific location..??

you can lessen the hassle, if you can download and install findutils for WINDOWS from here..yah, i have beeen thinking about this one myself for a while now, thats why I came here seeking help..
but I have yet to come up with a practical solution i like.

is there anyway instead of DAWNING the file types from an external list-file by using this code
for /F %%i in (typ.txt) do (
for /f "tokens=1,2,3,4,5,6 delims=: " %%F in ('dir /s /b') do (

drawn the file types from another line in the same single bat file like

for /f %%i on (line 5) do (
for /f "tokens=1,2,3,4,5,6 delims=: " %%F in ('dir /s /b') do (

and on line 5 have all the file types listed like so: .jpg, .gif, .bmp, .png, .tiff

im just thinking out loud here im not really too sure on that one,
what about this would something like that work..??

Code: [Select]@echo off
SET FILE-TYPE=JPG
:TOP
set targetfolder=C:\PIX
MD %targetfolder%
CD /D C:\
setlocal enabledelayedexpansion
set /a num=1
for /f "delims==" %%F in ('dir /s /b *.%FILE-TYPE%') do (
set pad=
if !num! LEQ 99999 set pad=0!pad!
if !num! LEQ 9999 set pad=0!pad!
if !num! LEQ 999 set pad=0!pad!
if !num! LEQ 99 set pad=0!pad!
if !num! LEQ 9 set pad=0!pad!
copy "%%F" "%targetfolder%\!pad!!num!.%FILE-TYPE%"
del "%%F"
echo copied %%F to !pad!!num!.%FILE-TYPE%
set /a num=!num!+1
)

IF "%FILE-TYPE%"=="JPG" SET FILE-TYPE=JPEG&& GOTO :TOP
IF "%FILE-TYPE%"=="JPEG" SET FILE-TYPE=GIF&& GOTO :TOP
IF "%FILE-TYPE%"=="GIF" SET FILE-TYPE=BMP&& GOTO :TOP
IF "%FILE-TYPE%"=="BMP" SET FILE-TYPE=PNG&& GOTO :TOP
IF "%FILE-TYPE%"=="PNG" SET FILE-TYPE=TIFF&& GOTO :TOP
EXIT
Code: [Select]@echo off
setlocal enabledelayedexpansion
set targetfolder=PIX
if not exist %targetfolder% MD %targetfolder%
for %%t in (jpeg jpg gif bmp png tiff) do (
set file-type=%%t
echo file type !file-type!
set /a num=1
if exist *.!file-type! (
for /f "delims==" %%F in ('dir /s /b *.!file-type!') do (
set pad=
if !num! LEQ 99999 set pad=0!pad!
if !num! LEQ 9999 set pad=0!pad!
if !num! LEQ 999 set pad=0!pad!
if !num! LEQ 99 set pad=0!pad!
if !num! LEQ 9 set pad=0!pad!
copy "%%F" "%targetfolder%\!pad!!num!.!file-type!"
del "%%F"
copied %%F to !pad!!num!.!file-type!
set /a num=!num!+1
)
)
)
[code][/code]
6305.

Solve : Windows Setup Requires 73??

Answer»

I formatted and partitioned my HD, while installing Windows after/during scan I get this message "Windows Setup Requires 73". It locks up at that point. Anybody ever seen this one?Can't say I have.
But we will need more info in order to help you.
The version of Windows you're installing?
What is this scan you mention?
And tell us more about the computer...
like the specifications.
Where you experiencing any problems since you decided to FORMAT and reinstall?Windows 98 SE, it performs a scan before installing.
It is an older 800Mhz no name, Western Digital 10G HD.
I had XP installed and the 30 day registration period expired so I could not log on to uninstall it. I don't have a valid key code so I was going back to 98 since only my KIDS use this computer. I formatted because this was our old computer and full of junk. But never any problems with the hard drive.You say you have had XP installed.
What did you use to format the hard drive?
What file system did you format the hard drive as? It should be FAT 32 but XP might have formatted it as NTFS.The message is the first part of this one

Windows Setup requires 7340032 bytes available on your C: drive.

It appears when the Windows 98 installer cannot find a suitable (FAT32) formatted partition with a C drive letter.

Could you describe the steps you took when you "formatted" the hard drive? Did you use FDISK and then format in FAT32?

As Deerpark said, you might have done an NTFS format.
I ran fdisk from the A: prompt and I chose FAT32. I will look again to make sure. Could you tell me what the proper steps are when formatting? This was the first time doing it. Thanks Here are the steps I took:
A: fdisk
Do you wish to enable large disk support? Y
Create DOS partition or Logical DOS drive. Enter
Create Primary DOS partition. Enter
Partition Status Type Volume Label Mbytes System Usage
C: 1 A PRI DOS 12425 Unknown 100%After that did you type

Code: [Select]format c:
at the prompt?


At that point it told me the "primary DOS partition has already been created" and I had to escape out of it. WOULD that be at the A: prompt or C: prompt?Exit out of FDisk which will take you to the A: prompt then use Dias' command and hit Enter.
When it FINISHES it will ask for a Volume Label...just hit Enter for none.
You should now be able to install Win98...

6306.

Solve : Drive D: not detected?

Answer»

I just formatted my hard drive and am trying to REINSTALL windows. I have the cd in D: drive, after restart it leads me DIRECTLY to C:, when I type in D: and hit enter it says invalid drive. Are you ABLE to access your computer's BIOS settings? Does the CD drive show up there? You may also need to check the boot order of your devices, to see if the computer is set to boot from the CD drive before it boots from the hard drive...It was the boot order. I RESET 1st to floppy and now D: is available. ThanksI got one right??

::: runs around and pokes Patio, and Broni, and Deerpark, and CALUM, and Admin, and Ivy, jumps up and down, and acts a fool ::: I got one! I got one!

6307.

Solve : Automatic backup at WIN startup?

Answer»

Hi,
How can I automatic at Windows startup:
1. Create DIR D:\Backup\"dir DATE&time"
2. Copy dir C:\cddata\ to dir D:\Backup\"dir date&time"

That is for backup of one folder to ANOTHER Hard disk,
automaticly when WIN STARTS,
and to have lisitng dir backup's by date and time

6308.

Solve : window closer?

Answer»

Hi all,
'i now its a bit a stupid question but the problem is that my knowledge about this stuff is very worse
so i hope you guy's can help me out with this one

Im trying to make a littel ms dos program that opens another program and after a while
(with a timer) closes the program and restarts it..

this is wath i have so far

@echo off
:loop
start Program.lnk
ping -n 10 localhost
taskkill /f /im Program

goto loop



if anyone could help me to make this work i would be fverry thankfull

greetz irradiateif i use this comand, then i open the program and after the s"set" time he opens the program again but the problem is that he doesnt shut down the old one..
so if their is a way to close it before reopen it my problem should be solved.. Welcome to the CH forums.

What is your purpose in doing this?

it's a program that has a limited online time,
so after that time it shoul be restartedyou better try :
CODE: [Select]ping -n 1 -w 1000 1.1.1.1 >nul-w 1000 make one sec pause. -w 2000 2 sec etc.
and :
Code: [Select]start /WAIT Program.lnkdunno about taskkill i havnt used itjust a few tweaks....


Code: [Select]@echo off
:loop
start notepad.exe
ping -n 10 localhost >nul
taskkill /f /im notepad.exe

goto loop

All I've changed is the program (to notepad), the ping line, I've added >nul to stop the output (but can be removed if you don't need it) and the taskkill line needs the full process name. including the .exe

hope it helps.
Either one of the suggested ping command lines will give you a delay. Use the >nul suggestion for either ping line.
The problem is that you do not have your program name entered correctly in the taskkill line.

Quote from: IRRADIATE on April 09, 2008, 04:10:02 PM

Code: [Select]taskkill /f /im Program

It must be EXACTLY what appears in the first column of the tasklist.
Run tasklist to see what the exact name is.
Likely it is program.exe. If so the following code will work.

Code: [Select]taskkill /f /im program.exe

Like blastman's line with notepad.exe:

Quote from: blastman link=topic=54842.msg344095#msg344095
[code
taskkill /f /im notepad.exe
[/code]
Thx alot for al your guy's help, it wroks now so i'm verry thankfull
6309.

Solve : is it possible ???

Answer»

Hello again,

I'd like to know if it is possible to attribuate a DRIVE letter to a CD-ROM FROM a CD-ROMPlease explain more clearly what you mean. Do you mean "Can you write a batch file which you burn on a CD-ROM and when it is run it knows what the drive letter of the CD-ROm drive is?"

Quote from: Dias de verano on MARCH 31, 2008, 01:33:18 PM

Please explain more clearly what you mean. Do you mean "Can you write a batch file which you burn on a CD-ROM and when it is run it knows what the drive letter of the CD-ROm drive is?"

something like that... and then use that letter in other batchs.... like EX.: %cdrom% where cdrom would be "w:\"

then use that letter in other batchs....A batch file always knows its own name, which is contained in the variable %0 (a percent sign and a zero)

You can get the drive letter using %~D0.

It has a colon but you can extract the bare letter as you will see below

here is location.bat

Code: [Select]@ECHO off
set cdrom=%~d0
echo this is my drive %cdrom%

Once that has been run the drive letter and colon are contained in the variable %cdrom% which is visible to the prompt and to other batch files

here is another.bat

Code: [Select]@echo off
echo this batch file can see the variable
echo drive is %cdrom%

Here is what happens when I ran them

Code: [Select]E:\>location.bat
this is my drive E:
E:\>echo %cdrom%
E:

E:\>echo %cdrom:~0,1%
E

E:\>another.bat
this batch file can see the variable
drive is E:

Quote from: Dias de verano on March 31, 2008, 02:29:03 PM
A batch file always knows its own name, which is contained in the variable %0 (a percent sign and a zero)

You can get the drive letter using %~d0.

It has a colon but you can extract the bare letter as you will see below

here is location.bat

Code: [Select]@echo off
set cdrom=%~d0
echo this is my drive %cdrom%

Once that has been run the drive letter and colon are contained in the variable %cdrom% which is visible to the prompt and to other batch files

here is another.bat

Code: [Select]@echo off
echo this batch file can see the variable
echo drive is %cdrom%

Here is what happens when I ran them

Code: [Select]E:\>location.bat
this is my drive E:
E:\>echo %cdrom%
E:

E:\>echo %cdrom:~0,1%
E

E:\>another.bat
this batch file can see the variable
drive is E:



Thanx !!

It does work !! in the other Main I putted %1[path]
6310.

Solve : reading the contents/file list of a ZIP (or compressed) file?

Answer»

Does anyone know of a way to read/return the contents of a zip/compressed file?

(Microsoft WINDOWS XP [Version 5.1.2600])If you have Winzip or WinRAR you can use the command line programs that they include.

But you do not say what you use.


Sorry, Winzip is the program I'm using.look for this file

C:\Program Files\WinZip\WZUNZIP.EXE

copy it to a folder on your PATH such as c:\windows\system32

then you can open a command window in a folder containing a zip file and type

wzunzip -v (zipfilename.zip)


Code: [Select]C:\>wzunzip -v inpbox11.zip
WinZip(R) Command Line Support Add-On Version 1.1 SR-1 (Build 6224)
Copyright (c) WinZip Computing, Inc. 1991-2004 - All Rights Reserved

Zip file: inpbox11.zip

Length Method Size RATIO Date Time CRC-32 Attr Name
------ ------ ----- ----- ---- ---- -------- ---- ----
8 Stored 8 0% 24/02/2008 21:18 922564ae --w- out.txt
100 Stored 100 0% 24/02/2008 21:16 5e05adf7 --w- test1.bat
266 Stored 266 0% 24/02/2008 21:09 0ba27868 --w- demo.bat
197120 Stored 197120 0% 24/02/2008 21:09 be3139cc --w- inputbox.exe
6213 Stored 6213 0% 24/02/2008 21:09 453816f1 --w- inputbox.txt
------ ------ --- -------
203707 203707 0% 5
Quote from: strpdsnk on March 31, 2008, 01:36:45 PM

Does anyone know of a way to read/return the contents of a zip/compressed file?

(Microsoft Windows XP [Version 5.1.2600])

If you are interested in software other than WinZip, as in old DOS software to run from the command line, you might like to have a copy of List .
I liked it back then, and still do. Always have a copy in the path. It is a
'must have' utility program for me.

List can look inside .zip files. If there are text files in there, you can read them too, without you having to unzip them.

List does a lot of other things too.
It is a very nice reader for text files.

It is un-crippled shareware.
You can download it here:
http://www.oregonfast.net/~steen/msdos.htm
There's a lot of text on that page. Look for list91k.zip .

If you decide to try it, and if you get lost somehow, just let me know.

6311.

Solve : Please Help....16 Bit Ms DOS Subsystem problem?

Answer»

Dear Experts,

Kindly REALLY need your help to fix my PROBLEM, every time I turn on my computer, when first windows desktop open, there is a message box as follow:

16 Bit Ms-DOS Subsystem

C:\WINDOWS\system32\logcomd.exe
The NTVDM CPU has encountered an illegal instruction.
CS: 056a IP: 8100 OP: 63 74 6C 79 2E Choose 'Close' to terminate the application.

Kindly please ADVICE how to fix this problem...Thank you very much for your kind help

Regards,

JessieYou have a virus problem. You should post in the malware/virus section where suitably qualified people can help you.

6312.

Solve : systeminfo - issues?

Answer» HI folks,

I'm a BIT new to command prompts in general, hopefully i will EXPLAIN myself well enough!

I'm familiar with the "systeminfo" command to gain information about your PC including uptime, etc.

I'm ATTEMPTING to use the "systeminfo /s" command to gain the same information about other users in our domain.

Once I've entered "system /s" following by either the IP or the computer name, it prompts me for my password, which is fine.

But no matter how many times I input my password (which I obviously know to be correct and use it every day) it just says:

ERROR: Logon Failure: Unknown username or bad password

The username and password are 100% correct, am I missing something???

Thanks in advance.

Paul

Do the other systems on the network have the same admin acct on those systems to allow for passthrough authentication? If the other systems dont have the same user name and password as you, then add it and see if that fixes your issue. The other issue could be firewalls blocking the request. Shut off firewalls and try again, then if it works then its a firewall exception that needs to be added.

good luck
6313.

Solve : OSQL command?

Answer»

i want to create a database using the OSQL COMMAND, but using a batch file and not on command prompt...


Please help u can use this command in the bat file

sqlplus USERNAME/[emailprotected] @sqlfile.sql >>lg.log

where sqlfile is the file where u store the script u want to execute
and lg.log is where the sql loc commints and errors will be.

also if u want to GET the out put of an select statment as eg
u can use the sql command spool spoolfile.txt before the select (in the sqlfile)and NEXT it put
spool off like this

set linesize 600
spool a.txt
select 1 from dual;
spool off

hope its usful for u

6314.

Solve : my music??

Answer»

does ANYONE know a batch line/cmd
that can copy something from my music ( in my documents )
into L:\music ( aka my psp )So that's why you ASKED earlier.......

Code: [SELECT]copy "C:\Documents and Settings\user\My Documents\My Music\file.mp3" "L:\Music\file.mp3"
That should do it.



**Note that I am only back on CH due to FRIEND request. Will be back in a few DAYS **thx man.
i couldve asked u on msn haha but couldnt b borthered

6315.

Solve : HELP with user input for cd location after batch file starts?

Answer»

Hi everyone,
I'm new to the forum and creating batch files in general. I did some browsing to SEE if I could find a solution to my problem before posting and so far found something that was very useful but not quite what I had it mind. I'm trying to create a batch file that will prompt for a directory path and then that path would be used to point to the location to register the .dll files there.
Code: [Select]echo This will reregister all .dll files in a given directory.
set /p chgdir="Please type the directory where the dll files are located: "
cd %chgdir%
for %m in (*.dll) do regsvr32 /s %m

I found a thread that had this option for registering .dll files in a set directory.
Code: [Select]@echo on
for %%a in ("c:\Program Files\workfolder\*.dll" "c:\Program Files\workfolder\data*.dll") do start /B "regsvr32.exe %%a"
pause

I would like to use either method as long as I can have the directory location inputted after the batch file has started and not be dependent on creating any additional files or anything.hi,

Welcome to the forums.


I've knocked up this SIMPLE batch for you to do the job resquested.

I don't use for loops in batch every often so it might need tweaking. I've also added some errorlevel capture so you know weather there has been a problem.

Code: [Select]@echo off

echo.
echo.
echo.
echo.
set /p answer="Please enter the path for your .dll files (remember to add the \ \ where needed): "

for %%a in (%answer%"*.dll" %answer%"*.dll") do start /B "regsvr32.exe /s %%a"

if /i "%errorlevel%" gtr "0" (goto pass) else goto fail

:fail
cls
echo.
echo.
echo.
echo. Unable to register dll files. please check location
echo.
echo.
pause
exit

:pass
echo.
echo.
echo.
echo. All dll files registered
echo.
echo.
pause
exit


Hope it helps.

Works like a charm. Thank you very much. The only tweaking required is adding it to my main batch file.

On a side note for FUTURE use, why is this required 2 times?
Code: [Select](%answer%"*.dll" %answer%"*.dll")
I spoke too soon. I'm having some serious issues with the register portion of my batch file. After it registers the .dll files it causes the batch file to no longer function and starts behaving oddly.

Code: [Select]@echo off
goto menu

:runmenu
pause
set option=
goto menu

:menu
cls
echo.
echo Enter 0 to EXIT without executing a command.
echo Enter 1 to run Windows Management Instrumentation (WMI) repair part 1.
echo Enter 2 to run Windows Management Instrumentation (WMI) repair part 2.
echo Enter 3 to run CCMClean (to uninstall the SMS Client ver 2.50.x only).
echo Enter 4 to reregister all .dll files in a given directory.
echo Enter 5 to run network connection refresh.
echo.
set /p option="Please enter 0,1,2,3,4,5: "
if %option%==5 goto option5
if %option%==4 goto option4
if %option%==3 goto option3
if %option%==2 goto option2
if %option%==1 goto option1
if %option%==0 goto exit
echo Unrecognized option: %option%
goto runmenu

:option5
echo.
echo Refreshing network connection.
pause
ipconfig /release
if %ERRORLEVEL%==1 goto ErrorExit1
ipconfig /flushdns
if %ERRORLEVEL%==1 goto ErrorExit1
ipconfig /registerdns
if %ERRORLEVEL%==1 goto ErrorExit1
ipconfig /renew
if %ERRORLEVEL%==1 goto ErrorExit1
echo.
echo Network connection refreshed.
goto runmenu

:option4
set answer=
echo.
echo This will reregister all .dll files in a given directory.
echo A system restart is recommended after this is completed.
echo.
set /p answer="Please enter the directory path where the .dll files are located (i.e. c:\windows\system32\): "
for %%a in (%answer%"*.dll" %answer%"*.dll") do start /B "regsvr32.exe /s %%a"
rem if %ERRORLEVEL%==1 goto ErrorExit1
goto runmenu

:option3
echo.
echo Starting CCMClean now. Rerun CCMClean if any errors occur.
c:\temp\ccmclean.exe
if %ERRORLEVEL%==1 goto ErrorExit1
goto runmenu

:option2
echo.
echo Running WMI repair part 2.
winmgmt /clearadap
if %ERRORLEVEL%==1 goto ErrorExit1
winmgmt /kill
if %ERRORLEVEL%==1 goto ErrorExit1
winmgmt /unregserver
if %ERRORLEVEL%==1 goto ErrorExit1
winmgmt /regserver
if %ERRORLEVEL%==1 goto ErrorExit1
winmgmt /resyncperf
if %ERRORLEVEL%==1 goto ErrorExit1
echo.
echo WMI repair complete.
goto runmenu

:option1
echo.
echo Running WMI repair part 1. If prompted, type: Y
net stop winmgmt
rd /s /q %systemroot%\system32\wbem\repository
if %ERRORLEVEL%==1 goto ErrorExit1
goto runmenu

:ErrorExit1
echo.
echo Last command failed to execute.
echo Rerun that option or choose another option.
goto runmenu

:exit
echo.
echo Exiting program. Rerun program as needed.
pause
set option=



Below is a copy & paste from the cmd window. It should have gone to :runmenu and paused but it did not. It didn't even go the :menu but instead went back to my current dir path but the dos environment was then acting odd and not allowing me to run the batch file correctly or even exit.
Code: [Select]Enter 0 to EXIT without executing a command.
Enter 1 to run Windows Management Instrumentation (WMI) repair part 1.
Enter 2 to run Windows Management Instrumentation (WMI) repair part 2.
Enter 3 to run CCMClean (to uninstall the SMS Client ver 2.50.x only).
Enter 4 to reregister all dll files in a specific directory.
Enter 5 to run network connection refresh script.

Please enter 0,1,2,3,4,5: 4

This will reregister all .dll files in a given directory.
A system restart is recommended after this is completed.

Please enter the directory path where the .dll files are located (i.e. c:\window
s\system32\): C:\Program Files\Internet Explorer\MUI\0409
Press any key to continue . . . Microsoft Windows XP [VERSION 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\xu855c\My Documents\Executables\RDMI>Microsoft Windows
XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\xu855c\My Documents\Executables\RDMI>Microsoft Windows
XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\xu855c\My Documents\Executables\RDMI>Microsoft Windows
XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\xu855c\My Documents\Executables\RDMI>




^C
C:\Documents and Settings\xu855c\My Documents\Executables\RDMI>

C:\Documents and Settings\xu855c\My Documents\Executables\RDMI>C:\Documents and
Settings\xu855c\My Documents\Executables\RDMI>C:\Documents and Settings\xu855c\M
y Documents\Executables\RDMI>

If someone can take a look and find out where I'm GOING wrong I would really appreciate it.
Maybe I'm being too ambitious or something... hey,

what i do when I'm having trouble finding a fault in a batch file is to first remove or 'rem' out the @echo off line so you can see each command run.

I also like to add pauses and a brief description at every step.

ie,

Code: [Select]:menu
echo just got to main menu
pause
and so on.

another good tip is to run your batch file from a command prompt, that way unless you have exit at the end the window will remain open allowing to you see the last command that was run.

I don't have .dll to register myself and so can't replicate the fault.

I hope this has been of some help to you.

Blastman

6316.

Solve : deference between % !?

Answer»

i need to DISTINGUISH between %variable% and !variable!
can any one till me in what they differ!variable! is using delayed expansion
what do u men by delayed expantion
is it for geting system variablers that take delay to be returned read this page

http://www.robvanderwoude.com/variableexpansion.html
i Appreciate ur help, its realy wonderful PUT can i ask for somthing else that is
the %~F0 and any other variables like it '%~' and its meaning or give me WEBPAGE i can find them in type

Code: [Select]for /?
at the promptthanks alot
u mean that in stead of putting the for loop variable 'I' put 0 and it will work out side the for loop like that
%~f0
instead of
%~fI inside the for loopQuote from: .bat_man on April 09, 2008, 02:50:52 AM

thanks alot
u mean that in stead of putting the for loop variable 'I' put 0 and it will work out side the for loop like that
%~f0
instead of
%~fI inside the for loop

You use letters of the alphabet %%a to %%z and %%A to %%Z for loop variables and you use figures %1 to %9 for parameters PASSED to the batch file from the command line. %0 has a special meaning, it expands to the batch file's own name.
thanks a lot
i appreciate ur help
6317.

Solve : Multiple Variables in a batch file?

Answer»

So I am trying to copy some log files from a server from multiple numbered folders and only for a certain amount of time. My problem is I can create a batch file that will sort through each folder and copy the SELECTED file, but they are IIS logs that all have the same file name in different folders.

Here is what I currently have:
FOR %%A IN (1 3 4 7 8 10 12 15) DO copy \\servername\logs\W3SVC%%A\0804(this is where I want to put my selected range of times) c:\logs

First problem is I don't know how to specify multiple variables if it is possible and secondly the naming conventions are the same across all the log folders so I would need to rename them in the destination folder. Does anyone understand what I am tryin to do?If I understand correctly, (and I may not) You want to copy various files, all with the same name to one local folder. Logic dictates you must rename them, can't have 'em all with the same name. I don't know what file extension you have but lets PRETEND its .txt for the moment. So you have:

FOR %%A IN (1 3 4 7 8 10 12 15) DO (
copy \\servername\logs\W3SVC%%A\Filename.txt c:\logs
)

Why not just append the unique directory number to each file? So:

FOR %%A IN (1 3 4 7 8 10 12 15) DO (
copy \\servername\logs\W3SVC%%A\Filename.txt c:\logs\Filename%%A.txt
)

I should point out my knowledge of DOS is pretty limited, it just happens that I spent a while TODAY working out how to do a similar thing .
That is great input, I actually ran this batch yesterday to gather the data renaming each file with first variable.

What I was really asking about though was the ability to include more than one variable into a batch statement like:

where %%B IN (0803 2049 2123)
FOR %%A IN (1 3 4 7 8 10 12 15) DO copy \\servername\logs\W3SVC%%A\0804%%B* c:\logs\%%A.log

If that makes any sense D:So like a nested FOR loop?

FOR %%B IN (0803 2049 2123) DO (
FOR %%A IN (1 3 4 7 8 10 12 15) DO copy \\servername\logs\W3SVC%%A\0804%%B* c:\logs\%%A.log
)

So it will run

FOR %%A IN (1 3 4 7 8 10 12 15) DO copy \\servername\logs\W3SVC%%A\0804%%B* c:\logs\%%A.log

3 times with, once with each of 0803, 2049, 2123 as %%BThat worked PERFECTLY! You rock.

6318.

Solve : Use a command to set a variable?

Answer»

Hello.

I am trying to come up with a way to set an environmental variable based on a folder name. If I run Code: [Select]dir /b it outputs the name that I WANT, but I can't figure out how to GET that into a Code: [Select]set name= command.

The reason I want to do this is because I need a script that when I run as an administrator it can automatically find the user that the computer belongs to. I have a login script that automatically creates the folder, now I just need a way to use it.

Any help on this would be greatly appreciated.what OS are you using? i would try the set /p name= commandI'm using Windows XP.

When I use /p it sets the variable to "dir /b" not the resultant name of "dir /b"hmm.... i know theres a way to do this.... i'm testing it a bit
im trying something like this

-----------------------------------------------------------------------------------------------------------------------------------------
dir /b >> "C:\Documents and Settings\coolname.txt"
type "C:\Documents and Settings\coolname.txt"
----------------------------------------------------------------------------------------------------------------------------------------
the problem is i still can't get it to work, beside manually comping and pasting the name into the set command.Could the "For" command be used to get this? I have NEVER actually used the For command, but I have seen people use it to PUT Date and Time into variables.

Well I'm going to go do some reading on "For" and see if that will do what I want it to.good idea. im reading about the FOR command, man does it get complicated.You want to get a folder name into a variable? Please give more details like

is the folder under another folder? (names?)

is it the only one under that folder?

does dir /b output the folder name and nothing ELSE?

Surely if you were looking for a folder name then you'd use dir /b /ad

Answer all of these questions please & I I'll try to get back to you

The folder is located in C:\User
There is only one folder in the User folder
The Dir /b give only the name of the folder I want to make a variable
There are no files or anything else, so the /ad option is not needed.

I hope that helps.use this comands inside a bat file

for /f %%i in ('dir /b') do set name=%%i
echo %name%

i hope its usful for u

u should put dir /b C:\User
in stead of dir /bQuote from: .bat_man on April 08, 2008, 07:29:24 AM

use this comands inside a bat file

for /f %%i in ('dir /b') do set name=%%i
echo %name%

i hope its usful for u

That's perfect! It did exactly what I needed it to, Thanks!
6319.

Solve : RUNAS Command Help?

Answer»

i am running a script to run a DEFRAG on a device that doesn't have administrative privileges. If I USE the runas command It works but i am REQUIRED to put in a password. is there a WAY around having to put the password in? Can it be scripted in?CH has a search feature which can be very helpful:

Runas



6320.

Solve : Convert script from bash to bat?

Answer»

The following is a bash script, launching SpanParser.exe APPLICATION with a capability of parsing any of the mentioned format files (*.pa; *.pa2; *.par; *.PA2; *.lfe; *.EUR)in the C:\xpit.com\applications\SpanParser\data direvtory. Also it creates a log file with the same name as the object file is, in the same directory:
COULD anyone create the same for windows (bat)?

# Script executes the span-parser for SPAN files downloaded
# SETUP the program variables

PARSER='c:/xpit.com/applications/spanparser/spanparser.exe'
DATAPATH='c:/xpit.com/applications/spanparser/data'

# Run the parser on all .PAR, LIFFE and EUREX files
for elem in `ls $DATAPATH/*.[pP][aA][rR23] $DATAPATH/*.eur $DATAPATH/*.lfe`; do
echo ${elem}
$PARSER -nogwl ${elem} > ${elem}.log
done



Perhaps this will help. It may actually work!

Code: [Select]@echo off
rem Script executes the span-parser for SPAN files downloaded
rem Setup the program variables

set PARSER='c:\xpit.com\applications\spanparser\spanparser.exe'
set DATAPATH='c:\xpit.com\applications\spanparser\data'

for %%v in (pa pa2 par lfe eur) do (
for /f "tokens=* delims=" %%w in ('dir %DATAPATH%\*.%%v /B') do (
echo %%v
%PARSER% -nogwl %DATAPATH%\%%w > %DATAPATH%\%%w.log
)
)

Thanks Sidewinder. Actually it didn't exactly work, but still gave a clue on where to approach from. I'll keep working on it based on your script over the week end. I'll post my achievements for you. For Sidewinder:
It turned out to be much more simple then one could think of:

forfiles /p c:\xpit.com\applications\spanparser\data\ /m *.pa2 /c "cmd /c C:\xpit.com\applications\SpanParser\SpanParser.exe -nogwl @path > @path.log"
forfiles /p c:\xpit.com\applications\spanparser\data\ /m *.lfe /c "cmd /c C:\xpit.com\applications\SpanParser\SpanParser.exe -nogwl @path > @path.log"
forfiles /p c:\xpit.com\applications\spanparser\data\ /m *.par /c "cmd /c C:\xpit.com\applications\SpanParser\SpanParser.exe -nogwl @path > @path.log"
forfiles /p c:\xpit.com\applications\spanparser\data\ /m *.eur /c "cmd /c C:\xpit.com\applications\SpanParser\SpanParser.exe -nogwl @path > @path.log"

This serves the purpose.
But anyways thanks a lot for your efforts.

6321.

Solve : Can't read a .com file?

Answer»

I have downloaded a program and it came with a .com file. I want to see what this file does as it opens a cmd window on XP but it closes before I can see what happens.

Any ideas as to how/if I can read it or see the source?



Or at least how to pause the cmd window the .com file opens while it is running?i can help u with how to convirt the .com file or to read its commands
put i can help u to see the out put of the .com file :

open an command prompt
and go th the directory where the .com file is and then execute it like this
directorypath>filename.com
then the output of the file will be seen unlis it contain the exit command at the en of it if so do this
directorypath>filename.com > outputfile.txt
next executing it the file outputfile.txt will have the output of the .com file

i hope its helpful for u Well those ideas while great, did not help.
I looked at the file in HEX and it says "This program cannot be run in DOS mode. "

The NAME of the file is op.com and it came with a version of opera I downloaded. What else could this THING be? It definitely pops open a cmd window.This is Opera USB, right? Running off PortApps Toolbar? If so this is down to PortApps not working properly with Opera. Start Opera by clicking DIRECTLY on the exe file and the problem should go away.



Yes, but I don't know what PortApps Toolbar is. There really is no problem with opera.

The file op.com opens a cmd window and makes some directory change updates. This happens whether I start with opera.exe or op.com.


I want to see what op.com is doing but it closes too quickly for me to catch it all. I want to see what code is written in op.com so that I can figure out what all it is doing.
com files are MACHINE code files. You would need a disassembler to see the the assembly language, and you would need to know what it meant.

That's what I was afraid of.

Think there would be any way to decipher the call to opena cmd window and alter it to stay open? I don't know that much about x86 but if the directories were readable I could probably make a slight alteration.Have you seen this online disassembler?

http://pvdasm.reverse-engineering.net/PVPHP.php



Thanks!

An online Disassembler is a pretty neat idea

6322.

Solve : Help with a Format Batch?

Answer»

Thanks to all for your attempts at reassurance. There are many many perfectly innocent DOS commands as well as other tools which can be dangerous in the wrong hands. I think it would be a great devaluation of the enormous value of this site if they were all to be excluded from discussion in case someone misuses them.

I have, as requested, edited my earlier messages which CONTAINED the command which CAUSED all the fuss. With all due respect to all concerned, I really think that the whole THREAD might as well now be deleted. A thread which asks a question and gets a workable solution which is later removed, can't be of much use to anyone else who comes looking for a solution to the same problem, can it?

I think we should now draw this discussion to a close. I, at least, am bowing out now. Before posting any future question, I SHALL think very carefully about any possible consequences. It was never my INTENTION to cause all this. Sorry.

6323.

Solve : find and delete string in registry.. how..???

Answer»

hello, i am looking to make a bat script that will search the entire registry for windows xp sp2 for a certain string-word and once found delete all those registries found with it in their name.

how to make this happen please help, thank you...PERHAPS you COULD explain more about what you're trying to accomplish. Such a batch file can render a PC inoperable.

just need to find and delete some registry keys of some old app i uninstalled that left a bunch of reg keys behind that i wana get rid of.

is it possible to do this wit h a bat script or no..??Quote

is it possible to do this wit h a bat script or no..??

Probably not. Batch code is text based and the registry does and will contain binary values.

I would suggest either RegScanner or cleaners like CCleaner or Eusing.

You could always do this manually with RegEdit. Make a backup first. The registry cleaners are SAFE to use. I have no EXPERIENCE with RegScanner.



Be careful, as mentioned you can turn your PC into an electronic brick if you're not.
6324.

Solve : Runas command: auto fill password?

Answer»

Hi,
Does anyone know how to auto fill the password in the runas command in the console under windows vista.
E.G. I type runas /user:blackberry "cmd.exe", then I get the question give the password, but I would like to have that the batch file auto gives that password. Any ideas?

Thanks in advance

Blackberry You might try to pipe the password into the command. Don't know if it will work but do know that BLANK passwords are not accepted.

Code: [Select]echo password | runas /user:blackberry "cmd.exe"

Code like this is a security breach and MS may disallow it.

Does not the user parameter need to be in DOMAIN\USER format?sadly the 'runas' command won't let you pipe the password as it is as sidewinder has said and locked down as a security feature.

someone else asked this not to long ago. I think they got it working by USING pstools, psexec is designed to RUN apps on remote machines, but i see no reason why you couldn't get it run on the LOCAL machine.

psexec will allow to hardcode a password into the batch.

hope it helps.

6325.

Solve : Batch to check for TOTAL RAM?

Answer»

I once made a boot CD that created a RAM disk and then copied a lot of utilities into it. The idea was to have a user menu for the different utilities and having them on the RAM disk would MAKE them load quicker than they would off the CD. This turned out to be a "solution" that created more problems than it solved. The main drawbacks were that creating the RAM disk and copying stuff into it off the CD took quite a long time, CAUSING a tedious wait before you could do anything, and also that the RAM disk was created in extended memory and some programs (Ghost 8 in particular) like to have exclusive access to EMS, and refuse to run otherwise.

However, all the solutions I have come up with so far require the batch file to have access to a writable medium of some sort.

Other problems that I wonder about are: The version of DOS used to prepare the bootable disk - the MEM in some versions of DOS cannot detect RAM above 64 Mb and report all amounts equal to or greater than that as 64 MB. (My bootable pen drive uses DOS 7 that comes with Windows 98SE and reports 1 Gb of RAM correctly) and the slightly differing output formats of different MEM versions.


Im just so suprised that there isnt any other method to getting the amount of ram in a system.

does anyone know how to do it with SIMPLE programming to create a self contained executable?


Any Ideas?The problem is that MS-DOS was designed a long time ago and uses 16 bit arithmetic; it is possible in theory to read the memory size from the CMOS memory using assembly language but this method runs out of steam at 64 Mb and reports all sizes over that as 64 Mb.

How many machines are you RESPONSIBLE for, and how many have under 512 Mb?
I belive this may run off of a msdos built around win 98 recovery disc.

Does anyone know of a way to write a program .exe that could do the job of the batch easier?

I am working on this project to try and improve the current configuration. We own/manage thousands of computers at remote locations. Try are we may to keep them updated and to not send image cd to a low memory computer it still happens.

Do you know of any other image methods other than what I am using that could make this easier? GHOST 8.0. It must be fool proof as our end user is not very computer savvy.

Thanksalright...

What about a new boot system? placing the ghost.exe in a live disc. would that work? then in this new environment I could run a memory check.

Any one have experience with this?Do the PCs have floppy DRIVES?
nope

some have dvd but all have cds

6326.

Solve : update mode in 7z..?

Answer»

hi,

how can i set update mode to "add and replace" when compressing files to .7z via cmd command?
what is the switch i must use??

Thanks in advance for any help...

Code: [Select]Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]

<Commands>
a: Add files to archive
d: Delete files from archive
e: Extract files from archive
l: List contents of archive
t: Test integrity of archive
u: Update files to archive
x: eXtract files with full pathname
<Switches>
-AI[R[-|0]]{@listfile|!wildcard}: Include archives
-ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
-BD: Disable percentage indicator
-i[r[-|0]]{@listfile|!wildcard}: Include filenames
-m{Parameters}: set compression METHOD
-o{Directory}: set Output directory
-p{Password}: set Password
-r[-|0]: Recurse subdirectories
-sfx[{name}]: Create SFX archive
-si: read data from stdin
-so: write data to stdout
-t{Type}: Set type of archive
-v{Size}}[b|k|m|g]: Create volumes
-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
-w[{path}]: assign Work directory. Empty path means a temporary directory
-x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
-y: assume Yes on all queries
yeah i used that before, but i did't find the one that sets the update mode to "add and replace"I don't THINK you can do this in 7zip from the command line.
thank you Dias for reply

6327.

Solve : String in FOR command?

Answer»

Windows XP SP.2

Is it possible to wrap a string in a FOR loop command line so that the entire string is visible in Edit.com - my editor of choice. e.g.

Code: [Select]@echo off
cls

set z=1
echo. & echo. & echo. & echo. & echo. & echo.

:rerun

FOR /F "tokens=%z%" %%D in ("This is a very very long string which will extend past the screen boundary.") do (
echo %%D
)

set /a z=%z%+1
if %z% gtr 14 goto end
goto rerun

:end

In the above code the string extends past the 80 column RH side of the screen, can it be wrapped somehow?

ThanksA caret can be used as line continuation marker as long as there aren't any quotes around the string

Thus

echo Mary had a little lamb: its fleece was white as snow, and everywhere that Mary went, the lamb was sure to go.

may be REPLACED by

echo Mary had a little lamb: its fleece ^
was white as snow, and ^
everywhere that Mary went, ^
the lamb was sure to go.

This can happen either at the prompt (I pasted the above 4 lines as a group into a command window; note the "more" prompt - this appears also if you type a single line with a caret at the end)

Code: [Select]C:\>echo Mary had a little lamb: its fleece ^
More? was white as snow, and ^
More? everywhere that Mary went, ^
More? the lamb was sure to go.
Mary had a little lamb: its fleece was white as snow, and everywhere that Mary went, the lamb was sure to go.
or in a batch file. The problem with a FOR loop lies in the need to quote the string, because the beginning quote will render the caret inoperative. You could always assign the string beforehand to a variable with a nice short name and use that in the FOR line. I actually do this sometimes to make my code more readable/editable. The following code includes examples of what I mentioned above.

Splitline.bat:

Code: [Select]@echo off

cls

echo Mary had a little lamb: its fleece ^
was white as snow, and ^
everywhere that Mary went, ^
the lamb was sure to go.

set z=1

REM you did know you don't actually need the spaces here?
echo.&echo.&echo.&echo.&echo.&echo.

REM and you may be interested to know about doing the above
REM this way. These 2 do the same thing & look nicer I think,
REM and are less of a pain to modify.

REM for %%N in (1 2 3 4 5 6) do echo.
REM for /L %%N in (1,1,6) do echo.

:rerun

REM this is one way to break a string
REM Dunno if this will do exactly what you wanted
REM but it seems to be functionally equivalent to
REM what you posted

set string=This is a very very long ^
string which will extend ^
past the screen boundary.

FOR /F "tokens=%z%" %%D in ("%string%") do (
echo %%D
)

set /a z=%z%+1
if %z% gtr 14 goto end
goto rerun

:end
Output:

Code: [Select]
C:\>Splitline.bat
Mary had a little lamb: its fleece was white as snow, and everywhere that Mary went, the lamb was sure to go.






This
is
a
very
very
long
string
which
will
extend
past
the
screen
boundary.




As usual Dias you are awesome.
I had forgot about the caret trick, and I did not know of the "echo.&echo.&echo" trick.
Quote from: Dias de verano on April 05, 2008, 02:40:55 AM

A caret can be used as line continuation marker as long as there aren't any quotes around the string.
Code: [Select]REM you did know you don't actually need the spaces here?
echo.&echo.&echo.&echo.&echo.&echo.

I've already edited one of my batchfiles with the "echo.&echo.&echo...", greatly reducing the number of lines in the file. I will clean up some others soon.

I have another batch file with the long line problem that I am going to edit with your suggestion to set a variable to equal the long expression, then replace the expression with the short VAR name. AWESOME!!!

Thanks Again!!!
the original poster used the echo. & echo. & echo. [etc] thing. I merely pointed out that the spaces were not needed, and further pointed out that this is even better

Code: [Select]for /L %%N in (1,1,6) do echo.
Of course you can replace the number 6 with the number of BLANK lines you want to echo.



Sorry, I missed your second suggestion with the for command.
Quote
Code: [Select]for /L %%N in (1,1,6) do echo.

That is great for anyone who is familiar with for, but for those of us who are still struggling, the "echo.&echo. ..." may be a bit easier. That doesn't mean I don't appreciate it. I saved the whole thing in a text file to explore more later.

Thanks.Of course you can save lines by joining any commands with & signs

cls&echo %date%&cd C:\&dir

Dias - thank you. I knew about the caret extension but not how to apply it in a bat script. Like others I am amazed, and in awe, at your depth of knowledge.

Thanks again for the lengthy explanation clarifying more than the question I asked..

Thank you for your kind words, which I do not deserve: most of what you guys think I "know" about batch scripting I picked up from Google searches and in particular from lurking in, and SEARCHING in the very valuable Usenet groups alt.msdos.batch.nt and and alt.msdos.batch

Useful searchable Google Groups archives of these groups:

http://groups.google.com/group/alt.msdos.batch.nt/topics?hl=en&lnk=gschg

http://groups.google.com/group/alt.msdos.batch/topics?hl=en&lnk=gschg

Just about every question you can think of has been asked and answered in them.





6328.

Solve : Simple Batch File COPY?

Answer»

Hi,
I am trying to create a batch file to copy from my C drive directory to the D drive directory. I was so far able to copy a file using a simple directory listing PATH with this command:
COPY C:\Test.doc D:\

But if I try to copy a more extensive path i.e.,:
COPY C:\Document and Settings\(username)\Desktop\Test.doc D:\Documents and Settings\(username)\Desktop

the batch does not work.
Any glues on how to write this script will be welcome.
Thank you.
I see this is your second post. Welcome to Computer HOPE.


Quote from: Germain on April 05, 2008, 02:27:48 PM

... I was so far able to copy a file using a simple directory listing path with this command:
COPY C:\Test.doc D:\
^^^^^^^ has no spaces in it.

Quote
But if I try to copy a more extensive path i.e.,:
COPY C:\Document and Settings\(username)\Desktop\Test.doc D:\Documents and Settings\(username)\Desktop
^^^^^^^^^^^^^^^^ has spaces in it.

Quote
the batch does not work.
Any glues on how to write this script will be welcome.
Thank you.

Paths and/or filenames that have spaces in them necessitate the use of quote marks.

Code: [Select]COPY "C:\Document and Settings\(username)\Desktop\Test.doc" "D:\Documents and Settings\(username)\Desktop"

Let us know if that SOLVES it.


Thanks Willy. I did the CHANGE as you suggested and the script worked. Quote from: Germain on April 05, 2008, 03:46:37 PM
Thanks Willy. I did the change as you suggested and the script worked.

You're welcome.

See you later, AROUND CH here.
6329.

Solve : I need help again with a script file... ANYONE STILL UP TO HELP ME??????

Answer»
I am trying to get this script to run. I need to add the "c u" after the "IMP71MR1.BAT" file. Please tell me what am i doing wrong? It is very late here but i need to get this running if i can... I would appreciate any help...

Thanks...

The batch file below is what i cam trying to get running...



@echo off
This will take some please be patient!
pause
dir c:\cognos\IMP71MR1.BAT

call c:\cognos\IMP71MR1.BAT c u

EXIT


personally I'd do;

@echo off
This will take some please be patient!
pause>nul

start "c:\cognos\IMP71MR1.BAT c u"

EXIT

give it a try.... Thank you for helping me...



Will this work even if the original file is only "c:\cognos\IMP71MR1.BAT"?

I need to add the "C U" to the end of the "c:\cognos\IMP71MR1.BAT" for it to run correctly.

Let me KNOW... I will try this...



yeah it will still work.

The only thing you missed was the " " around the batch file path and arguments.

not USING them causes the batch file to stop reading that line at '.bat' hence why it's not doing the 'c u' bit your after.

It gave me an error....

'This' is not a recognized as an internal or external command, operable program or batch file?



post your code....
This is all i am using... I just want to run this batch file. So i am trying to make a batch file to run another batch file.

This is the file i am trying to create...


@echo off
This will take some please be patient!
pause
dir c:\cognos\IMP71MR1.BAT

call c:\cognos\IMP71MR1.BAT c u

EXIT





This is the batch file that i am running:




@echo off
if "%2"=="" GOTO ERROR1_PARM
set InstType=Invalid
if /I "%2"=="U" set InstType=User
if /I "%2"=="A" set InstType=Admin
if "%InstType%"=="Invalid" goto ERROR1_PARM

TITLE Cognos Impromptu v7.1 MR1 %InstType% Installation
cls
rem
rem As this procedure was designed to be run from the
rem network login script, no prompting for user reponse
rem is required by this batch file.
rem
rem

cscript %1:\COGNOS\IMP71MR1.vbs //nologo %1 %2 %3
if errorlevel 1 goto ERROR2_VBS
goto end
REM ===================================
:ERROR1_PARM
echo.
echo %0:
echo Error invalid/missing parameters
echo Drive LETTER of EPETUTIL directory
echo Installation type (U)ser or (A)dministrator.
echo.
echo Example:
echo %0 M A
echo.
PAUSE
goto end
rem
:ERROR2_VBS
echo.
echo %0: Error unable to execute Impromptu v7.1 MR1 installation script.
echo.
PAUSE
:END
Can you understand what i am trying to do now?

change the first batch file to the following.....


@echo off
This will take some please be patient!
pause
dir c:\cognos\IMP71MR1.BAT

start "c:\cognos\IMP71MR1.BAT c u"

EXIT
I am still getting the above mentioned error...

However... the systems i will be running this batch file on is a XP system... I am at home running a VISTA Pro machine... does this make a difference?

This batch is supposed to be copied to the C\:cognos\ dir and then i am suppose to go to the "START" in windows and then go to the "RUN" and then type in

C:\cognos\IMP71MR1.BAT c u Everytime... i wanted to get around doing this for installing on 90 MACHINES... It will take forever so i tryed to make a script to do it for me... Is this possible?

arh........


change the first batch file to the following.....


@echo off
echo This will take some please be patient!
pause
dir c:\cognos\IMP71MR1.BAT

start "c:\cognos\IMP71MR1.BAT c u"

EXIT

we was missing the echo INFRONT of the 'this will take some time please be patient!' !!!!!!

try it with echo....(like above)
Quote from: gmixx on April 03, 2008, 04:14:39 AM


This batch is supposed to be copied to the C\:cognos\ dir and then i am suppose to go to the "START" in windows and then go to the "RUN" and then type in

C:\cognos\IMP71MR1.BAT c u Everytime... i wanted to get around doing this for installing on 90 machines... It will take forever so i tryed to make a script to do it for me... Is this possible?



sorry I'm confused now....

you want this to run on 90 machines???

that is posiable, but I'd sugest getting it running on one first. then you know your code is good.

make the change i sugested (add the echo command to the 'This will take some please be patient!' line) and post back.Ok, we are getting somewhere...

Now it stops at the C:\users\me\desktop> ??

Why is it stopping there? So i need to add something? Hahaha,

I am sorry to confuse you... AFTER i get this running correctly... I will take it tomorrow and load 90 machines... not tonight...LOL

6330.

Solve : Control Characters in File - Help?

Answer»

I'm trying to write a batch file to replace certain data in a file. Here is approximately what the data looks like.

This is source file (source.dat)
LXXX0220451 0337 BEN:QUALEX KS& N
LXXX0220451 0337 TOTAL#OFITEMSI N
LXXX0220451 0337 L-C DIVISION O N
LXXX0220451 0337 2642, DEPART 4 N
LXXX0220451 0337 BEN_ /& TOT$ N

I need to copy the data to another file, then in the in the copy - replace the XXX in positions 2-5 with ZZZ. Then merge the data together so I have a combined file with rows with both the XXX and ZZZ. I have that part working ok. But I'm having an issue with the special characters that can appear in positions 18 to 32, especially the & which is truncating the rest of the line in the rows where I'm replacing the XXX with the ZZZ.

Here is what I'm using for code. This isn't exact as the file is longer than what I have here and there is a header and a footer but I'm not having an issue with the header and footer rows.

set _INPUT_FILE=source.DAT
set _OUTPUT_FILE=WORK.dat

copy source.dat work.dat.

in Work.dat
set _DET_PRE_CODE=%_STRING:~1,1%
set _DET_CODE_OLD=%_STRING:~2,3%
set _DET_DESC_STR=%_STRING:~5,137%

set _DET_CODE_NEW=ZZZ

echo %_DET_PRE_CODE%%_DET_CODE_NEW%%_DET_DESC_STR% >> %_OUTPUT_FILE%


copy source.dat+work.dat

Another issue is that the final source.dat file has the following control character at the end which is causing an issue with the next step in the process that has to read the file. (Not windows process.) Is there an attribute to copy command that will not create this or another command that I can use to merge the two files together without having the character on the end. I know its happening on the copy because the work.dat file doesn't have it. It doens't appear until the two files are merged.


At the end, I end up with something that looks like this:

LXXX0220451 0337 BEN:QUALEX KS& N
LXXX0220451 0337 TOTAL#OFITEMSI N
LXXX0220451 0337 L-C DIVISION O N
LXXX0220451 0337 2642, DEPART 4 N
LXXX0220451 0337 BEN_ /& TOT$ N
LZZZ0220451 0337 BEN:QUALEX KS&
LZZZ0220451 0337 TOTAL#OFITEMSI N
LZZZ0220451 0337 L-C DIVISION O N
LZZZ0220451 0337 2642, DEPART 4 N
LZZZ0220451 0337 BEN_ /&
SOMEHOW you need to get a carriage-return line-feed character at the end of each line. Once I did that I got this code to work:

Code: [Select]@echo off
setlocal enabledelayedexpansion
for /f "tokens=* delims=" %%i in (source.DAT) do (
set input=%%i
set input=!input:XXX=ZZZ!
echo !input! >> WORK.dat
)
copy source.dat+work.dat output.dat


Quote

I need to copy the data to another file, then in the in the copy - replace the XXX in positions 2-5 with ZZZ. Then merge the data together so I have a combined file with rows with both the XXX and ZZZ.

Text files can not be updated in place. Better to do a search & replace against the original file and output the changes to a new file.

Quote
copy source.dat+work.dat

Seems like a incomplete statement. When I tried it, just got a copy of the changed file. You can always use the DEL command to cleanup any work files.

Quote
At the end, I end up with something that looks like this:

What did you use to view the file? And just out of curiosity, what program created this file?

Thanks for your response.

I tried the set input then found it could be possible to have the "X's in other places in the file besides position 2-5 so I can't do a global replace on every instance of "X's" only that in position 2-5. The statement that I have is working to just replace the "X's" with ZZZ in 2-5. The main issue is the rows with the &. It's truncating data after the & as its writing the line to the output file. The other lines are ok. I'm trying to feed this file into another application so I can't have the carriage-return-line-feed at the end of the line.

The copy statement that I'm using has a folder structure in it that specifies where the files are. I'm using XP - this is the statement: and its working ok. I just get the control character at the end after the copy and its not in either of the files prior to the copy so I know its the copy statement that is putting it there. Not sure if there is an option to add to the copy to AVOID - I couldn't find one.
copy c:\RESIQ2\source.dat+c:\RESIQ2\WORK.dat

The actual file that has this data can be hundreds of lines long which is why we're trying to automate. The manual search and replace is very prone to error.

The file was created out of a banking program - I'm not sure of the exact software.

I'm open to another option besides dos batch. It just can't require elaborate setup or installation of other software as this has to run on the users desktop.

Again thanks. If you can think of anything else, let me know.Quote
If you can think of anything else, let me know.

We can always think of something else.

If you want to consider VBScript, we could probably whip something up for you. Does each line have a carriage-return line-feed? It's easier if each line has a beginning and an end.

[mind drift]
Back in the day there was a VM editor called Xedit that could easily gang punch columns of data. It was ported to the PC as The (). It could be scripted with REXX and was a godsend when working with files.
[/mind drift]



you can use vbscript. or you can use gawk ( if you can) . download and install from here.
save the code below as script.awk
Code: [Select]{
print $0
gsub(/&|\$/,"") #remove & and $.
a[++c]=substr($0,1,1)"ZZZ"substr($0,5)

}
END {
for (i=1;i<=c;i++) {
print a[i]
}
}
on command line
Code: [Select]C:\test>more test.txt
LXXX0220451 0337 BEN:QUALEX KS& N
LXXX0220451 0337 TOTAL#OFITEMSI N
LXXX0220451 0337 L-C DIVISION O N
LXXX0220451 0337 2642, DEPART 4 N
LXXX0220451 0337 BEN_ /& TOT$ N

C:\test>gawk -f change.awk test.txt
LXXX0220451 0337 BEN:QUALEX KS& N
LXXX0220451 0337 TOTAL#OFITEMSI N
LXXX0220451 0337 L-C DIVISION O N
LXXX0220451 0337 2642, DEPART 4 N
LXXX0220451 0337 BEN_ /& TOT$ N
LZZZ0220451 0337 BEN:QUALEX KS N
LZZZ0220451 0337 TOTAL#OFITEMSI N
LZZZ0220451 0337 L-C DIVISION O N
LZZZ0220451 0337 2642, DEPART 4 N
LZZZ0220451 0337 BEN_ / TOT N
6331.

Solve : Disable the X ??

Answer»

How did mode 300 work? All i get is a full screen window that can be dragged around the screen. The X is STILL there. It's TRUE but the window could be easily moved so the X is not as visible. Of course still best SOLUTION (I THINK) would be to use the SHORTCUT method I described earlier. The user would have no X unless they pressed ALT + Enter to resize the window.

6332.

Solve : Runs, then Closes no idea why?

Answer»

I have the following code

Code: [Select]@echo off
cls
echo *********************************************
echo **Delete Given File Names that can Be found**
echo *********************************************

FOR /F "tokens=1-3 delims=:" %%a IN (gameList.txt) DO (
echo Setting Information Up

set filename=%%a
set searchString=%%b
set hiddenString=%%c

echo %searchString%
title %searchString%

for /f "delims==" %%D in ('dir /s /b %filename%') do (
echo %filename% found in folder %%~dpD
echo removing files/folder
rmdir /s /q "%%~dpD" && echo OK
)

echo %hiddenString%

for /f "delims==" %%D in ('dir /s /b /a:H %filename%') do (
echo %filename% found in folder %%~dpD
echo removing files and folders
rmdir /s /q "%%~dpD" && echo OK
)
)
pause
[/code

It worked for a moment doing what it was supposed to, then I made some CHANGES, don't remember what, and now it runs, then closes and deletes all the files in the directory no matter what. Any help would be great.

Chriswhat does gameList.txt look like?

I would advise CHANGING the "killer" lines, the ones with rmdir in them, by prefacing them with echo so that you can see what they would do before you let them loose e.g.

echo rmdir /s /q "%%~dpD" && echo OK

also, if you are in danger of making changes and then forgetting what they were, save multiple versions with (for example) numbered filenames such as test1.bat, test2.bat, etc. That way you can always go back.

also remove the @echo off line or comment it out (rem @echo off) that way you can watch the execution and see all variables being expanded.

The variables in the main loop

Code: [Select]set filename=%%a
set searchString=%%b
set hiddenString=%%c

that is, filename, searchstring, and hiddenstring, are not going to be what you apparently think they are, because you NEED to remember about delayed expansion in a loop. realized after I left for my activity that I forgot to post gameList.txt

it looks something like

xxx.exe:Searching for xxx: Searching hidden files for xxx

also, what do you mean by Quote

that is, filename, searchstring, and hiddenstring, are not going to be what you apparently think they are, because you need to remember about delayed expansion in a loop.
Quote from: demosthenes705 on March 31, 2008, 08:24:52 PM
also, what do you mean by Quote
that is, filename, searchstring, and hiddenstring, are not going to be what you apparently think they are, because you need to remember about delayed expansion in a loop.

http://www.google.co.uk/search?source=ig&hl=en&rlz=&q=nt+batch+delayed+expansion&btnG=Google+Search&meta=&aq=fthanks for that, that seems to work a little better. Now the PROBLEM I am having is that it runs three times even though there are only two lines in the gameList.txt file. Here is everything I am using

Code: [Select]rem echo off
SETLOCAL ENABLEDELAYEDEXPANSION

cls
echo *********************************************
echo **Delete Given File Names that can Be found**
echo *********************************************

FOR /F "tokens=1-3 delims=:" %%a IN (gameList.txt) DO (
SETLOCAL ENABLEDELAYEDEXPANSION
set filename=%%a
set searchString=%%b
set hiddenString=%%c
@ping 127.0.0.1 -n 2 -w 1000 > nul
@ping 127.0.0.1 -n %1% -w 1000> nul
echo %searchString%
title %searchString%

for /f "delims==" %%D in ('dir /s /b %filename%') do (
echo %filename% found in folder %%~dpD
echo removing files/folder
echo rmdir /s /q "%%~dpD" && echo OK
)

echo %hiddenString%

for /f "delims==" %%D in ('dir /s /b /a:H %filename%') do (
echo %filename% found in folder %%~dpD
echo removing files and folders
echo rmdir /s /q "%%~dpD" && echo OK
)
)
pause
gameList.txt
Code: [Select]halo.exe:Searching for Halo:Searching Hidden Files for Halo
Project64.rdb:Searching for Project64: Searching Hidden Files/Folders for Project64
You made a good start with this line

Code: [Select]SETLOCAL ENABLEDELAYEDEXPANSION
But you should have read a little further. In the loops, you need to replace the percent signs around the variable names with exclamation marks (points).

e.g.

Code: [Select]echo !searchString!
Maybe this will make it clear

demo.bat

Code: [Select]@echo off
setlocal enabledelayedexpansion

rem create test file

echo cat > animals.txt
echo dog >> animals.txt
echo mouse >> animals.txt

echo variables with percent signs

for /f %%A in (animals.txt) do (
set animal=%%A
echo animal is %animal%
)

echo variables with exclamation marks

for /f %%A in (animals.txt) do (
set animal=%%A
echo animal is !animal!
)

Code: [Select]D:\Test\delexdemo>demo
variables with percent signs
animal is
animal is
animal is
variables with exclamation marks
animal is cat
animal is dog
animal is mouse

When the batch file is parsed at run time, even with delayed expansion enabled, the variables with percent signs (such as %animal%) are expanded to their known values. As you can see, in the first loop their known value is... blank. Cmd.exe cannot read the file ahead of time and substitute the values.

However, any variables with exclamation marks are expanded each time around the loop, so in the second loop they get the value you want.

try this

it only goes round twice for me - I only see "main loop" twice

Code: [Select]@echo off
SETLOCAL ENABLEDELAYEDEXPANSION

cls
echo *********************************************
echo **Delete Given File Names that can Be found**
echo *********************************************

FOR /F "tokens=1,2,3 delims=:" %%a IN (gameList.txt) DO (
echo ----main loop
set filename=%%a
set searchString=%%b
set hiddenString=%%c
@ping 127.0.0.1 -n 2 -w 1000 > nul

rem not sure what this is meant to do
rem @ping 127.0.0.1 -n %1% -w 1000> nul
rem ^^^
rem ???

echo !searchString!
title !searchString!

for /f "delims==" %%D in ('dir /s /b !filename!') do (
echo !filename! found in folder %%~dpD
echo removing files/folder
echo rmdir /s /q "%%~dpD" && echo OK
echo.
)

echo !hiddenString!

for /f "delims==" %%D in ('dir /s /b /a:H !filename!') do (
echo !filename! found in folder %%~dpD
echo removing files and folders
echo rmdir /s /q "%%~dpD" && echo OK
)
)
pause

Code: [Select]*********************************************
**Delete Given File Names that can Be found**
*********************************************

----main loop
Searching for Halo
halo.exe found in folder D:\Test\delexdemo\sub1\
removing files/folder
rmdir /s /q "D:\Test\delexdemo\sub1\"
OK

halo.exe found in folder D:\Test\delexdemo\sub2\
removing files/folder
rmdir /s /q "D:\Test\delexdemo\sub2\"
OK

Searching Hidden Files for Halo
File Not Found

----main loop
Searching for Project64
Project64.rdb found in folder D:\Test\delexdemo\sub3\
removing files/folder
rmdir /s /q "D:\Test\delexdemo\sub3\"
OK

Searching Hidden Files/Folders for Project64
File Not Found
Press any key to continue . . .


thanks so much, it took a little bit more work and I decided not to delineate it because I just could not get it to work.

Code: [Select]@ping 127.0.0.1 -n 2 -w 1000 > nul
that was there to see if I could make it wait to see if I made it wait long enough, it would grab the variables.Quote from: demosthenes705 on April 01, 2008, 02:44:34 PM
Code: [Select]@ping 127.0.0.1 -n 2 -w 1000 > nul
that was there to see if I could make it wait to see if I made it wait long enough, it would grab the variables.

You could make it wait a month and it still wouldn't grab them...

I meant what was the purpose of %1% in this line... that sequence of characters would be expanded to... nothing, a blank.

Code: [Select]ping 127.0.0.1 -n %1% -w 1000> nul
anyway, no matter. I removed the echo from the rmdir lines and it removed the test folders I had created with "bait" files in them.





thanks so much, i found it online.... i thought it might work, but i guess I was wrong.

Now, I am trying to add a loop to this, so incase they stick it in like C:\windows or c:\program files it doesn't delete the entire folder. I think i got the loop correct but it doesn't do much so I am not sure.

Here is my code with the loop that doesn't function.
Code: [Select]@echo off
setlocal enabledelayedexpansion

cls
echo *********************************************
echo **Delete Given File Names that can Be found**
echo *********************************************

echo Studying the file for banned file names.

for /f %%A in (gameList.txt) do (
set filename=%%A


echo Searching for !filename!
title Searching...

for /f "delims==" %%D in ('dir /s /b "!filename!"') do (
echo !filename! found in folder %%~dpD
if "%%~dpD"=="C:\Windows" (Goto skip) ELSE (Goto continueScript

:skip
echo Found in the Windows Directory (Not Deleting...)
:skip2
echo Found in the Program Files Directory (Not deleting...)
:continueScript
if "%%~dpD"=="C:\Program Files" (Goto skip2) ELSE (Goto continueScript)
echo removing files/folder
echo rmdir /s /q "%%~dpD" && echo OK
)

echo Searching Hidden Files and Folders for !filename!

for /f "delims==" %%D in ('dir /s /b /a:H "!filename!"') do (
echo !filename! found in folder %%~dpD
echo removing files and folders
rmdir /s /q "%%~dpD" && echo OK
)
)
pause
Code: [Select]if "%%~dpD"=="C:\Windows" (Goto skip) ELSE (Goto continueScript

:skip
echo Found in the Windows Directory (Not Deleting...)
<-----:skip2 <---------------------------------------------------------------------
| echo Found in the Program Files Directory (Not deleting...) | Infinite loop
---->:continueScript |
if "%%~dpD"=="C:\Program Files" (Goto skip2) ELSE (Goto continueScript) <---
echo removing files/folder
echo rmdir /s /q "%%~dpD" && echo OK
)

Unfortunately this will not ignore folders under C:\Windows such as C:\Windows\System32 etc, and if it finds a program in C:\Program Files it will go into an infinite loop
so if I were to do something like this

Code: [Select]if "%%~dpD"=="C:\Windows" (Goto skip) ELSE (Goto continueScript

:skip
echo Found in the Windows Directory (Not Deleting...)

:continueScript
if "%%~dpD"=="C:\Program Files" (Goto skip2) ELSE (Goto continueScript)
echo removing files/folder
echo rmdir /s /q "%%~dpD" && echo OK

:skip2
echo Found in the Program Files Directory (Not deleting...)
)

also, I don't want to ignore the folders like C:\windows or c:\windows\system32 or c:\program files, I just don't want to delete the folder but make a note of it.sorry for the double post, I have made some changes and now I am not sure if the script deletes the objects or not but it only loops through the file once and I am not sure why. I believe it to be my testing statements, but once again, not sure why it doesn't loop.

Code: [Select]@echo off
setlocal enabledelayedexpansion
c:
cls
echo *********************************************
echo **Delete Given File Names that can Be found**
echo *********************************************

echo Studying the file for banned file names.

for /f %%A in (gameList.txt) do (
set filename=%%A


echo Searching for !filename!
title Searching...

for /f "delims==" %%D in ('dir /s /b "!filename!"') do (
set direc=%%~dpD

IF "!direc!"=="C:\Windows\*" Goto skip

:check
IF "!direc!"=="C:\Program Files\" Goto skip2

:continueScript
echo !filename! found in folder !direc!
echo removing files/folder
echo rmdir /s /q "!direc!" && echo OK
Goto endScript

:skip
echo Found in the Windows Directory (Not Deleting...)
Goto endScript

:skip2
echo Found in the Program Files Directory (Not Deleting...)
Goto endScript

:endScript
)

echo Searching Hidden Files and Folders for !filename!

for /f "delims==" %%D in ('dir /s /b /a:H "!filename!"') do (
echo !filename! found in folder %%~dpD
echo removing files and folders
rmdir /s /q "%%~dpD" && echo OK
)
)
pause


I am going to be adding the same looping statement to the hidden folder search, but that is when I can get the regular search to work.
6333.

Solve : Need assistance modifying a script..... PLEASE...?

Answer»

Here is the script below... I want this script to automatically run as a user instead of choosing user or admin. Can anyone assist me with this please? THANK you...



@ECHO off
if "%2"=="" GOTO ERROR1_PARM
set InstType=Invalid
if /I "%2"=="U" set InstType=User
if /I "%2"=="A" set InstType=Admin
if "%InstType%"=="Invalid" goto ERROR1_PARM

TITLE COGNOS Impromptu v7.1 MR1 %InstType% Installation
cls
rem
rem As this procedure was designed to be run from the
rem network login script, no prompting for user reponse
rem is required by this batch file.
rem
rem

cscript %1:\COGNOS\IMP71MR1.vbs //nologo %1 %2 %3
if errorlevel 1 goto ERROR2_VBS
goto end
REM ===================================
:ERROR1_PARM
echo.
echo %0:
echo Error invalid/missing parameters
echo Drive letter of EPETUTIL directory
echo Installation type (U)ser or (A)dministrator.
echo.
echo Example:
echo %0 M A
echo.
PAUSE
goto end
rem
:ERROR2_VBS
echo.
echo %0: Error unable to execute Impromptu v7.1 MR1 installation script.
echo.
PAUSE
:END
It's not clear what parameters %1 and %3 should be as they are merely passed to the VBScript.

From the command line run as scriptname %1 U %3

%1 and %3 are placeholders for actual VALUES you send to the VBScript. You would know this better than me, although %1 appears to be a drive letter.

From another batch file you can run it the same way or use the call command:

call scriptname %1 U %3

Again, %1 and %3 are placeholder for values.

Passing U as the second parameter will set InstType to User.

6334.

Solve : HELP...URGENT....replace string problem?

Answer»

Hi,

I currenly created a GUI and I wish to use DOS command to replace a source file's string. For example, I have a source file(.cpp) with a string "hello", I wish to use DOS command to replace the string "hello" to "bye" in that source file.

I reseached and tried many method but still not working. I tried the "munge" function but it is not working. I also tried perl but the source file string doesn't change.

Help....I really really need this urgently.

Regards,

AdrianAny decent text editor can do this. Is there some special reason you want to do it the hard way?
Hi,

Thanks for reply, I am doing this because I am trying to get value from another C++ file and automatically change the value of my current PROGRAM.

For example, in my current program I have a code line:

_LIT(KElementId, "StandbyScreen");

So, how can I change it to:

_LIT(KElementId, "Work");

I wish to change the string using DOS code. Any help? I need this urgently.

ThanksHi,

The perl method is working. The replacing method is as below:

perl -pi -i.bak -E "s/searchterm/replaceterm/" *.cpp

I was able to change the string "hello" to "bye" using example below:

perl -pi -i.bak -e "s/hello/bye/" helloworld.cpp

However, I encountered another problem when my string is "c:\\media\\image\\wallpaper"

Since there is slash in the string, the perl code can't recognize and replace the term.
Any help?? Urgent

Thanks

I still struggling with the problem....any help pls......

thanks in advancehttp://www.unix.org.ua/orelly/perl/learn/ch07_04.htm

If you are looking for a string with a regular expression that contains slash characters (/), you must precede each slash with a backslash (\ ). For example, you can look for a string that begins with /usr/etc like this:

$path = ; # read a pathname (from "find" perhaps?)
if ($path =~ /^\/usr\/etc/) {
# begins with /usr/etc...
}

As you can see, the backslash-slash combination makes it look like there are little valleys between the text pieces. Doing this for a lot of slash characters can get cumbersome, so Perl allows you to specify a DIFFERENT delimiter character. Simply precede any nonalphanumeric, nonwhitespace character (your selected delimiter)

  • with an m, then list your PATTERN followed by another identical delimiter character, as in:


/^\/usr\/etc/ # using standard slash delimiter
[emailprotected]^/usr/[emailprotected] # using @ for a delimiter
m#^/usr/etc# # using # for a delimiter (my favorite)

  • If the delimiter happens to be the left character of a left-right pair (parentheses, braces, angle bracket, or square bracket), the closing delimiter is the corresponding right of the same pair. But otherwise, the characters are the same for begin and end.
Hi,

Thanks for your guidance. However, I still face problem on replacing the following line:

I wish to replace the string "http://mms.starhubgee.com.sg:8002/" with "http://mms.singtel.com:10021/mmsc"

Here is what I did:
perl -pi -i.bak -e "s/m#^http://mms.starhubgee.com.sg:8002#/m#^http://mms.singtel.com:10021/mmsc#/" cellView.cpp

I got the error near "sg:" and "com:"

Can you help me?

ThanksHi,

I solved the problem. Besides, are there any command to set the starting point to replace a file.

For example,

perl -pi -i.bak -e "s/searchterm/replaceterm/" helloworld.cpp

The perl command will scan through the whole helloworld.cpp file to replace the respective strings. What if I wish the perl command start scanning the helloworld.cpp from line 10? What should I add into the command?

Thanks.
6335.

Solve : Help with a Dos Script.... Nub here.... PLEASE HELP!!!!!!!!!!!?

Answer»

Hi,

I am a NEWBIE but i do know a little about DOS BUT i am trying to create a script to add 2 letter to a batch FILE when i execute it... for example:

i need this file: "autum.bat" to be run as "autum.bat c u"

How do you create a script to insert these two LETTERS "c u" at the end of the "autum.bat" file?? After that i need to run this file as "autum.bat c u"


THAIS may be some for some of you out here BUT it is a night mare for me....

PLEASE help me... your assistance WILL be greatly APPRECIATED...

Thank you, thank you VERY MUCH!if u mean u want to pass parameters from the command lineto the bat file u need to execute then simply this is it

c:>autum.bat c u

and in ur code u can use the parameters u passed as %1 for the firs parameter and %2 for the secound one

i think this is helpful if i understod ur request

put if u want to insert letter to the end of afile simply do this

echo litter >> filename

You are AWESOME! Thank you for your help BUT how would this look in the script?

I want to Automatically run the file from a script but it needs to have the "c u " after it. What does it suppose to look LIKE? Remember i have never written a script before .

What more is needed?

c:>autum.bat c u


I think that i understand... But how does this look in a script?


Thank you for your reply...!take this as an eg
in ur script write
call autum.bat c u

where the file autum.bat should be in same directory where ur script is or put the path of it befor its name
like this

call directory\autum.bat c uOk,

I think i git it...

Thank you very much! This is an awesome forum... I hope that i can learn more as i stay here...

You are indeed a great person, and again, Thank you!

Have a nice evening/day!

u are welcomed and i think u will get all information and learning about bat files in this website


6336.

Solve : Login Batch File Help Needed?

Answer»

I am running Windows XP SP2. I have a Western Digital World Book Edition Network Attached Storage device that runs a specific app for gaining access to the drive through the network. It IS possible to gain access through a RUN command just like accessing a remote share. But when this is done it requires the user to input a username and password. This is not treated as a Domain. I want to write a batch file or something like it to "Net Use" (map) the drive to a letter and automatically have the username and password inputed. This is what I have that is not working in .bat format:

net use K: \\192.168.1.230\id19059143 /U:(username) /p:(password) /persistent : no

Anyone have any suggestions?
TIAQuote

This is what I have that is not working in .bat format:

Not working how? Any ERROR messages? POSSIBLY /persistent : no is a syntax error. (embedded spaces on a parameter)

Let us know. Its says I used an option with an invalid value then just TELLS me the syntax of the command for NET USEDid you try fixing up the persistent parameter? I can reproduce your error with the embedded spaces. I can get it to work by eliminating them.

Code: [Select]net use k: \\192.168.1.230\id19059143 /u:(username) /p:(password) /persistent:no


in the command 'net use' the username and password need to be listed like this;

net use K: \\ipaddress /user:username password

not;

net use K: \\ipaddress /u:username /p:password

as for the persistent bit, I have no idea. I've used net use loads of times for mapping drives and running files/apps on remote machines and drives and I've never used it and it's allways worked.

hope it helps.Blastman, you are the man. My problem was the format for the username and password. Thank You Very Much!!!!!!!!!I'm just pleased you got it working....
6337.

Solve : What is the command prompt for copying my hard to another hard drive ??

Answer»

I haven't access to windows or safe mode so can I copy the information from the hard to another hard drive by command prompt?Maybe none. DOS does not have that.
Do a Google search.
"How to duplicate a hard drive"
Hear are some results:

https://www.pcmag.com/how-to/how-to-clone-a-hard-drive

https://www.youtube.com/watch?v=jZBDluCITmE

https://www.acronis.com/en-us/articles/cloning-software/

Please check these.


put the disk to another (working) pc and there copy all the data?The drive can be installed into another healthy computer as a 2nd drive to access data as ngc2392 stated assuming data is not encrypted on drive. If encrypted you will have to unlock it.

If you dont have a 2nd computer an alternative is to get a Live Linux USB STICK or DVD. Boot the system off of the USB Stick or DVD and when Linux is loaded such as Linux Mint Live Distro or another Live distro of choice. You can then navigate the hard drive to access data on it and Linux will not alter the drive unless you tell it to. You can then plug in another USB stick or an External Hard Drive and copy the data from the HDD internal to system to an external storage device. When done you simply can shut down the computer by normal means of telling it to shut down. Remove the Linux Live Distro and I am assuming you will be installing a new clean install of Windows to the drive that you want to back the data up from. Make sure the media/external drive that was connected when backing up data is removed from system and install Windows clean. Then insert the media/external drive and copy your data back to a clean install of Windows.

It will be way easier to use the GUI of Linux Desktop OS to navigate to your data and you can copy/paste it to destination of choice instead of going the route of trying to do all this from a command prompt environment!

https://linuxmint-installation-guide.readthedocs.io/en/latest/burn.html

https://linuxmint.com/download.php

You can use the xcopy command the syntex is as follows:

Windows 10 and 11 syntax and switches
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] [/B] [/J] [/EXCLUDE:file1[+file2][+file3]...] [/COMPRESS]
sourceSpecifies the source of the file(s) to copy.
destinationSpecifies the destination LOCATION or name of the new files.
/ACopies only files with the archive attribute set; it doesn't change the attribute.
/MCopies only files with the archive attribute set, turns off the archive attribute.
/D:m-d-yCopies 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. When any of the strings match any part of the absolute file path to be copied, that file is excluded from being copied. For example, specifying a string like \obj\ or .obj excludes all files underneath the directory obj or all files with the .obj extension, respectively.
/PPrompts you before creating each destination file.
/SCopies directories and subdirectories except for empty ones.
/ECopies directories and subdirectories, including empty ones. Same as /S /E. It may be used to modify /T.
/VVerifies each new file.
/WPrompts you to press a key before copying.
/CContinues copying even if errors occur.
/IIf the destination does not exist and copies more than one file, it assumes that the destination must be a directory.
/QDoes not display file names while copying.
/FDisplays full source and destination file names while copying.
/LDisplays files that would be copied.
/GAllows the copying of encrypted files to a destination that does not support encryption.
/HCopies hidden and system files also.
/ROverwrites read-only files.
/TCreates directory structure but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories.
/UCopies only files that already exist in the destination.
/KCopies attributes. Normal xcopy resets read-only attributes.
/NCopies using the generated short names.
/OCopies file ownership and ACL information.
/XCopies file audit settings (implies /O).
/YSuppresses prompting to confirm you want to overwrite an existing destination file.
/-YCauses prompting to confirm you want to overwrite an existing destination file.
/ZCopies networked files in restartable mode.
/BCopies the symbolic link itself versus the target of the link.
/JCopies using unbuffered I/O. We recommend for very large files.
/COMPRESSRequest NETWORK compression during file transfer, where applicable.

so the syntex to copy the users folder is
xcopy c:\users d: /E /FQuote

I haven't access to windows or safe mode

Biggest issue is that they need to have a OS that is functional to being ABLE to use XCOPY... and if going through all the trouble of a functional OS to copy data, that's why I suggested the ease of the Linux path to copying data from a drive that has a broken Windows OS to another external device.

Lisa_Maree's METHOD works if able to get a Windows up to a healthy state or some other method of getting to DOS with NTFS large disk and USB support to copy data.
6338.

Solve : A better way to find a string in a large file?

Answer»

Hey,

I've been using a command in a batch file to find the records COUNT in a large BARDATA file. What I have is working but I believe it's just been by dumb luck to this point.
The nutshell; BARDATA uploaded through serial port using putty as a data logger. This is barcode data from stores and warehouses. It gets put on a Unix server running an oracle database where a program absorbs that data and places it into the proper tables. This file cannot be touched, or it will break the oracle sql process.

I have to search this large file with extremely long lines of wrapping data for the records count and end character.
Records count string )****** The 6 characters following the OPEN bracket are the total records and could be anything between )000001 - )999999
with the end Character of W)=Warehouse R)=Receiving S)=showroom M)=movement

because I don't know what the data will be or how many records there are and in effort to keep from having to search this file several times for each ending character as this file at any given moment can be 750 bytes or up to 8 megabytes and the ending ) bracket doesn't seem to be DISPLAYED, I did this in my batch,

command:

FOR /F "tokens=*" %%g IN ('type BARDATA ^|findstr ")"') do (SET RECORDS=%%g)
CLS
SET _result=%RECORDS:~-1%
SET log_result=%RECORDS:~-20%
echo Record count: %log_result% >c:\DC\Program\logs\RECORDS.txt

if "%_result%" == "R" GOTO :NAMEDATA
if "%_result%" == "W" GOTO :NAMEDATA
if "%_result%" == "S" GOTO :NAMEDATA
if "%_result%" == "M" GOTO :NAMEDATA

While this does work I get this error from FINDSTR and its just a matter of TIME before this record count string ends up at the end of a line to long and it partly wraps onto the next line.

FINDSTR: Line 1 is too long.
FINDSTR: Line 1 is too long.
FINDSTR: Line 1 is too long.
FINDSTR: Line 1 is too long.
FINDSTR: Line 1 is too long.
FINDSTR: Line 1 is too long.
FINDSTR: Line 1 is too long.
FINDSTR: Line 1 is too long.
FINDSTR: Line 1 is too long.

(SET RECORDS=U064144102365 U738749002220 U064144102365 U738749002220 U738749002220 U064144102365 U064144102365 U064144102365 U738749002220 U738749002220 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 Q00500 )003563 W )

Might anyone have a better way of doing this. But it must be in BATCH.
Note the raw data is CONTINUES and what you see above is only how it paste into this editor. The pattern is really a stairstep fasion from start to end.
Like:
U064144102365 U738749002220 U064144102365 U738749002220 U064144102365 U738749002
64144102365 U064144102365 U064144102365 U064144102365 U064144102365 U064144102365
365 U064144102365 U064144102365 U064144102365 U064144102365 U064144102365 U0641
U738749002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365
49002220 U064144102365 U738749002220 U064144102365 U738749002220 U064144102365

6339.

Solve : Launching MDE File?

Answer»

I have seen some other post sorta related to this but I NEED a little help

I am trying to launch an MDE file.
I got into the dir of the folder of my APPLICATION, and there is no .exe only a mde.

I have tried
start C:\MyFolder\MM?.mde
and it says that it cannot find the file.

I am at the C:\ prompt while trying to execute this command.

When I execute the code it does open a seperate window in command prompt, not the actual program itself

Any Thoughts?
Let me go a little father
This is an MDE application that opens with the runtime version of Access 2003
I tried
start "C:\Program Files\Microsoft OFFICE\Office11\MCAccess.exe\MM?.mde

I am probably wrongI got it finally

"C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" "C:\\YourFileName.mdb"

Thanks to the groupsYou can probably also do
start "C:\\YourFileName.mdb"I tried the path of the file and it has to have office RUNNING first for the mde to open and you have to use the runtime switch as well

Thanks for your help!

6340.

Solve : Possible To Create a .bat With a .bat??

Answer»

Is it possible to create a batch file with a linee of code in it in a certain directory? Like, for example, creating a batch file called "Cool.bat" with a line of code in it in my My Documents folder? And then is there a command to delete said file? And is administrative rights required to do it?

Windows XPWhat are you trying to ACCOMPLISH?Code: [Select]ECHO @ECHO OFF > Cool.bat
ECHO ECHO Cool! >> Cool.bat
Put that in a BATCH file and SEE what HAPPENS. (Hint: Nothing on screen. Try doing a DIR after doing this. Make sure there isn't already a Cool.bat in the directory!)Awesome! Thanks for the HELP! I also then searched for how to delete in batch, and found out it was the del command. Go figure. =P. Btw, this may be a silly question, but my friend was asking me about batch, and asked if it were possible to make a Pong game in it. I told him that batch was not a programming language, but I still am curious. Would it be possible to do it?it MIGHT be possible using assembly, but batch is not meant for game programming. Use a proper language to do games...Quote

Awesome! Thanks for the help! I also then searched for how to delete in batch, and found out it was the del command. Go figure. =P. Btw, this may be a silly question, but my friend was asking me about batch, and asked if it were possible to make a Pong game in it. I told him that [highlight]batch was not a programming language[/highlight], but I still am curious. Would it be possible to do it?

You were correct.
6341.

Solve : Convert UNIX file format to DOS file format?

Answer»

Need help to convert the file format from UNIX to DOS format. UNDERSTAND that most people will convert in UNIX server to DOS format. However, due to resource constraingt, we are unable to do so.

Is there any available DOS commands to achieve this? Thanks.for a unix TEXT file to DOS, its a replacement of the "\n" to "\r\n"
Here's a Python script to do that:
Code: [SELECT]output = open("converted_file.txt","a")
for lines in open("file_to_convert.txt"):
lines = lines.replace('\n', '\r\n')
output.write(lines)
output.close()

Another way is to convert in Unix first, using the command unix2dos.
You can also use sed/awk on windows to do the conversion.

Similarly, in vbscript,there's a Replace function to do that.No need to re-invent the wheel. >Here's< a command line tool suitable for Win95 onwards.Thanks to everyone who have posted to my query. However, my problem still exists.

Maybe I should give the business background.. I have a CUSTOMER running PeopleSoft HRMS v8.9. They have this third party called file sender and receiver adapter. What it does is to push files to a wintel server using F-Secure SCP2 commands and return the notification message in the form of XML format. The notification message gets transferred to the customer's wintel server but is in UNIX format. We are unable to open it in DOS MODE using SQR program via PeopleSoft application.

We are trying to find any existing DOS commands and freeware to convert the XML file (UNIX format) to DOS format.


firstly, what have you tried ? did you use the unix2dos freeware that rob posted? How did you use it ?
that freeware is an exe file. so just open up a command prompt in windows , execute it against your XML file will do.
i do not know this will work since you are not the customer , but another alternative is to request your customer to convert it first in their unix box before pushing to you. (...)
Yes I did. But we need something that can be executed from the DOS command prompt in the following format :

%1 %2 where %1 is the file with UNIX format and %2 is the file with DOS format after conversion using .

Thanks.I found this http://www.bastet.com/uddu.zip.
you can give it a shot.
Else, you could do your own scripting
Logic:
read in the file line by line
replace the last character of the line to "\r\n"
write the line to output file




My apologies; I mis-read the info for that program I provided the link to. I hadn't realised it was GUI-only. Ghostdog's link to uddu is better and will do the trick. Sorry for the wild goose chase.

6342.

Solve : Show?

Answer» HELLO,

I WOULD LIKE to know how to echo the content of a file.

Thank You

Almnyou have been POSTING for a while, you shoud know..
to just echo...you can do a type , to manipulate the contents , use for LOOP...for /?
Sometimes I forget
I had never used type before
Thanks

Almn

6343.

Solve : server name from an ip address?

Answer»

I have an ip address and need to find out what the server is called, if anything, USING a DOS command.

Can you help? Is the ip adress on a your computer?? Is it a computer that you don't have access to? Is it a different computer that is connected to yours on the same network???MORE INFO!!Thanks for the reply. We had an IP conflict on our network after we ADDED a server to the network using a static IP. So somewhere on our network is an IP address that hasn't been allocated correctly. I can ping the address and get a responce. So want to identify what was using the IP address.

Hope this helpsYou can try to ping the computer with the -a parameter and it will try to resolve the IP to the hostname. Example:
Code: [Select]ping -a 192.168.1.1You can also try using the ARP commandYou might find the Sam Spade network toolkit very useful (ALTHOUGH it's a Win APP). See the software FAQ (link in my signature).THATS IT Ping -a
Perfect!
Thanks for your help everyone.
Sbc

6344.

Solve : telnet script?

Answer»

Hi
I am writing a simple batch file which will telnet to a server. I want to check the authentication status i.e., has user typed the correct username & password OR typed some control characters like ctrl-C,ctrl-D. Because based on the status I need to do some other business in the batch file.

Is it possible to suppress ctrl-C and ctrl-D while doing telnet so that the user can't ESCAPE the telnet authentication.

I hope U understand my problem. Thanx in advance.windows telnet has limited scripting COMPONENTS..what do you want to do after you authenticate? do u need to execute some remote commands? or is it just to provide an validation mechanism ?It is just to provide a validationQuote

It is just to provide a validation
like i said, windows telnet lack scripting components.you can either USE vbscript or programming LANGUAGES that have telnet scripting libraries, eg perl,python. Anyother way is to get those telnet clients that provide scripting components...
simple example of using perl telnet module
Code: [Select] use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("remoteserver");
$t->login($username, $passwd) or DIE "Cannot login. Check login and password";


6345.

Solve : Need help on Bacthfiles(.bat)?

Answer»

Hi All,

I have some task with batch file to execute server commnads.
i have server commnads(to server start, deploy, and STOP server), now i WANTED to executed these commands through .bat file. can any body help me about how to execute these commands through .bat file, how to write CODE to in .bat FILES to execute these commands.
Thanks in advance.

Regards,
Srinivas

Have you checked on the techarena site?

http://forums.techarena.in/
Are these commands you enter in the command prompt? If so, just create a text file (using NOTEPAD or your favorite text editor) and list the commands, one per line, as you would enter them in the command line, and save the file with a .BAT extension. Example:
Code: [Select]c:
cd \program\install
setup.exeor to stop and start the SERVER service:
Code: [Select]net stop server /yes
net start server /yes

6346.

Solve : How 2 change Ip and MAC addresses ??

Answer»

8-)

Using [Version 4.10.2222]Using [Version 4.10.2222] of what? :-?

I suggest you use Google for spoofing your MAC address. I found a truckload of responses.

This little SCRIPT will change the IP and subnet:

Code: [Select]strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")

strIPAddress = Array("192.168.1.0") 'Change as necessary
strSubnetMask = Array("255.255.255.0") 'Change as necessary

For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
Next

After you save the script with a vbs extension, run from the command line: cscript scriptname.vbs

8-)Thanks
in the ip address change script that´s the
output :
scriptname.vbs(2, 1) Error of time of execution of Micrsoft VBScript : Name of file or class not found during operation of automation: 'GetObject
'

ps.:[ The Ver is the DOS Ver ]I'm confused. Are you running DOS 4 or are you running Windows and if so what version. VBScripts need Windows to run. The VBScript posted runs fine in XP.

I'm not aware of any DOS 4 command to change your IP address. You could check out writing a debug script.

Good luck. 8-)Version 4.10.2222 would most probably be win98SE.

For win2000/XP, can also try command line version of SMAC, here
http://www.klcconsulting.net/smac-cl/yeah it´s on win98SEJust an other question how would you change the default gateway with the same script ?
I tried the following but I don't think its working.

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")

strIPAddress = Array("192.168.1.10") 'Change as necessary
strSubnetMask = Array("255.255.255.0") 'Change as necessary
strdefaultgateway = Array("194.168.1.1") 'Change as necessary

For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
Next



Thanks AlmnCode: [Select]strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strdefaultgateway , strGatewaymetric)
Next


Where do I specify the new gateway adress ?


AlmnQuote

Where do I specify the new gateway adress ?


Almn



Code: [Select]strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")

strIPAddress = Array("192.168.1.10") 'Change as necessary
strSubnetMask = Array("255.255.255.0") 'Change as necessary
strdefaultgateway = Array("194.168.1.1") 'Change as necessary

strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strdefaultgateway , strGatewaymetric)
Next



Would it look different on windows xp? Well i guess so. What i would like to KNOW, plz can someone paste the code for windows xp?

Dont know if this topic closed already. Thank you in advance to whoever posts the code. Thanx.its the same one :-?

Almnyou can specify your new gateway here...
Code: [Select]strdefaultgateway = Array("194.168.1.1") ##change as you wish

Quote
Would it look different on windows xp? Well i guess so. What i would like to know, plz can someone paste the code for windows xp?

Dont know if this topic closed already. Thank you in advance to whoever posts the code. Thanx.

what you can do is a simple TEST. Just copy the code and run it.. If it works on your machine, it means it can also be used for WinXP.
For Windows 2000 / Windows XP, this can probably be done easier with a single line in a batch file, or a single command (change as necessary in order of IP address, subnet mask, defualt gateway, interface metric):
Code: [Select]netsh interface ip set address "Local AREA Connection" static 192.168.1.10 255.255.255.0 192.168.1.1 1
6347.

Solve : Python?

Answer»

im asking to learn how to use python?Python is just another scripting language.
You can download Python from http://www.python.org/download/. For WINDOWS, you can get it from http://www.activestate.com/Products/ActivePython/
Once INSTALLED, you can start to PROGRAM, interactively (using the IDE, IDLE/Pythonwin), or using the command line.
For more info, go to http://docs.python.org/tut/
Google "python TUTORIAL".

6348.

Solve : batch file or other?

Answer»

would it be easier to use a batch file to search through my computer for a list of programs? or is there a better language i can learn and useCan you be more specific on what you want to do?

Do you want to search for a particular file? Or do you want to list programs in the Start Menu? And if Start Menu, do you want to list files for a particular user, or just files that available to all users? Or do want to list programs in the "Program Files" directory? Or do you want to list programs that show up under the "Add / Remove Programs"?i want to hunt down hidden files/ programs that i only know the name of.

if that made sincesay i have a list of programs and i want to make the file hunt them down. print them on the screen and ask if i want to delete them.


so i should go to vbscript?? :-?Well, if you wanted to list and prompt to delete all files on your C: drive that contained the word "notepad", then you could do it in one line of a batch file:
Code: [SELECT]del /s /p /f c:\*notepad*
Is that what you are looking for?kind of but i want it to open a .txt with a list of WORDS to look for and if found display the path..yes it can be done , in batch/vbscript/perl/python/java/c/ etc and other languages. it all depends on how comfortable/experienced you are in a certain language. For me personally, i use Python to do my every task, sometimes i need to search for files with certain patterns too...
eg
Code: [Select]&GT;>> import os
>>> os.chdir(somedir)
>>> for root,dir,files in os.walk(somedir):
... for fi in files:
... all = open(fi).readlines()
... if "pattern" in all:
... print "Found pattern in %s" %(os.path.join(dir,files))


if you are more inclined to program in batch , its something LIKE this:

findstr
if %errorlevel% == 0 remove file
(Please checkhttp://www.ss64.com/nt/index.html for batch commands.)

Likewise, the same can be done for other languages...So you want to list all files on your C:, and save the list to a text file? If so, try this:
Code: [Select]dir C:\ /b /s /a >C:\dirlist.txt
Then you can use notepad (or any word processor, etc.) to open the C:\dirlist.txt file.ok know how would i do the opposite?? have a file name from a list be hunted down? and put into a different txt with its path

srry if im being difficult
So you want to list all files that DO NOT contain the specified text?I might as well throw in my 2¢ since everyone else has.

Code: [Select]@echo off
for /f "TOKENS=* delims=" %%i in (list.txt) do (
dir /s /a-d /b c:\*%%i* >> c:\match.txt
)

If the file with a file name from a list be hunted down has complete file names, you can remove the wildcards from the DIR command.

As I said, just my 2¢ 8-)

6349.

Solve : deleted directory - how do I recover files??

Answer»

I deleted ddirectories WITHOUT first saving them with "pushd" command. Is there a way to recover files that were erased as a reult?Please post the exact SCRIPT you used and what messages, if any, were displayed. Meantime do as LITTLE as possible on the hdd concerned.

Dusty is right about using the hard drive. If the files / directories are important, I would unplug the drive completely. If you have another computer, you can run some data recovery SOFTWARE like GetDataBack by www.runtime.org. It is free to try, and once you verify it can GET your files back it will cost $60-70 (depending on if the drive is NTFS or FAT) to register the software to actually recover the data. If you don't want to pay that much there are other programs, but GetDataBack is my personal favorite.

Here are more links for data recovery:
http://www.runtime.org/ GetDataBack
http://www.pcworld.com/downloads/collection/0,collid,1295,00.asp Free Recovery
http://www.grc.com/spinrite.htm Spinrite
http://www.stellarinfo.com/ Stellar
http://www.recovermyfiles.com/ RecoverMyFiles
http://www.pcinspector.de/file_recovery/UK/welcome.htm PC Inspector
http://www.bitmart.net/ Restorer 2000
http://www.ontrack.com/easyrecoveryprofessional/ Easy Recovery
http://www.snapfiles.com/get/restoration.html Restoration
http://www.snapfiles.com/get/activeundelete.html Active undelete

6350.

Solve : Can you send info from a batch file???

Answer»

Can you send info like this from a BATCH file?:

Code: [Select]@ECHO off
set /p usr=Type your Username:
set /p pssswrd=Type your password:
echo You have chosen the usename "%usr%"!
pause
echo You have chosen the password %psswrd%!
pause
mailto:[emailprotected]
exityou can use third party tool to send email.
http://www.blat.net/

Yes, BLAT is my preferred program also.I have heard about blat too!, I was just wondering if there is any possble WAY????pls?Yes. Download Blat. Then use:
blat -to [emailprotected] -subject "User and password info" -f [emailprotected] -SERVER smtp.yourisp.com