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.

2551.

Solve : all,Task Scheduler?

Answer»

Hi all,

How can I create a batch file that would restart the COMPUTER that is scheduled but the timer would restart whenever the user opens a certain file like notepad. So the counter would be like scheduled an hour from now and then when the user opens notepad, the timer would restart to add ANOTHER hour before it restarts. If you are wondering why... I SOMETIMES sleep in front of my computer. Imagine how sticky my keyboard is! Also, this batch file is active, somewhat looping and never ending... I don't want to USE resource kits.

I'm starting at this command:

tasklist | find /i "notepad.exe"
if errorlevel 1 *the batch file that would schedule the restart
tasklist | find /i "iexplorer.exe"
if errorlevel 1 * the scheduled timer would reset and the new restart sched

If there is another way, that would be great!


ECHO
Check out the AT command for adding and deleting jobs from the task scheduler. For the restart you can use the SHUTDOWN command with the proper switches.

Questions:

1) Why don't you want to use the resource kits? There is a lot of functionality in them and they are free to download and use.

2) Should it not be if not errorlevel 1?

Just a thought. 8-)

2552.

Solve : i want to hide batch window?

Answer»

i want to hide batch WINDOW while runing what is the command A few possibilites pop to mind:

1. RIGHT click the file and change the properties to run minmized

2. Use the START CMD with the /B and /MIN switches

3. Launch the file from a VB Script using the Run method of the Shell object. Get details at:

http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

Note: I'm pretty sure that if any console messages are ISSUED during execution, a window will be forced open.

Hope this HELPS.

2553.

Solve : RUNAS command?

Answer»

I just have a quick question here. I am working on a BATCH file to fix a current problem on my network, and i'm running into a roadblock. I'm trying to use the RUNAS command to run a file as an administrator for it to work properly, and i was wondering if there is a WAY to have the admin password inputted automatically when prompted to. I'm running Windows 2000 server and windows 2000 professional for the workstations. Any help is going to be greatly appreciated. Thank you.This might work...It isn't COMPLAINING to me on runas syntax errors or authentication when swapping out the UserName with a valid user name and Password with my local password for that admin user. My one Windows 2000 system in my stack of computers launches the program mspaint.exe under the local admin privileges. I grabbed this off of a google hit, and added for mspaint.exe to launch. I also added the Pause to see if there are any complaints vs having the shell window close.

@ECHO OFF
SET USERNAME=UserName
SET PASSWORD=Password
ECHO %PASSWORD%|runas /user:%USERNAME% %~1 |mspaint.exe
echo on
pause


*** This is dangerous though, if KEPT in batch form because the password will be not encrypted and wide open ***

If you need security with the runas in a batch, I would use a Batch *.Bat to Executable *.EXE compiler to give it al least some defense from being able to be opened with a text editor etc.

http://www.softpedia.com/get/System/File-Management/Batch-To-Exe-Converter.shtml


Hope this works as it should according to the google hit ..... Dave

2554.

Solve : batch file to change XP pro policy?

Answer»

hi , need a batchfile that can change the policy setting/

controlpanel>administrativetools>Local security policy>local policies>security options>Network access : Sharing and security model for local accounts , by default this are set to guest only .. but i need them to change to Classic. is there any way a batchfile can do this? can you guys help me with this?pleaseYour movies suck.. just wanted to say.Ahh, I see you've met our resident movie critic . For Group Policy you need to write a script. Check out

http://www.microsoft.com/technet/scriptcenter/findit.mspx

This site has links and examples that should give you some ideas.

Good luck. hey sidewinder ... thankyou for your help .. the site really helped. its actually the same as to disable the simple file sharing.
I got a code here to disable simple file sharing ... but i cant seem to get it work on any winXP machine. could you take alook at the code. how can i change the code so that it would work on any XP pro machine.

@echo off
If {%1}=={} @echo Syntax: NoSFS ComputerName1 [ComputerName2 ... ComputerNamen]&goto :EOF
setlocal
:Next
if {%1}=={} endlocal&goto :EOF
set computer=%1
shift
set computer=%computer:"=%
set key="\\%computer%\HKLM\SYSTEM\CurrentControlSet\Control\Lsa"
if /i "%computername%" EQU "%computer%" set key="HKLM\SYSTEM\CurrentControlSet\Control\Lsa"
@echo reg add %key% /v forceguest /t REG_DWORD /d 00000000 /f
reg add %key% /v forceguest /t REG_DWORD /d 00000000 /f
@echo.
goto :Nextalso i can disable the simple file sharing if i make a registry file and add them. this is the code

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"forceguest"=dword:0

can i make a batch file with it???A reg file can only be used on the local machine. Scratch that idea.

Your batch file works fine on my machine. I suspect that if you were testing on your local machine, the IF statement failed because string comparisons are case sensitive. You can check that by turning @echo on and watch your file run.

Did you get any error messages, or did the logic just fail to produce the correct result?

Let us know.

Good luck. .

PS. You don't need this LINE: set computer=%computer:"=% yes ur right ... i am testing on a local machine ... i got incharge on deploying antivirus to all the users in my network. all are winxp and 2k. only winxp i have to disable the simple file sharing. im not using AD or domain server. so i tought just email this batch file and ask the user themself to double CLICK them so it would disable simple file sharing.
I got a registry file working ... but with a prompt like error will make the users paranoid . so i tought better to do a batch file.

so this is what i did ....




with echo on



how to change this so it will run on local machine when user double click them?SOMETIMES we miss the forest for the trees. The batch file is fine, just pass a computer name on the COMMAND line. (ex. NoSFS computername). You can update all the machines provided (1) the remote machine(s) share bit is ON and (2) your local machine name is entered in CAPS. (ex. NoSFS computername1 computername2 LOCALMACHINE...)

If you want each user to be able to doubleclick the file, modify the original:

@echo off
setlocal
set key="HKLM\SYSTEM\CurrentControlSet\Control\Lsa"
@echo reg add %key% /v forceguest /t REG_DWORD /d 00000000 /f
reg add %key% /v forceguest /t REG_DWORD /d 00000000 /f
endlocal
@echo.

Personally I like your version better. You can control the results better and doesn't depend on other users.

Hope this helps.


yep it helped. thanks so much for your help sidewinder. you saved me.

2555.

Solve : NoteBook black screen on reboot after flashingBIOS?

Answer»

Ok, my brother owns a Excel G736 Laptop and he had been having trouble with the graphics in the machine flickering and going funny, so i told him to look up the manufacturer website for the mobo drivers and see if there was new drivers and BIOS. Here is the specs on the machine :

http://www.ecs.com.tw/ECSWeb/Products/ProductsDetail.aspx?MenuID=18&LanID=0&DetailID=363&DetailName=Specification

So he downloaded the 2 latest BIOS upgrades for his comp which came with the AMI Flash utility and he contuined to instal the earlier version FIRST instead of the latest because the earlier BIOS upgrade had a upgrade for his video card which is a M11 and not the M10.

Now, once he unzipped everything and started the Flash utility program, he NOTICED that the Flash utility was asking for a .rom FILE and the one he had downloaded was a .BA6 file, so he used it anyway. Now he is stuck with a Black screen every time he reboots his laptop, and he has no floopy drive in the thing to boot from a floopy.

Was wondering if we could get any help here please and also, any information on the right or correct procedure on how to flash this machines BIOS WOULD be very much appreciated.

Thank youwell>>http://www.orphanlaptops.com/bios.htm

2556.

Solve : Restarting widnows with a batch file?

Answer»

I WANT a batch file that will restart my computer ten times then stop. Is This possible if so how is it done?restart 10 times why? for what reason.. a little more detail and i might help u out..You could use a batch file to restart once (I don't THINK batch files can keep track of the number of times you have restarted, but feel free to correct as necessary) but it WOULD be a lot easier using a language such as VB or C(++) where you could make the appropriate calls or execute the shutdown (NT/XP) command. This would allow you to keep track of the number of times you have restarted in a file.

You would start the cycle by putting a link to the program in the Startup folder on the start menu.

At least that's how I'd do it...

Anyway, 10 times... why?I'm going to use it for computer repairs. When a computer comes into the STORE and it has boot problems. Thanks ill try doing it in VB.I don't think VB or C would be any easier than a batch file for this task ... at least not for Windows XP / 2003 / Vista. Try this:
Code: [Select]@echo off
if not exist C:\RebootCount.txt echo 1 >C:\RebootCount.txt
for /f %%a in (C:\RebootCount.txt) do set Reboots=%%a
if 0%Reboots% GEQ 10 goto :Done
set /a new=1+%Reboots%
echo %new% >C:\RebootCount.txt
shutdown -r -f -t 15 -c "Reboot number %Reboots%"
goto :EOF

:Done
del C:\RebootCount.txt
echo Reboots complete. Please remove Reboot batch file from Startup group
pause
Create a batch file with the code above, then copy it (or create a shortcut to it) to the Documents and Settings\All Users\Start Menu\Programs\Startup directory. Do the first reboot yourself, and it should take over from there.here is a code to restart newer Windows.

It wont restart 10 times but it will restart your computer for you.

SHUTDOWN -r -t 01
exit
Quote

I don't think VB or C would be any easier than a batch file for this task ... at least not for Windows XP / 2003 / Vista. Try this:
Code: [Select]@echo off
if not exist C:\RebootCount.txt echo 1 >C:\RebootCount.txt
for /f %%a in (C:\RebootCount.txt) do set Reboots=%%a
if 0%Reboots% GEQ 10 goto :Done
set /a new=1+%Reboots%
echo %new% >C:\RebootCount.txt
shutdown -r -f -t 15 -c "Reboot number %Reboots%"
goto :EOF

:Done
del C:\RebootCount.txt
echo Reboots complete. Please remove Reboot batch file from Startup group
pause
Create a batch file with the code above, then copy it (or create a shortcut to it) to the Documents and Settings\All Users\Start Menu\Programs\Startup directory. Do the first reboot yourself, and it should take over from there.


thank you GuruGary you are god in dos scripting Quote
I don't think VB or C would be any easier than a batch file for this task ... at least not for Windows XP / 2003 / Vista. Try this:
Code: [Select]@echo off
if not exist C:\RebootCount.txt echo 1 >C:\RebootCount.txt
for /f %%a in (C:\RebootCount.txt) do set Reboots=%%a
if 0%Reboots% GEQ 10 goto :Done
set /a new=1+%Reboots%
echo %new% >C:\RebootCount.txt
shutdown -r -f -t 15 -c "Reboot number %Reboots%"
goto :EOF

:Done
del C:\RebootCount.txt
echo Reboots complete. Please remove Reboot batch file from Startup group
pause
Create a batch file with the code above, then copy it (or create a shortcut to it) to the Documents and Settings\All Users\Start Menu\Programs\Startup directory. Do the first reboot yourself, and it should take over from there.





Thanks It worked GREAT.
2557.

Solve : I need Help!!!!?

Answer»

How can i force DELETING of read-only files?
im sure it is a trojan but imposible to cleane it. Hidden in dat files.
NEED to delete C:\_restore carpet
How can i do?

Please, i need help!!!!TURN off SYSTEM restore, reboot, run AV to make sure its gone, reennable system restore.Thanks 2k dummy
I do it and trojan vanished.
Scan with my AV (Anti Virus, isn`t it?) and find nothing.
Thanks a lot!!!

2558.

Solve : VB-Script Need Help?

Answer»

i want to put a file in the regedit= "C:/Xtm.exe" and im wondering if its possible to have an *.bat extension?
i want to put the files under "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Run"


the boot registry directory correct my spelling Generally this has to do with how you want to accomplish the TASK. If you want to write a batch file, CHECK out reg add /? from your COMMAND prompt.

If you want to write a VBScript, check out this article New Registry Key, SAVE your script with a vbs extension. VBScripts can be run in a command window using either cscript or wscript as the processor: cscript scriptname.vbs

Before making any changes to the registry be sure to make a backup. It's possible to hose a system changing the registry manually, a script can hose a system LIGHTNING quick.

Good luck. 8-)Quote

Generally this has to do with how you want to accomplish the task. If you want to write a batch file, check out reg add /? from your command prompt.

If you want to write a VBScript, check out this article New Registry Key, save your script with a vbs extension. VBScripts can be run in a command window using either cscript or wscript as the processor: cscript scriptname.vbs

Before making any changes to the registry be sure to make a backup. It's possible to hose a system changing the registry manually, a script can hose a system lightning quick.

Good luck. 8-)




Thank you! 8-)
2559.

Solve : I'm trying to understand the process?

Answer»

What is wrong with the following bat FILE PLEASE.
@echo off
:begin
cls
choice /n /c:123456789 pick a number (1,2,3,4,5,6,7,8,or 9)
rem - the next lines are dependent on keyboard input
if errorlevel 9 goto nine
if errorlevel 8 goto eight
if errorlevel 7 goto seven
if errorlevel 6 goto six
if errorlevel 5 goto five
if errorlevel 4 goto four
if errorlevel 3 goto three
if errorlevel 2 goto two
if errorlevel 1 goto one
goto end
:nine
echo You have PRESSED Nine
goto end
:eight
echo You have pressed Eight
goto end
:seven
echo You have pressed Seven
goto end
:six
echo You have pressed Six
goto end
:five
echo You have pressed Five
goto end
:four
echo You have pressed Four
goto end
:three
echo You have pressed Three
goto end
:two
echo You have pressed Two
goto end
:one
echo You have pressed One
:end

I have spent a number of hours trying to make it work.
You will know that it is a variation on one of your files, and that is why I cannot understand why it will not work.
Hope you can help.
Kind regards.
RonI RAN your code and it WORKS properly. Perhaps you might tell us in what way it doesn't work for you. Also mention your OS and any error messages you are getting.

8-)Thank you for your prompt reply.
The problem was, and I feel rather silly, I saved the prog as "z" and not "z.bat"
It seems to be a common problem with me, either I'm forgeting the space or dot or something so simple. :-?
Thanks again.
RonThe command CHOICE does not exist in Windows prompt window
use the command =

[highlight]@echo off
SET /P choice="PICK A NUMBER (1, 2, or 3)"
IF "%choice%"=="1" GOTO ONE
IF "%choice%"=="2" GOTO TWO
IF "%choice%"=="3" GOTO THREE
[/highlight]

Thank you again.
Ron

2560.

Solve : Error/File already Exists?

Answer»

Hello, I recently had to pay a company 1000.00 for 1 hour consultation to fix a problem I had with ONE of my programs. They were able to fix the problem but the problem is it is now suppose to be a totally automated hands free operation which runs every morning around 7:45. The entire process does work but only if Im at the computer or remotely logged in to "PRESS any key to continue" 3 or 4 times to finish the process. I ran out of time on the consultation Im not a DOS person and do not have time to really teach myself. In any case I RECEIVE a file daily and it has to go through a "prebatch" and then a "postbatch" process. here is what Im ACTUALLY seeing:





Number =355

A subdirectory or file C:\Edgp already exists
A subdirectory or file C:\Edge\in already exists
A subdirectory or file C:\Edge\out already exists
A subdirectory or file C:\EDIIMPTS already exists
A subdirectory or file C:\BACKUP.EDI already exists
A subdirectory or file D:\BACKUP.EDI\EDI-IMPT already exists
A subdirectory or file D:\BACKUP.EDI\EDI-RECV already exists
A subdirectory or file D:\BACKUP.EDI\EDI-SEND already exists
A subdirectory or file D:\BACKUP.EDI\INBOUND already exists
A subdirectory or file D:\BACKUP.EDI\OUTBOUND already exists

ERROR: File impt355.edi already exists--
Edit C:\Edge\EX_P\Setlast to the last sequence # used plus 1 and try again

basically this error appears for each one of the subdirectory's and I can hit any key
to continue and it will finally finish the job but really would like to fix this somehow.Quote

<Prebatch>
<Setlast>
<Setlast>

Number =355

A subdirectory or file C:\Edgp already exists
A subdirectory or file C:\Edge\in already exists
A subdirectory or file C:\Edge\out already exists
A subdirectory or file C:\EDIIMPTS already exists
A subdirectory or file C:\BACKUP.EDI already exists
A subdirectory or file D:\BACKUP.EDI\EDI-IMPT already exists
A subdirectory or file D:\BACKUP.EDI\EDI-RECV already exists
A subdirectory or file D:\BACKUP.EDI\EDI-SEND already exists
A subdirectory or file D:\BACKUP.EDI\INBOUND already exists
A subdirectory or file D:\BACKUP.EDI\OUTBOUND already exists
<SETBANK FIRST D:\backup.edi\batch.log

ERROR: File impt355.edi already exists--
Edit C:\Edge\EX_P\Setlast to the last sequence # used plus 1 and try again

Is this output being generated by a batch file or some home-grown program? If it's from a batch file, please post the code; if it's from a program a forum may not be your best bet for a solution.

8-)
2561.

Solve : how to supress newline??

Answer»

Is there any way for me to display two echo result on the same LINE?
Thanks !It depends on the CONTEXT of where ECHO is used. On the COMMAND line you can display defined environment variables (%var%) and literals. Within a batch file you can display passed parameters (%1 thru %9), defined environment variables (%var%), variables generated within the scope of a FOR statement (%%a thru %%z), and literals.

If you put two ECHO commands on the same line, the second ECHO will be treated as a literal.

You could always use DEBUG and create your own assembly language program for your own needs.

Hope this HELPS.
I've just found an workaround to get the same result:

set /p dummy="this is the 1st line" echo "this is the 2nd line"

And you will get these 2 lines goes TOGETHER! I'm always happy when people find their own solutions. There is always more than one way to accomplish the same thing on a PC.

Good luck.

2562.

Solve : Batch Programming Question, How do you ...?

Answer»

Hello ... I need a batch that will write an incremental folder structure, such as test to see if the folder exists and if it doesn't create it, and copy data from point A a Static Drop Point to Point B being the next available value folder just created 1, 2,3 etc. I am thinking that I can use the IF EXIST function to test for the folders, but dont know how to go about this part past that.

I would like to keep it simple with folders named 1,2,3... and so on, so that the folder name ( a value ) such as 1,2, or 3 can be read and dropped into into the batch into a variable such as FOLDER and then FOLDER++ (increment) to create the next available folder name ( number ) 2, 3, 4 and so on.

One of my friends who knows more about Batch Programming than I said that it should be able to be done, but its above my Batch Programming knowledge, and above his as well, so I figured I would post this to the group and see if an Expert or more advanced Novice may be able to post an example of how to do this.

BTW: This batch will execute on a Windows XP Pro SP2 system ....

Many THANKS in advance if this can be done and for your help... DaveThis is not very elegant and probably should be written to be more bulletproof, but on the day after Thanksgiving I'm fat and lazy.

Code: [Select]@echo off
for /l %%x in (1,1,1000) do (
if not exist c:\PointB%%x call :makecopy %%x & GOTO :eof
)

:makecopy
md c:\PointB%1
copy c:\PointA\filename c:\PointB%1

If you feel 1000 is not large enough, try something bigger. 8-)Hey...Many Thanks again Sidewinder. This will work perfect for my application. I am kind of amazed that it is pretty straight forward when looking at it now. I had a feeling that a FOR statement would be needed like you posted to count from 1 to 1000 in increments of 1. I DIDNT think about the EOF statement, but it is very important to making this work the way that it does.

I suppose I should invest in an Idiots Guide to Batch Programming/Coding and read up to get better ejamakated on this STUFF since I am working with it more regularly now ...

Thanks for coming through for me on my %date% to %today% format CONVERTER the other day and today with this. I wish I can return the favor at some point through this forum

2563.

Solve : BACK UP IN Batch?

Answer»

I need to write a batch file. When you drag & drop a directory in the batchfile, it will automatic backup the directory iclude the files and the subdirectories in it. How to let the batchfile recognise this directory and backup fot it. could any one help me? thanks very much!Batch files do not support drag & drop. You can include commands in a batch file that will backup files. You can even prompt for file names (SET /P).

Checkout COPY, XCOPY, or BACKUP/NTBACKUP

BACKUP is on DOS and Win9x machines; NTBACKUP is on NT machines. These backup programs can be run in batch or interactively.

XP Home: Install NTBACKUP from the ValueAdd directory on the XP CD.

Hope this helps. Thanks! I will TRY I use xcopy for just such a thing - here is an EXAMPLE of what i use. It will backup a directory and it's contents if they have changed since last BACKED up. You can search the NET for the meaning of the various switches and thier functions. Good luck. The example will back from C: Drive to H: Drive

xcopy "C:\Documents and Settings\Administrator\My Documents" "h:\Backups\My Documents" /h /k /E /r /c /i /y /d /f

2564.

Solve : Help with a DOS command?

Answer»

I have a custom built computer whose HD crashed. I am reinstalling everything on the new HD but FORGOT how to enter a command in the autoexec.bat file.

I am looking of a SET DIRCMD command which would alphabetize the directories & root directory with all directories first & then the files. I REMEMBER there was a “G” in this command.

Does anyone know the command I am looking for?
The G sortorder was used in tandem with the /o switch to GROUP directories first. Something like this:

set dircmd = /o:g

Run dir /? at the command prompt to see all the switches and options that are available.

Good luck. 8-)Would the following be the proper syntax INCLUDING spacing:

set dircmd= /o:g,nWithout an explanation of what your trying to ACCOMPLISH, this is only a guess:

set dircmd=/o:gn

8-)

2565.

Solve : Bat File Q?

Answer»

I have a bat file that i use with xcopy to backup. Is there any way i can program the file to give me a report of any errors it encountered or report it's success.
Thanx.XCOPY exit codes:

0 Files were copied without error.
1 No files were found to copy.
2 The user pressed CTRL+C to terminate XCOPY.
4 Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
5 Disk write error occurred.

You can use the ERRORLEVEL parameter on the IF command line in a batch program to process exit codes returned by XCOPY.

Hope this helps. And/or you can have the results of any .bat file output to another file by RUNNING it like......

some.bat >output.txtThanx heaps!
i don't know ANYTHING about errorlevel so if u can explain - great - OTHERWISE i guess i will have to figure it out.
Thanx again.When DOS commands run, they set a return code that you can use in your batch files.

You can do something like this:

xcopy parameters
if errorlevel 0 echo Backup JOB Successful
if not errorlevel 0 echo Backup Job NOT successful

You can query any valid XCOPY exit code and perform an action based on the value. The possibilities are limited only by your imagination and cleverness.

Good luck.

2566.

Solve : change admin password via MS-DOS?

Answer»

Hey everyone,

I desperately need to find a WAY to change the admin password through MS-DOS as my older sister screwed up the password when she CREATED the account. Now she's forgotton the password and we can't find any Windows CD's. PLEASE HELP!

Regards,
jason.OS?can you ACESS any of the accounts on the computer

2567.

Solve : Batch File Under Windows 2k?

Answer»

I am trying to MAKE a BATCH file that will prompt the user to enter a DRIVE letter under windows 2000 and read it in, but to no succcess. I know how to make it a parameter, but choice is not available under windows 2000 for it to be input. If anyone knows what I am talking about and can help please send me an email.Use set /p var=prompt

The prompt will be displayed and var will contain the RESPONSE. CHOICE was discontinued on NT machines.

Hope this helps.

PS. I don't do emails.

2568.

Solve : gather all the files on a drive and copy them?

Answer»

Can anyone tell me how I can write a batch file on an XP system that will find all the files of a certain file type on an entire hard drive and copy just the files to a specific folder?

For example, I would like to gather all the text files on a drive and copy them all to a folder for further scrutiny.

This seems simple enough, but I haven’t figured it out yet SINCE XCOPY will copy the entire directory along with the files.


Thanks in advance.
I am always amazed at the people who look for batch solutions, when they have so MANY other options:

Code: [Select]strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService. _
ExecQuery("Select * from CIM_DataFile where Extension = 'txt'")

For Each objFile in colFiles
strCopy = "C:\Archive\" & objFile.FileName _
& "." & objFile.Extension
objFile.Copy(strCopy)
Next

Save this little ditty with a VBS extension and run from the command prompt as cscript scriptname.vbs

PS. I used c:\archive as the directory to put the copies; change as you wish.

Note: this may run a while, so if you have a spare copy of War and Peace, now would be a good time to crack it open.

8-)Hey thanks man, the script works great!

I guess I just thought there would be a DOS solution to this problem.

I am not really up to speed on VBscript.
Is there any chance that you could explain how the script works?
Do you know of any good VBS tutorials online?


I see that it gathers all the files off of EVERY drive.
Is there a way to make it drive specific?

Thanks for all your help!
It's easy enough to restrict this script to a specific drive by adding new criteria to the SELECT statement:

Code: [Select]strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService. _
ExecQuery("Select * from CIM_DataFile where Drive = 'C:' And Extension = 'txt'")

For Each objFile in colFiles
strCopy = "C:\Archive\" & objFile.FileName & "." & objFile.Extension
objFile.Copy(strCopy)
Next

How does it work? [sigh] I wish I knew

Actually it's fairly straightforward. The first 3 lines are boilerplate code to connect to the Windows Management Instrumentation service (WMI). Once connected to WMI, the script runs a query against the CIM_Datafile class specifically looking for files on the C drive and having a txt extension. The CIM_DataFile class represents all the files on a system. Each file selected is added to colFiles which is used as a collection.

Next up, the script loops thru the collection and processes each selected file by concatenating a literal ("C:\Archive\") and two properties of each file (FileName and Extension). A dot is thrown in to create a legal path. This path represents the destination directory for the COPY method, which is performed in the very next statement.

Try using Google to find VBS tutorials. For other script resources (tools, articles, and a script repository where you can copy/paste scripting examples and with minor modifications, use on your own system) check out the Script Center

Good luck. 8-)

FYI: Using recursion, this script could have been done in batch But nobody needs that much aggravation.The batch code to accomplish that task isn't too aggrivating in my opinion:
Code: [Select]for /f "delims=" %%a in ('dir c:\*.txt /a-d /s /b') do copy "%%a" c:\archive
The code is basically:
Use the DIR command to list all *.txt files in the C: drive, then loop through each (with FOR) copying to (an existing) c:\archive.Wow, I knew it could be done in DOS!

In any event, this has proven rather useful to me, so thanks to all.

These scripts can be used to sort, organize and back up all important files by file type. Very cool indeed!

As for the batch code, it looks pretty strait forward compared to the VB script.
The VBscript takes a while to run if you have LOTS of DRIVES, but seems to work well and is very stable.

It is easy to get overwhelmed when you start researching windows programming because the scope is vast. I did some research on CIM and here is what I found out.

According to Microsoft, CIM classes are the parent classes upon which WMI classes are built. I found this link to be helpful. Maybe I can even figure out how to make further use of other CIM properties.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/cim_datafile.asp

2569.

Solve : create logfile?

Answer»

im very new to DOS and writing batch files. i want to KNOW if there's a WAY to write whatever is displayed to the screen into a text file. i want to save this file and be able to VIEW its contents so i can see what exactly was running. its kinda like the DIARY ON command if you're familiar with MatLab. any HELP would be greatly appreciated! thanks!!nevermind...i got it....

2570.

Solve : Dos errors in win xp?

Answer»

When I go to Dos command window and TYPE : "ipconfig" command , I receive message : "can't regconize as an internal or external command", so what should I do, Please help me. Thanks Is this the only command you're having PROBLEMS with? IPCONFIG is an external command (a STANDALONE executable) and lives in c:\windows\system32. Try doing a search and see if you can find it. The only other thing would be to CHECK your path.

Good luck, I have had this same problem. For some reason I FOUND I needed to type in the full path - as Sidewinder was indicating where it lives.

c:\windows\system32\ipconfig
I can't recall whether I had to put .exe behind it or not - try both ways.

The reason this has to be done eludes me - maybe environment path statements? Some brighter person than me can probably tell you that part.Yep c:\windows\system32 should be in your path or its alias %SystemRoot%\system32

2571.

Solve : I think I broke my computer... Please help.?

Answer»

Hi, first of all I registered here because I need to ask a few questions on how I can fix my computer.

It is a Windows Millenium Edition (Old, I know) and I recently tried to install a driver for my old Nvidia Riva TNT2. Something went really wrong. It must have been an INCOMPATIBLE driver or something, because WHENEVER I tried to boot it in normal, it would turn off. I can run it in safe mode though.

I want to figure out how to reformat it. In order to reformat, I need to have discs inserted in the CD drive. I inserted the disc, but apparently it disables the drives in Safe Mode. My question is, is there a way I can reformat my computer in safe mode? If not, is there another way I can reformat?

I have already tried to DISABLE the new drivers I had installed, which I did. However, when I boot it in normal mode now it comes up with a blue screen that says "Windows Protection Error, System Halted" or something like that.

Please help!alright here is what you do....

put disc into the drive.
select start windows normally.
it should then read the disc.
it doesnt have to boot into windows to read the disc.
then follow the instructions.
if you want to compelety wipe the hard drive (previous windows and files)
delete the partion.
then just create a new partion.
i recommend NTFS.
Although FAT32 is okay.
NTFS is the newest.

have fun.

new more information contact me by PM or just repley to the post.First off, if it is your video card drivers that caused the problem, you can remove them in safe mode and install different ones or even your old ones. (note I said remove, not disable. you want to uninstall the drivers, not disable the DEVICE) That would also determine if it actually is your video card drivers causing the problem.

2nd, you can reformat by simply booting from your Windows CD, if that is truly what you want to do. You do not have to be in windows to do it. Just set up your bios to boot from a cd. Personally, I'd try fixing the problem before reformatting though Quote

alright here is what you do....

put disc into the drive.
select start windows normally.
it should then read the disc.
it doesnt have to boot into windows to read the disc.
then follow the instructions.
if you want to compelety wipe the hard drive (previous windows and files)
delete the partion.
then just create a new partion.
[highlight] i recommend NTFS.[/highlight]Although FAT32 is okay.
NTFS is the newest.

have fun.

new more information contact me by PM or just repley to the post.

Unfortunately WinME cannot USE NTFS at all.

Maybe this would be more helpful:

http://www.windowsreinstall.com/windowsme/installme/index.htm
2572.

Solve : Rem Prob?

Answer»

When EVER i put "REM" in my batch file i get "this is not recognised....yatta yatta"
Can someone TELL me what i am doing WRONG - it doesn't seem that difficult to type REM
thanx.You're right, it's not that difficult to type REM If you would post your file here it would be a lot EASIER to troubleshoot.

Get back to us.

2573.

Solve : xcopy from network drive to local?

Answer»

I have two machines. One is a desktop that functions as a kind of master FILE server at home. The other is a laptop that I boogie around with.

I want to write a batch file to XCOPY FROM the desktop TO the laptop.

It isn't working.

Running XP SP2
The subdirectory to COPY from is called "To Copy" and is in the Shared Documents on the server
The Shared Documents subdiretory on the server is Shared as "\\SERVER\SHAREDDOCS"
The entire hard drive of the server is shared as "\\SERVER\SERVER" and is also mapped as G:\ drive


What is the proper syntax for the file location?

I have tried:

xcopy \\SERVER\SHAREDDOCS\To Copy c:\DEST

xcopy g:\Documents and Settings\All Users\Shared Documents\To Copy c:\DEST

xcopy \\SERVER\SERVER\Documents and Settings\All Users\Shared Documents\To Copy c:\DEST

and finally

xcopy g:\docume~1\alluse~1\shared~1\tocopy c:\dest



What to do?

Thanks

2574.

Solve : Calling a Specific diskette?

Answer»

Need syntac for CALLING a SPECIFIC floppy DISKETTE or cd and if the wrong diskette or cd is in place it errors out, but it doesn't end the batch file. -thanks :-?How do you know if the disk is correct or not ?? you COULD use the Volume label

Graham

2575.

Solve : Help with quoting syntax for .bat arguments?

Answer»

Hi,

I'm trying to use a batch script to rsh into a linux machine, but I'm having problems with MS-DOS trying to execute bits of my arguments.

I have a batch script which goes like this:

MYPROG.DAT
Code: [Select]@ECHO off
rsh somemachine -l someuser -n linuxcommand --parameter1=something --parameter2='"addurl %1"'
It seems to run OK with a DUMMY argument
Code: [Select]MYPROG http://dummy
linuxcommand: unknown host dummy
But if fails when it comes to the real thing
Code: [Select]MYPROG 'http://somewher.org/something.cgi?fred=x1|x2|x3'
'x2' is not recognised as an internal or external command, operable program or batch file
I've TRIED double-quote ("), single-quote ('), BACKSLASH (\), and various combinations of all three, but MS-DOS keeps on trying to execute x2 instead of passing it unparsed as an argument to my script.

Any ideas please?
Ken.You are trying to put the pipe (|) char in, it wont do it ... Im SURE theres a way to fix it, but Im not sure how;

Perhaps you could use a different char as a param then replace it with ^| in your batch ? (^ is the escape char)

GrahamQuote

(^ is the escape char)

Thanks Graham,

Code: [Select]MYPROG 'http://somewher.org/something.cgi?fred=x1^|x2^|x3'
linuxcommand: URL sucessfully added
That's it
2576.

Solve : Need help with my Batch file script ...?

Answer»

I WANT to MODIFY the following script to block or not transfer users files bigger the 500MB.

Add something like this to my script: IF FILE BIGGER THAN 500MB DO NOT TRANFER.

Here’s my script :

echo off
echo Starting backup to network ....
echo Backup of %username% started at > c:\MyDocumentsBackup.LOG
date /T >> c:\MyDocumentsBackup.log
time /T >> c:\MyDocumentsBackup.log
echo . >> c:\MyDocumentsBackup.log

echo FAVORITES: >> c:\MyDocumentsBackup.log
xcopy "C:\DOCUMENTS and SETTINGS\%username%\Favorites\*.*" "\\server\%username%\backup\Favorites\*.*" /E /C /D /R /Y >> c:\MyDocumentsBackup.log"

echo MYDOCS: >> c:\MyDocumentsBackup.log
xcopy "C:\Documents and Settings\%username%\My Documents\*.*" "\\server\%username%\Backup\My Documents\*.*" /E /C /D /R /Y >> c:\MyDocumentsBackup.log"

echo LOG: >> c:\MyDocumentsBackup.log
xcopy "C:\MyDocumentsBackup.log" "\\server\%username%\*.*" /C /D /R /Y >> c:\MyDocumentsBackup.log"

echo . >> c:\MyDocumentsBackup.log
time /T >> c:\MyDocumentsBackup.log

Thanks for everyone's help !

2577.

Solve : facing problem while generating the log file?

Answer»

hi below is part of the script in which i am facing problem.

%9 is the ninth parameter that CONTAINS a path, suppose D:/files.
There are MULTIPLE files that i have to use in this path, therefore cannot pass the absolute path of the filename as parameter. So i am appending the file name to the path passed as parameter.


if i dont give mybat.bat 1>>%9\nics.log command at the end to create a log file, everything RUNS smoothly, but after adding this command to the script, the batch file is unable to file D:/files/dns.txt file as '.' is appended at the end of the file name making it D:/files/dns.txt.

I badly need a solution to this, please help me out...

Code: [Select]for /f %%d in (%9\dns.txt) DO (
NETSH interface ip add dns "Local Area Connection" %%d
)

echo NEW NETWORK CONFIGURATION:
ipconfig
netsh interface ip show dns

[b]mybat.bat 1>>%9\mylog.log[/b]


Thanks in advance.one can also refer to the page below to further analyse the problem:

http://www.freedos.org/freecom/appendix.html

2578.

Solve : local login account batch file?

Answer»

i got this batch file to create a local user login ACCOUNT , the account that i created .. the password never EXPIRES is never checked. How to create a batchfile that create a local login with password never expires?

@echo off
if exist c:\windows\avdone.usr goto done
net user supportdept spp123 /add
net localgroup administrators supportdept /add
echo hello > c:\windows\avdone.usr
:doneNightShyamalan:

Good to see you back. Your request really needs to be done with a script; specifically a WMI Script. But SINCE you want batch language, check out this site:

http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/cmds/aixcmds4/net.htm#HDRUSER

It explains everything you'll ever need to know about the NET command.

Good luck. @echo off
if exist c:\windows\avdone.usr goto done
net user supportdept spp123 /add /expires:never
net localgroup administrators supportdept /add
echo hello > c:\windows\avdone.usr

does this work?? i just addes /expires:never but the setting is not checked at the username properties.I could not find that Expires is a parameter of the NET command. Do yourself a FAVOR a download the Portable Script Center from:

http://www.microsoft.com/technet/scriptcenter/createit.mspx

It's more help than you thought possible. ALSO shouldn't the NET statements in your file be flipped (create the localgroup before the user?).

Hope this helps. awsome site sidewinder ... thanks for your help

2579.

Solve : Sata Driver 4 Dos?

Answer»

Any one COME ACROSS a dos driver for sata DRIVES YET?

2580.

Solve : MS DOS / The command prompt on steroids?

Answer»

Read all about >Windows PowerShell<.Why do I GET this error message when trying to OPEN the link :-?

An Error Has Occurred!

The board field does not accept / in the query stringwhat about this
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspxThank you ghostdog74. I have ALREADY been to the MS SITE.

Doesn't explain why the error occurs tho'Ex-member bug. I have reposted the original thread and amended the link above.ha.... at last, I can use LS instead of dir!

2581.

Solve : batch file opening?

Answer»

could some one tell me how to open a batch FILE?
and when you send a batch file does it open automatically???
please answer THANKS in advanceDouble click it in Windows or....
type the file name and press enter in DOS.

Most bat FILES WOULD be stripped out of an email well before the end user gets it. But no, not normally will it autoexecute.

2582.

Solve : Reboot with a batch file at a certain time given?

Answer»

Hy everybody,

I want to make a batch file that will reboot the computer when it arrives at a certain date given for example 31/03/2005. When you start the computer in this morning it will reboot over and over again.

ThanksSounds a little harsh to me, almost virus like.Normally I would respond with a little code snippet, throw in my usual commercial for WinScript, and then follow up with other questions that might arise.

But your request, as best I can see, has absolutely no socially redeeming qualities, is malicious, and does nothing to advance the general knowledge of the casual computer user.

Therefore, I respectfully refuse to provide you with the answer to your request. In the words of the Code Nazi: No Snippet For You!

In the forums I moderate, this post would be HISTORY. If the user posted any more like it, he'd be history too. although i have seen a program that refuse access to a computer, one of my mates, his dad put it on his computer to make him go to bed, like only give him access to the computer during resonable hours of the day 9am to 10 pm or somthing. which isnt virus or malicious, as it does what it spose to. lolQuote

Hy everybody,

I want to make a batch file that will reboot the computer when it arrives at a certain date given for example 31/03/2005. When you start the computer in this morning it will reboot over and over again.

Thanks


Could you please explain to us why you would wish to create something like that .......Oh ...wait.... the ultimate April fools joke .......sorry pal not funny ......in fact if THATS what you want to do I would SUGGEST you go and find another forum .

dl65
I searched for this thread and am a little surprised at the response. I would like to shutdown all the PCs on my network each night. I work in a school and MANY users leave their computers on and open gradebooks and print shop items always cause exceptions on the backup. I can see that you could see malicious intent here. I guess I'll look around more...Innocent Hacker,

Actually, you could put the shutdown command in a script or batch file and then schedule the file (thru the Windows Scheduler) to run at a certain time each evening. Type help shutdown for the switches to use. I do this weekly on my machines after the backup has completed...they run late at nite. As for starting up the MACHINE, maybe if the machine was in standby but not from a cold start.

Hope this helps.

Ps. You might have worded your original request a little better.
2583.

Solve : Read output from commands?

Answer»

I want to compare two program versions ie program.exe /v OUTPUTS SOMETHING like 4.2 if it is less than another version ie program.exe /v returns 4.4 then I want to copy the newer FILE over the OLDER one.

How in a batch file can I read in the output from a command executed in the batch file?

Cheers.What Windows version are you running? or is this a MS-DOS machine? Batch language is version dependent.

Get BACK to us.

2584.

Solve : troubleshooting when making a batch file?

Answer»

can any one please tell me why when I TYPE edit test.bat itgives me this ERROR: C:\WINDOS\system32\cmd.exe - edit test.bat
C:\WINDOS\SYSTEM32\AUTOEXEC.NT.the system file is not suitable for running MS-DOSand mirosoft windos applications.choose 'close'to terminate the application



please try to help,thanksThis problem seems to be widespread. Your autoexec.nt is probably corrupt. To repair it, open a command window and run:

copy c:\windows\repair\autoexec.nt c:\windows\system32

Hope this helps. thanks a lot it workedCan I make a program with turbo pascal and then run it from dos??? Please tell meYes, provided you have a turbo pascal compiler and linker.

Good luck.

PS. Please do not ride along on SOMEONE else's POST. It's better to start your own THREAD.

2585.

Solve : "Operating system not found"?

Answer» When my system reboots I get "operating system not found" My IBM thinkpad has been completly FORMATED. I also get a red box that reads "hard drive not installed. Physically the hard drive is in. I need to know A- How to install operating system. B-How to install/fix hard drive. And C- How to Get computer to read all drives/create (C) drive. Have some idea's but I am not a PROFESSIONAL and I am afraid to screw it up more than I ALREADY have. Could I get some professional advice on how to continue the proper way?
2586.

Solve : HOW TO INSTALL MS-DOS WINDOWS\SYSTEM32\AUTO.EXEC.N?

Answer»

HOW TO INSTALL MS-DOS WINDOWS\SYSTEM32\AUTO.EXEC.NT If you are referring to autoexec.nt, then it would have been installed with the operating system. If for some reason it has become corrupt, you can repair it by:

copy C:\windows\repair\autoexec.nt c:\windows\system32

Hope this helps. when you say copy, do you mean copy the whole thing into run? because i tried that and it didnt work Actually I meant to issue the copy command at the prompt in a command window. This only APPLIES to the situation where the autoexec.nt is unsuitable for running DOS applications. If you have another problem, get back to us with a full explanation including your OS.

Hope this helps. I diffenatly have that problem, but i dont no where the command window is. Pls help! I am useless at using computers! Plus im blond, which doesnt help! by the way, i tried putting command window into run, and it came up with a kind of black BOX that you could write in, bu it also came up with the 'unsuitable' thing again, so it wouldnt let me type Let's try this again. Put CMD into Run. When the black box appears (that's the command shell), type:

copy c:\windows\repair\autoexec.nt c:\windows\system32

Press enter and that should fix your problem.

Good luck.

It worked! Thank you so much! i need some major help here...i lost everything on my hard drive...it does not even reconize i have one..i was trying to reformat it and now i cannot get pass this screen of c:\ i'm running windows 98 i cant reinstall anything by cd or floppy...it says i dont have the DIVE or drivers for it even...i have been working on this about 7 hrs now NONE stop....win98 pentium 2 processor dell latitude CPXJ...any help would be great! thank you.....angelwingsAngel, start a new topic with a subject line that relates to your problem. You will get better responses that way.

2587.

Solve : format windows now nothing works?

Answer»

i need some major help here...i lost everything on my hard drive...it does not even reconize i have one..i was trying to reformat it and now i cannot get pass this screen of c:\ i'm running windows 98 i cant reinstall anything by cd or floppy...it says i dont have the dive or drivers for it even...i have been working on this about 7 hrs now none stop....win98 pentium 2 PROCESSOR dell LATITUDE CPXJ...any help WOULD be great! thank you.....angelwingsWell, use www.killdisk.com. Use this program to enter format. You should see your Hard Drive. Reformat it again this time correctly.


If it doens't work I might have other Ideasi have tried it...does not work it says that stub exec failed \dos4gw.exe no such FILE or directory. i tried with the A:\ Prompt i cannot get pass the windows 98 logo screen i see it for a second and then it gives me the option of C:\> and it's a all grey screen...at the TOP of screen it says Microsoft (R) Windows 98 (C) Micorsoft corp 1981-1998...is there another way around this? thank you for your help... angel

2588.

Solve : serial port?

Answer»

I have a dos APPLICATION/program that needs to use the serial port. It can be used in windows 98. I am trying to use it in XP. (Command /DOS windows) What did Microsoft change in the way you use the serial port from Windows 98 to XP?

I NEED to add this: I use a LCOM application to open the port in WIN 98 and OLDER.

2589.

Solve : Killdisk woked?

Answer»

hey ty for the help i GOT the killdisk to work now...i'm on a screen here that says to press f10 to ERASE all data on selected device....hard disk DRIVE (80) h so i'm see what HAPPNES next here i will post back soon...THANK you again angel

2590.

Solve : Windows98 Fat 32 Partition??

Answer»

Ok i did the erase C drive and thats fine...but now it tells me when i start up with the win98 floppy that win98 dectected that C Drive does not contain a valid FAT or FAT32 PARTITION.....and give's 3 reason's why it's not working right.....1. drive MAY need to be partition....2. you may be using third party disk partition software....3. some viruses ALSO cause Drive C not to Register...then goes on to say that...the Diagnostic tools were successfully LOADED to C Drive....press ENTER for help...so now do i try to partition the C Drive? thank you for all the help ...Angel

2591.

Solve : disable system restore?

Answer»

looking for a batch file to disable system restore. All i found is this site ..
http://www.jsifaq.com/subr/tip8900/rh8979.htm
but i cant seem to get the script working ... im still new and learning on batch files. can anyone help me with the script on that site to work on local machine.

I also found a vb script to disable system restore.. its working wonderfull.

Option Explicit

Dim strComputerName, blnEnabled, objRP, lngRC

' If no command-line parameters, assume local computer
If Wscript.Arguments.Count = 0 Then
strComputerName = CreateObject("Wscript.Network").ComputerName
ELSE
strComputerName = Wscript.Arguments(0)
End If

' Check if computer has any restore points
blnEnabled = False
For Each objRP In GetObject("WinMgmts:" _
& "{impersonationlevel=impersonate}!//" & strComputerName _
& "/root/default").InstancesOf("SystemRestore")
blnEnabled = True
Exit For
Next

lngRC = 0

If blnEnabled Then
' Disable System Restore for all drives on the computer
lngRC = GetObject("WinMgmts:" _
& "{impersonationlevel=impersonate}!//" & strComputerName _
& "/root/default:SystemRestore").Disable("")
If lngRC = 0 Then
Wscript.Echo "Disabled System Restore on " _
& strComputerName & "."
Else
Wscript.Echo "Error &H" & Hex(lngRC) & " disabling System Restore" _
& " on " & strComputerName & "."
End If
Else
Wscript.Echo "System Restore is already disabled on " _
& strComputerName & "."
End If

Wscript.Quit lngRC

can system restore be disabled from a batchfile???This is probably more a case of the right tool for the right job than anything else. Wscript is the right tool. While you can apparently do it in batch it will be MUCH easier to do and configure in script. Sort of like cutting down a tree with a hand saw when you have a chain saw available in your tool box.

Are you getting any erros with the batch file? If so what are they? How are you calling this batch file? Are you passing parameters to the batch file?


all i get is this .. when i run the file ..

@echo off
if {%2}=={} @echo Syntax: DisableRP Drive RetVal&goto :EOF
setlocal
set work=%1
if /i "%work%" NEQ "ALL" set drive=%work:~0,1%:\
set DisableRPVBS="%TEMP%\DisableRP_%RANDOM%.VBS"
set OK=N
@echo Set objArgument = Wscript.Arguments>%DisableRPVBS%
@echo If objArgument.Count() ^> 0 Then>>%DisableRPVBS%
@echo Drive = objArgument(0)>>%DisableRPVBS%
@echo Else>>%DisableRPVBS%
@echo Drive = "">>%DisableRPVBS%
@echo End If>>%DisableRPVBS%
@echo Set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")>>%DisableRPVBS%
@echo If (obj.Disable(Drive)) = 0 Then>>%DisableRPVBS%
@echo wscript.Echo "Y">>%DisableRPVBS%
@echo Else>>%DisableRPVBS%
@echo wscript.Echo "N">>%DisableRPVBS%
@echo End If>>%DisableRPVBS%
for /f "Tokens=*" %%d in ('cscript //nologo %DisableRPVBS% %drive%') do (
set OK=%%d
)
del /q %DisableRPVBS%
endlocal&set %2=%OK%


It wan't you to provide it the input parameters "Drive" and "RetVal". So if I READ the batch file correctly then you need to provide it with the drive letter you want to disable system restore on and a "Y"

So to run it for drive C: you type

DisableRP C: Y

then press enter.ohh .. i get it now.. cool .. i need to specify which drive or type ALL for all drive. Yes or No .. thanks man ... now that i understand it .. i can learn more about the code.
Thanks ALOT gussery

2592.

Solve : Creating shortcut in Batch file??

Answer»

Can anyone help me on how to create a SHORTCUT within a BATCH file?

Thanks,
MWBatch files are clueless when it comes to WINDOWS tasks. You will need to write a script:

http://cwashington.netreach.net/depo/view.asp?Index=162&ScriptType=vbscript

Good luck. thanks

2593.

Solve : trouble installing cd rom in dos?

Answer»

I am new working in dos and am trying to install a cd rom on my daughter's computer so I can install windows. I downloaded the generic driver but it says wrong VERSION of dos when I try to install it. What now please :-/? Help from anyone is APPRECIATED.
Thanksbootdisks.com.............come with CDROM DRIVERS!!

2594.

Solve : check file size?

Answer» OK i need to do a batch file that would check for the size of a text file all i want is to know the size ifts 0 or not, any one can help.
thanksYou have to jump thru hoops to do this one:

Sample Only

@echo off
dir filename.ext &GT; dummy.txt
findstr /i "xpBackup.vbs" dummy.txt > dummy.dat
for /f "tokens=1-4*" %%a in (dummy.dat) do (if %%d EQU 0 ...
del dummy.dat
del dummy.txt

The above is just to give you some ideas on how to go about it. You'll have to jigger the code to run on your machine. YMMV.

Hope this helps. im not too good at batch so this is not making too much sense,
the file i wanna check is c:\error1.txt
do i really need thse dummy files and why a for loop.
helpOK. This little piece of doggerel will eliminate one of the dummy files. The reason for the loop is that the FOR statement offers the only batch command that will read INPUT from a file. The fact that garbage.dat contains just one record is to your advantage so a value for %%d can be evaluated. Note: The FIND command will produce to two lines of output.

Batch file programming is not only knowing all the commands and their obscure switches, but knowing how to combine them so that nothing makes sense....the result just works.

A batch file is not the best solution for your request. It's UNREALISTIC to use cryptic code to accomplish simple tasks. If you ever have to revisit this file (and you will), you'll wonder "what the *censored* was I thinking". I would substitute WINDOWS Script for it's simplicity and readability.

Code: [Select]
@echo off
dir c:\error1.txt | findstr /i "error1.txt" > garbage.dat
for /f "tokens=1-4*" %%a in (garbage.dat) do (echo size error1.txt ^= %%d)
del garbage.dat


Feel free to change the ECHO statement to an IF statement and perform what ever action you need to do.

Hope this helps. thanks for your help, and the fact im using batch is thats what the boss wants he wants everything consistent and this is a good for me as i never worked with batch before.
2595.

Solve : changing win98 folder?

Answer»

can someone please TELL me why i cannot change the folder? here is what i did

Now Type "MD C:\WIN98" and press enter. (This Creates a folder on the HARD Drive called WIN98)

And then Type "COPY *.* C:\WIN98" and press enter (this copies the Installation files to your Hard Drive)

the copying files part WORKED..but when i went to this next part under here it would not work....said bad file name....

Now type "C:\WIN98" (You are changing to the WIN98 folder on the Hard Drive)

And finally type "Setup" (Windows 98 will start installing)


THANK you ANGEL
That should be

cd win98

setup thank you....ok i got it running but alot of missing dll files now and all so i will try and figure it out....how to load them....thanx again....angel

2596.

Solve : DOS Install?

Answer»

I need to get a copy of DOS 6.22 or older. I have got old software for a Plant control systems that cant run in Win 98 95 or newer. the disk that I have for my dos recover are bad. Floppys dont last forever. (13 Years old ) Any help would be great...


cbDue to copyright problems (MS retains the copyright to MS-Dos) it is probably against the forum rules to advise you about this on an open forum. E-mail???Would it be WRONG to give someone software if it no longer installed or being used?
I have DOS 6.22..... somewhere around here and it's not installed. When you first bought your copy of Dos.6.22 you would have received a licence to use it i.e. install it on your pc for your use. The EULA would have barred you from on-selling it or providing/giving it to a third party thereby DENYING the seller (MS) another sale. However now MS does not distribute standalone MS-Dos in any form so its a very grey area. MS retains the copyright to MS-Dos in all versions.

There has been a lot said on VARIOUS forums about copyright issues and in some cases I understand MS has waved the BIG stick resulting in several forum members, who have directed others to download sites, being banned. I think it may be the forums way of saying "OK big brother, please don't blame me". PERHAPS I'm totally wrong on this one.

Maybe our worthy moderator would clarify the CH policy on posting links to copyright materials.

2597.

Solve : Read inputs from a file?

Answer»

Hello All,

I need some HELP on scripting.I am configuring windows cluster from batch file(AUTOMATING cluster config).The installation will be unattended, so i SHUD be able to READ the input arameters from other file.can anyone help me in solving this?

Thanks
ashaI wasn't aware that MICROSOFT had released the Cluster Edition, but I did find some information at:

http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/clustering/mscsclus.mspx

Hope this helps.

2598.

Solve : Resulting file name from multiple file copy?

Answer»

I'm trying to merge two files together one of which has date-time as part of the name. I want the resulting file name to be the second listed file (the one with the date/time) of my copy statement. For INSTANCE given these files:
c.txt
abc20050509-083222.txt

using something similar to:
copy c:\x.txt+c:\abc*.txt d:\abc*.txt

I want the resulting file on the d: drive to be abc20050509-083222.txt. Is this possible?
Meant to say given x.txt instead of c.txt in description.There is a QUIRK in the COPY command that if you leave out the target filename, all the data will end up in FIRST source filename. However this does not work with wildcards.

copy c:\x.txt+c:\abc20050509-083222.txt will put all the data from both files in x.txt. If sequence is important then this method may not be helpful.

A datetime stamp is a moving target. If the VARIABLES you used to generate the datetime stamp are still available you could use them in the copy statement.

You could prompt for the filename (set /P) or maybe you could key off a dir list and pull a substring from the filename. This last suggestion could be really ugly.

Hope this helps. Thanks for suggestions. I was hoping that I was just missing something simple but looks like what I was trying to do is just more difficult in DOS.

2599.

Solve : Dos script to copy a file into a subdirectory uniq?

Answer»

Hello,

I need a DOS script to archive my files once daily under a uniquely named subdirectory based on date. I need this file to be backed up every day to a USB (lets call it X:) harddrive from a directory on C: and create a new unique subdirectory daily. Either a sub dir for every month and then a different file name everyday or a sub directory for everyday and then the copied file to each new directory. I only need to copy one file everyday for backup purposes. Can anyone help me with this? I have never wrote anything in dos before. Sorry for a newbie question, but i just dont know. I just knew that most of you guys could bang this thing out in a few minutes. I searched the BOARD but i couldnt find anything that looked relavent (there PROBABLY is i just dont have any knowledge of the syntax), sorry if this is a SUPER newbie question.

THANKS for the help,
Chris

@echo off
for /f "tokens=2-4 delims=/ " %%a in ("%date%") do (
md x:\topleveldirectory\%%c%%b%%a
copy c:\origdir\filename x:\topleveldirectory\%%c%%b%%a
)


NOTES:

Change toplevel directory (2 places) and origdir (1 place) to your situation.

Date will be in yyyymmdd format.

Hope this helps.

2600.

Solve : Commands doesn't work in MSDOS?

Answer»

Hi everybody, I have a problem in my MS-DOS commands, they do not work, i.e. if I typed ipconfig nothing shows up, but it says [size=16] 'ipconfig' is not RECOGNIZED as INTERNAL or external command, operable program or batch FILE [/size]
And inorder to run it I have to go to folder C:\Windows\System32 and type there the IPCONFIG command.

also, I don't have the AUTOEXEC.bat & config.sys in my C:\ directory, I don't know why..

I use windows xp pro

Can any one help! Please! Your path is messed up. There should be an entry in your path that looks like %systemroot%\system32.

In case you are not aware you EDIT your path in Windows XP by right clicking on My Computer, choose Properties, then click the Advanced tab, then the Enviroment Variables button. Find path in the bottom window, click edit. Go to the beginning of the line and type %systemroot%\system32;