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.

3701.

Solve : Change hostname?

Answer»

how do you change your hostname in dos, my OS is WINDOWS xp professionalThe host name is the computer name. Control Panel-->SYSTEM-->Computer Name tab.

XP (Pro or otherwise) does not come with DOS, just a reasonable facsimile thereof. :-/

3702.

Solve : Batch file output syntax issue?

Answer»

I'm TRYING to CREATE a batch file that outputs to another batch file. The problem is, it doesn't like this line:
echo echo. %%date%% - %%time%% >> dedserver1.log >> server1.bat

It doesn't like this because it is trying to OUTPUT to a file TWICE. My problem is that I can't seem to FIND a way to comment out the first >> once so that server1.bat contains:
echo. %date% - %time% >> dedserver1.log

Any help would be greatly appreciated.I found the answer a few pages back (carrot nulls characters). I might have some more questions soon though. Try the echo command first, then type the rest of the line in afterwards. Sometimes, the prompt cannot read all of that at once.

3703.

Solve : Remote Shutdown?

Answer»

How do you remote shutdown a computer isnt it

C:\SHUTDOWN -s -m//"computername"The command to force a remote shutdown in shutdown -R. That is all you need to do. The -m is USED for other computers on the same CONNECTION. It will prompt you for 30 seconds to save any work, but it will restart the computer after thirty seconds.

3704.

Solve : Re: need help to creat  a batch file or help me w?

Answer»

i can't understand a WORD of what you are saying, please type with points! i don't know when you sentaince ends or begins. And that menu, should it be in dos our should it be a exe file or something. By the way, what is your os? and please type these text whit points

WELL sorry if u were not able to understand let me try to explain again,

i MADE a multi boot cd with these options

1:boot with disk manager
2:boot with hdd regenerator
3:boot with disk tools
4:boot with seamap

now when i start my pc with cd rom support it boots from cd and show me this menu, so menu number 1 ,2 3 works fine but option number 4 dont work so in the menu i need to edit the line for a batch file like when i will press enter on choice number "4" it will run a batch file and the work of that batch file is to take pc on dos prompt and then load "seamap.exe" from this path seamap\seamap.exe
one more thing since this path is in cd like if letter of cd drive is d: then path is d:\seamap\seamap.exe and we need a flexiable drive letter cuz this cd will be used on MANY pc's so we dont know what drive letter that pc will have but main path is that as u open the cdrom then path is cdrom:\seamap\seamap.exe so this is what i was talking about all u need to tell me how to CREAT a batch file which will run and will open the seamap.exe from a subdirectory. i dont know nothing about batch file plz write the lines here for the batch file and i will save those lines in a batch file. for more information i am putting the menu here which was created by magic iso so u can understand it more better

:start
cls
print ----------------------------------------------------------------
print Multi-boot CD Main Menu
print ----------------------------------------------------------------
print
print
print
print 1:boot with disk manager
print 2:boot with hdd regenerator
print 3:boot with disk tools
print 4:boot with seamap
print
print Hit the key of choice:
print
print

:mainkey
getkey 20 esc
onkey 1 goto label_1
onkey 2 goto label_2
onkey 3 goto label_3
onkey 4 goto label_4
goto mainkey
:label_1
print 1:boot with disk manager
cd mboot
run 0.bin
getkey
goto start
:label_2
print 2:boot with hdd regenerator
cd mboot
run 1.bin
getkey
goto start
:label_3
print 3:boot with disk tools
cd mboot
run 2.bin
getkey
goto start
:label_4
print 4:boot with seamap
cd mboot
run 3.bin
getkey
goto start

now when i press choice "4" it will trigger the label_4 plz tell me how to put the path of that batch file in label_4 and then comes the batch file that how that batch file should be written to lead to dos prompt and then open the seamap.exe from this path cdrom:\seamap\seamap.exe

i hope u will be able to understand my problem now i will be looking for ur kind consideration take care huge different :d, now i could start reading and understand it btw what is your os? windows xp/98/nt ....hi well right now i using windows Xp pro SP2 but i want to know how to creat batch file which solve my problem to run an application from cdrom:\seamap\seamap.exe and i am still waiting for the help.just a suggestion
since you are using XP, you can check out the fsutil command
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fsutil.mspx
u can loop through "fsutil fsinfo drives" command and issue
"fsinfo drivetype " to query for CD rom drive. Use "find" or something to grab "CD-ROM Drive" and assign the drive letter to a variable.

eg (NB , its not real code)
for %%a in ( fsutil fsinfo drives ) do
( fsutil fsinfo drivetype %%a | find "CD-ROM"
if errorlevel == set driveletter=%%a )

something like this..

there might be other ways to do it. this is what i can think of right now.

hi i guess u didnt read carefully about my problem i asked that i am running multi boot cd with cd rom support in dos and i need a batch file which take me to the dos prompt when enterd the desired choice from multiboot menu here i show u some thing
this is orignal code

print 4:boot with seamap
cd mboot
run 3.bin

now i will change it like this
print 4:boot with seamap
cd mboot
run abc.bat

or

print 4:boot with seamap
run abc.bat

but the problem is that i dont know how to make a batch file which take me to the dos prompt and then load the file from this path cdrom:\seamap\seamap.exe

i hope this will make u more clear, its all about to creat a batch fuile which should go to dos prompt and then load the file from a subdir plz kindly advise me now and write the code of that batch file here i am sure it will not be a big enough just few lines, i will be looking forward again for ur help thanks

3705.

Solve : DOS Renaming file.?

Answer»

Hi everybody.
I Have 1 line for rename zip file every 5 minutes with this command :

c:\ren aaaa.zip
%Date:~-4,4%_%Date:~-10,2%_%Date:~-7,2%_%Time:~-11,2%_%Time:~-8,2%_%Time:~-5,2%.*

Problem is, if current time < 10 am, batch file never run caused by result of "%Time:~-11,2%" only one digit ( 0, 1, 2 .. 9), other one digit will displayed as space, and rename command not run as well. This is sample result when batch file run at 9 am :
"2005_12_29_ 9_54_18.*", You SEE, it should be "2005_12_29_09_54_18.*" to make it run well. Regional Setting - Time, set to hh:mm:ss tt, so every 9 am displayed as 09:xx AM in WINDOWS taskbar.

Pls, give me solution for this problem. Thank You very much.


Satrio.I ASSUME your variable %time% looks like this:
hh:mm:ss

set time=%time::=_%
set time=%time: =%

This should substitute : through _ and set it to %time%
Then space will be substituted through no space and set it to %time%

The result %time% should be like this:
9_00_00
10_00_00

hope this helps
uliWow, that's great ! It's work fine.

C:\>echo %time%
4:44:19.39

C:\>set time=%time::=_%

C:\>set time=%time: =%

C:\>echo %Date:~-4,4%_%Date:~-10,2%_%Date:~-7,2%_%Time%.*
2005_12_29_4_44_35.85.*

I'll wait Your next ideas to make it two digits to CHANGE space char.


Thank You uli_glueck, this solution is good enough !!

3706.

Solve : Which Programm to zip Bootdisks??

Answer»

I tried DIFFERENT Programms: (WinZip, Powerarchiver...)
It is possible to make from zipped disks .exe to selfextract.
The problem is that they don´t make the disks BOOTABLE.
That MEANS I have to FORMAT the disks bootable before.

Which Programm does make bootable zipped bootdisks ?

ulii'm not sure if this addon can do this, but you can give it a try, it's official from winzip themselves.

http://www.winzip.com/prodpagecl.htm?wzhcli


greetz


blackberry

3707.

Solve : cmd-or-task promt?

Answer»

what is the cmd and what is TASK promt, is that somthing ELSE, or are it 2 names, for the same THING??

mikiQuote

what is the cmd and what is task promt, is that somthing else, or are it 2 names, for the same thing??

miki


i don't QUITE understand your QUESTION do you mean this:

What is the different between cmd (start=>run=>cmd) and Task-prompt (start=>all programs=>office accessories)Quote

i don't quite understand your question do you mean this:

What is the different between cmd (start=>run=>cmd) and Task-prompt (start=>all programs=>office accessories)


i think it is the same
3708.

Solve : Closing dos after a few seconds?

Answer»

hi GUYS is would like to create a batch file that close after five (or more/less seconds/minutes) after opening, is that possible in dos (i'm running windows XP Professional)

greetz

blackberry This waits 5 sek and exits the dos box in which the batch is running:


sleep 5
exit
:EOF

hope this helps
uliit didn't worked :s i tried this, perhaps i made a fault

@echo off
echo test
pause
sleep 10
echo hallo
exit
Quote

it doesn't worked :s i tried this, perhaps i made a fault

@echo off
echo test
pause
sleep 10
echo hallo
exit


I tried that, but it didn't work either

mikiI can´t find anything wrong in your batchfile.
Does XP have the sleep COMMAND?
If not, you need it from the ressource kit.

(Sleep is not a regular command in older windows versions.
It is in the ressource kit)

uliQuote
I can´t find anything wrong in your batchfile.
Does XP have the sleep command?
If not, you need it from the ressource kit.

uli


the command didn't worked whit me (and i see that it didn't worked whit "miki" to) what do you mean whit ressource kit, because i would do a lot to make it work, so i can TRY that method

btw, [glb]thanks for your respond[/glb] uliQuote
I can´t find anything wrong in your batchfile.
Does XP have the sleep command?
If not, you need it from the ressource kit.

uli

I checked it out in run==> cmd ==> sleep, and XP bat doesn't know the command...


mikiwhere can you download the resource kitThe ressource kit is a package with useful commandline tools and stuff from M$Soft.
Normally you get it with the server version of the OS.
Some SINGLE tools are available for download. Just Google.

uliQuote
The ressource kit is a package with useful commandline tools and stuff from M$Soft.
Normally you get it with the server version of the OS.
Some single tools are available for download. Just Google.

uli

OK, tnx for the respond but.... what do i have to type in google, i don't know a lot about dos (and i'm learning) but would love to know this one, so can you give me a link please

mikiFor XP I´d try something like XP Ressourcekit


uliQuote
For XP I´d try something like XP Ressourcekit


uli


Ok, thx, but my results are from 14, 2MB to 2KB, wat is the size of the program???

mikiok guys here i found the solution http://malektips.com/xp_dos_0002.html

[glb]a huge thanks goes to uli_glueck for his responses and tips[/glb]
good luck with it guys

blackberry You don't need a lot of fancy stuff to do that.

echo Window will close in 10 seconds
ping 1.1.1.1 -n 10 -w 1000 >%tmp%null

This works in 2K and XP.

Edit: You can Choice in 9x for this purpose.Quote
You don't need a lot of fancy stuff to do that.

echo Window will close in 10 seconds
ping 1.1.1.1 -n 10 -w 1000 >%tmp%null

This works in 2K and XP.

Edit: You can Choice in 9x for this purpose.


omg, olsome, it worked indeed, it's a good ALTERNATIVE, thanks
3709.

Solve : cmd.com...?

Answer»

Quote

that's a wonderfull idea, i tried, but...., i couldn't see the file - even when i said "display hidden folders and FILES" i couldn't see the file. Even in the search function from windows i can't see the file, only if i copy the pad in,example notepad, i can open it. But even in notepad i can't find it by clicking in folders. But my problem is allready solved , by using the tool "killbox" it worked, but a great thanx for your respond man, i appraciate it, zorro

greetz

blackberry


you speak about 'killbox', what is it???
(i have the same problem)

(miki)
killbox is freeware that deletes files that are in use. I got the link tip from fed, you can download it at this link: http://linhadefensiva.uol.com.br/dl/killboxMore tools that you even need.

http://www.subratam.org/main/index.php?option=com_content&task=view&id=19&Itemid=41Quote
More tools that you even need.

http://www.subratam.org/main/index.php?option=com_content&task=view&id=19&Itemid=41


antivirus programs and anti-spyware programs don't find the virusthanks blackberry


mikiQuote
thanks blackberry


miki


my pleasure

btw, there is a huge chance that regedit and ping don't work either, DELETE those toQuote

my pleasure

btw, there is a huge chance that regedit and ping don't work either, delete those to


you where right, they did't work either
but whit killbox, they do
thanks(again)

mikiQuote

you where right, they did't work either
but whit killbox, they do
thanks(again)

miki


no problem, nice to know that it works again Quote

no problem, nice to know that it works again

thanks for JOUR help, I didn't even noticed that is was cmd.COM,

miki
3710.

Solve : How to read an IP Address in a batch file?

Answer»

Hi

I connect to a VPN when working out of the office. I often want to only send my MS Exchange information down the VPN though and use the local internet CONNECTION for everything ELSE. I do this by adding a route via batch file, as below

@echo off
@route delete 0.0.0.0
@route -p add 0.0.0.0 mask 0.0.0.0 192.168.2.3
@route add 192.168.10.1 mask 255.255.255.255 192.168.10.188
@exit

The trouble is that as I get a different IP Address from the VPN everytime I connect I was wondering if there was a way in a batch file to read an IP address from a particular adapter (my VPN connection) so I don't have to manually edit the batchfile everytime I connect to change the local IP address (192.168.10.188 in my example). Any help would be appreciatedIf the IP address is returned from ipconfig /all, you could pipe the information to the find command and extract it that way.

Good luck. Try this, it will only work if the VPN connection is the last entry when using ipconfig /all. Hope this helps.

:: Note: the following code will extract only the last IP address from the list
ECHO.
FOR /F "TOKENS=2* DELIMS=:" %%A IN ('IPCONFIG /ALL ^| FIND "IP Address"') DO FOR %%B IN (%%A) DO SET IPADDR=%%B


:: RECORDING the IP Address to a text file and adding the routes for the session.
ECHO %IPADDR% >%temp%.\ipaddress.txt
route add 1.1.0.0 mask 255.255.0.0 %IPADDR%
route add 2.2.0.0 mask 255.255.0.0 %IPADDR%


:: Find server then add a specific route, this only works after adding routes to name server you are using.

FOR /F "TOKENS=2* DELIMS=:" %%A IN ('nslookup server.domain.com 1.1.?.? ^| FIND "Address:"') DO FOR %%B IN (%%A) DO SET FOUND=%%B
ECHO %FOUND% >%temp%.\FOUND.txt
route add %FOUND% mask 255.255.255.255 %IPADDR%Thank you very much noisy cricket, that WORKED fantastically. A great time saver if anyone else has these kind of VPN issues! I am glad it helped. I also have a batch file that will clenup the routes when you want to disconnect. If you would LIKE that script send me an e-mail at [emailprotected]

3711.

Solve : Help with unformatted HD?

Answer»

I am trying to INSTALL XP on my LAPTOP(DELL) . I can boot from the floppy drive to DOS when i use a dos boot disk , but don't know where to go from there. I tried to boot directly from the CD/DVD-rom but the 2 "recovery" XP disks from DELL are not RECOGNIZED as bootable devices. The original hard drive failed and i replaced it. On the setup screen for my BIOS, the hard drive registers the correct amount of memory.Contact Dell for assistance, even if the item is out of warranty.Did you make a copy of the "recovery" partition which Dell PUTS on their original hdd's???No, didnt get the recovery partition before i formated the first HD, talking to dell now, Thanks anyway guys.That's why it's always WISE to spend the extra $10 on a Windows CD over ANY kind of free "recovery disk".

3712.

Solve : Send credentials via Batch?

Answer» HI all.
The question I'm making could be trivial, but I'm not a DOS expert, so...

I'm writing a batch file that makes a backup from a main server to another one, that is something LIKE this:

NET USE Y: \\BKP_IP\C$
xcopy C:\DIR\*.* Y:\DIR\ /s /E /Y
.....
Net use Y: /d


Obviously, I'm executing this batch as an ADMIN user on the main server; the problem is that I have to send username and password of an admin user of the backup server by command line (that is, I'm prompted to do that).

So, what I'd need is a way to write these credentials (username+password of the destionation server) in the batch file, in order to allow me to schedule the batch.

Note that the two servers are not on the same domain, so there's not any "common" PROFILE to be used.

THANKS in advance for helping me!!Try this

net use h: \\servername\c$ /user:servername\username yourpassword

I might have miss understood the question.

Do you have rights to map admin shares but not copy files from the share?
Great!
That's what I was looking for!

I've just tried it and it works...
thanks a lot for your help!
3713.

Solve : Batch equivalents for unset and unalias?

Answer»

can nyone help me to GET the Batch equivalents for unset and UNALIAS...

ThnxsPlease confine your queries to ONE post only. On this forum multiple posts usually do Not attract a response.

3714.

Solve : unalias not working?

Answer»

unalias is not working from command prompt..
kindly help


ps: WINDOWS xpThat appears to be for Linux/Unix. Here are the XP Command LINE options...

but i dont find a equivalent of unalias in xp Although I'm not familiar with Linux/Unix it's just a POSSIBILITY that the Set command will fit the bill.

There are no BATCH programming equivalents for Unalias/Unset. Here are the batch commands.

And here is a batch programming tutorial.

Good luckOn this SITE are windows äquivalents to the bash listed

http://www.ss64.com/bash/alias.html

hope this helps
uli

3715.

Solve : Load command by file?

Answer»

Two QUESTION...
first of all....

How can I load DOS command in a batch file by a txt files?

and then...is it possibile send net USE command only if the network resource is not available?@echo off
set commands=your txt file
for /f %%a in ('type "%commands%"') do %%a
set commands=
:EOF

hope this helps
uli

3716.

Solve : MSDOS program will not start?

Answer»

I have a small CAD type program MSDOS, Homeplan 27, which used to run FINE on Win 95. I am now using a computer with Win 98 and every time I GO to start the program I get an error message, Runtime Error 200 at 3353:0091.
Does any one know why this won't start. Last night I did try it and it loaded up fine. Today it is a no go.
Thanks for any help. DougQuote from: dplums on April 23, 2007, 04:48:15 PM

I have a small CAD type program MSDOS, Homeplan 27, which used to run fine on Win 95. I am now using a computer with Win 98 and every time I go to start the program I get an error message, Runtime Error 200 at 3353:0091.
Does any one know why this won't start. Last night I did try it and it loaded up fine. Today it is a no go.
Thanks for any help. Doug

I bet it is not only Win95 to Win98 that is DIFFERENT. Is it a different computer too?

I thought I remembered something about it, but it has been a long time.
Tell you what - plug Runtime Error 200 into Google. I think you'll find several pages that TALK about a patch for running old programs on newer, faster machines. Maybe even something about a divide by zero error.

Do you still have the dongle for the program ? ?

It won't run without it.
3717.

Solve : Re=director ( > ) not working for what I need...?

Answer»

Hey EVERYONE,

I've used this site for a long time and now I finally have a question that hasn't already been addressed!

If you TYPE in this:

net use \\mypc /user:fake 1234 > test.txt

and the username/password are WRONG, then windows says:

System Error 1326 has occurred.
Logon Failure: Unknown user name or bad password

If you type test.txt there are no contents...is there any way of catching the error in a text document? Is there any other way I can identify the error if this cannot be copied to a document? THANKS for the help ahead of time.Most of the Microsoft utilities are pretty standard concerning output streams. This may be what you're looking for:

Code: [Select]net use \\mypc /user:fake 1234 2> test.txt

Good luck. Wow, that just saved me a WHOLE lot of hassle. I kneel before thee in honor, knower of dos :-POut of curiosity....what is the definition of 2>? Where did you find out about it?There are multiple output streams created by most of the Microsoft utilities.

STDIN is data stream 0
STDOUT is data stream 1
STDERR is data stream 2

There are others but these are the most widely used for redirection.

Quote

Where did you find out about it?
I thought everybody knew these things.

Actually it's documented in most DOS books in the fine print. On the internet check out Allenware. Scroll down and click the link to Batch Reference on the left SIDE of the page, and in the course reference window (upper right), you will find stdin, stdout, stderr along with pretty much anything ELSE you might need to know.

Good luck.
3718.

Solve : debug.exe.?

Answer»

Hello could someone possibly help me with this,

im trying to access sectors on a floppy disc, and with win hex i can press cntrl -g and then type in the sector i want to see,

how do i view sectors with debug, ive looked at the help commands which state

[address][drive][firstsector][number]

and say i want to see sector 10

so ive tried,

L 0 0 10 1,

and it doesn't BRING up what sector 10 in winhex shows, i believe i amn getting the last digit wrong in the command, am i right that this above line means

load a: drive, sector 10 up to sector (10 + 1), so show sector 10 -11,

and then when i press d0, it will start in sector 10, and then each new d command, CONTINUES through the dta in the sectors,

in short, how do i view sectors, say i wanted to see sector 10?


please could someone help me out here, i been trying to do this all morning and am getting now where,

could some ONE explain how the FOLLOWING is used

[address][drive][firstsector][number]


thanks guysaww come guys, please....i NEED your help!!Im pretty sure address is where you want to load the sectors, addr 100H is usually the first free one in the segment
Graham

3719.

Solve : Delete the .BAK files in a folder that are more than 7 days old?

Answer»

How Can I Delete All the .BAK Files in a Folder That Are More Than 7 Days Old?There are third party DOS utilities that can do date handling, but left alone, batch code is somewhat lacking in many features...date handling among them.

This little script should help you out:


Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("your foldergoeshere")
Set colSubFolders = f.SubFolders

For Each objFolder in colSubFolders
ShowFiles objFolder
Next

Sub ShowFiles(Fld)
Set k = fso.GetFolder(Fld)
Set s = k.SubFolders
Set kf = k.Files

For Each objFile In kf
If objFile.DateCreated < date - 7 Then
If objFile.Extension = "bak" Then
Wscript.Echo objFile & " " & objFile.DateCreated
End If
Next
End Sub


As written the script only lists files. Change the highlighted line to fso.DeleteFile(objFile). Be sure to change yourfoldergoeshere with something appropriate (ie: C:\Backup). Save the script with a vbs extension and run as cscript scriptname.vbs

I tried to modify your script as below but failed, COULD you help me to check. Thank you very much.

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("F:\test\backup")
Set colSubFolders = f.SubFolders

For Each objFolder in colSubFolders
ShowFiles objFolder
Next

Sub ShowFiles(Fld)
Set k = fso.GetFolder(Fld)
Set s = k.SubFolders
Set kf = k.Files

For Each objFile In kf
If objFile.DateCreated < date - 7 Then
If objFile.Extension = "bak" Then
fso.DeleteFile(objFile)
End If
End If
Next
End Sub
whosyourdaddy

whosyourbuddy............. I may have inadvertently introducied a property that does not exist. On the other hand it would have been helpful had you pointed out the source of the error. In any case the ORIGINAL script was overwritten and used recursion to delete all bak files in the directory and it's subdirectories.

Code: [Select]Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("F:\test\backup")
Set colFiles = f.Files

For Each objFile in colFiles
If objFile.DateCreated < date - 7 Then
If Right(objFile.Name, 4) = ".bak" Then
fso.DeleteFile(objFile)
End If
End If
Next

Note : if "f:\test\backup" does not exist, the script will fail

Good luck. Does vbs is a freeware? Need to purchase license or not?No commercial license is needed. VBScript is installed on all WINDOWS MACHINES except the earlier versions of Win95. There are commercial editors available for VBScript but Notepad works just fine. The current version of the Windows Script Host (as it is officially known) is 5.6

There is a treasure of information about VBScript at the Script Center including free scripts, free downloads, online lessons and sample scripts for doing just about anything.

Good luck. I get the answer from website as below:

Set ObjFSO = CreateObject ("Scripting.FileSystemObject")

'Pull current date
DateInfo = Now

'Delete files older than X number of days
OlderThan = "7"

'Remove number of days from date
DateInfo = DateInfo - OlderThan

WScript.Echo "Deleting files older than " & DateInfo

'Folder we're interested in
strFolder = "F:\test"

'WScript.Echo DateInfo 'Testing


'Get folder for collection

NumberOfFiles = "0"
DeletedFiles = "0"

Set objFolder = objFSO.GetFolder(strFolder)
Set colFiles = objFolder.Files
For each objFile in colFiles
'WScript.Echo objFile.DateCreated 'Testing
'WScript.Echo objFile.Name 'Testing
NumberOfFiles = NumberOfFiles + 1
If objFile.DateCreated < DateInfo Then
WScript.Echo "Deleting " & objFile.Name
objFSO.DeleteFile(objFile.Path)
DeletedFiles = DeletedFiles + 1
End If
Next
WScript.Echo "Complete"
WScript. Echo NumberOfFiles & " file(s) in directory"
WScript.Echo DeletedFiles & " file(s) deleted"I'm glad the Scripting Guys were able to help. One nice thing is if you don't find a script to do exactly want you want, you can always borrow pieces of multiple scripts to satisfy your inner scriptwriter.

Unfortunately folks have been known to take this a bit too literally and built a frankenscript which turned their PC into a BRICK.

3720.

Solve : need help using a "variable variable" in DOS?

Answer»

I'm creating a batch script that will automate the slipstreaming process for my large collection of various Windows CDs. Originally, my syntax was:
set cmdswitches="/s:%directory%" /U

set directory=windistro1
%executable% %cmdswitches%
set directory=windistro2
%executable% %cmdswitches%

Where windistro# is the correct path of the Windows CD. My second try was %%directory%%, which didn't work either. It wouldn't be hard except I'm calling these variables from another batch file so that a user can input their command line switches without having to see/edit the CODE for the main batch file. Thus, this solution isn't exactly feasible:

set directory=windistro1
set cmdswitches="/s:%directory%"
%executable% %cmdswitches%
set directory=windistro2
set cmdswitches="/s:%directory%"
%executable% %cmdswitches%

Your help is appreciated =)
OverkillMore questions than answers.

If windistro# contains a value from the environment, then should it not be set directory=%windistro1% or set directory=%windistro2%

Where did %executable% come from and does it contain a valid value? I'm guessing the %cmdswitches% values are valid for this executable.

It also depends on how the second batch file is called. If the variables are passed along the command line, the values would be referenced by the command line arguments %1-%9. You'd probably get away with using the names of the variables however, since the environment would be passed along to the called file.

Let us know. yes, i meant to say %windistro#%.

%executable% is the path to a windows update, like WinInstaller31v2.exe
%cmdswitches% are valid - the problem is that %directory% needs to be replaced by %windistro----% (i used a four character shorthand, like xppc = xp pro corporate.

the second batch file is called using:
COPY "%varsini%" "vars.bat" > STFU
CALL vars.bat

varsini is a valid filename; i have a check built into the batch file using if exist and if not exist commands. it is called rather early in the batch file. I want it to define the variables n, xppc, p, cmdswitches, and others irrelevant to this question. p is what i've been using for the %executable% (i just said %executable% because i thought it would be easier to understand ).

IF "%xppc%"=="skip" (GOTO skipxppc)
ECHO Integrating %n% with Windows XP Professional Corporate...
SET directory=%xppc%
%p% %cmdswitches%
ECHO Complete
:skipxppc
IF "%process%"=="xppc" (GOTO endxp)I'm probably having a senior moment, but you've not mentioned where an error appears and what it may be. The COPY "%varsini%" "vars.bat" > STFU is suspect if vars.bat exists; the overwrite question will be in the STFU file and the copy operation will come to a grinding halt.

By setting variables to values, they reside in the environment space and can be accessed by name from vars.bat provided they are enclosed with % symbols.

Perhaps if we could see the entire file(s) and where specifically you're having a problem, this would be a lot easier.

First, thanks for all the help sidewinder =) I appreciate it - I would get nothing done if you and people like you didn't at least try to pull me out of the quicksand

I'm trying to avoid posting the whole main file because it contains over 650 non-commented, non-blank lines, but I have a section in it devoted to cleaning up the files created by the install so your suggestion about the copy command doesn't apply

What my problem is:
*My batch file is supposed to be providing a solution to "I have one or more Windows updates that I need to slipstream with one or more Windows CDs that I have copied to my hard drive".
*I use a four letter code, like xppc, to represent a single distribution of Windows
*There are 19 potential different distributions that I am APPLYING this update to
*That four letter code is defined with some value, like C:\WINDVD2\SETUP\XP\XPPC in vars.bat
*The variable cmdswitches is given a value in vars.bat and sets the switches for the executable %p%
*I want to use the switch /s:%directory% where %directory% is different for each distribution of Windows, and is set by the four letter code.

This is what I want to have happen. directory has to be defined after cmdswitches, but %cmdswitches% has to contain %directory%. I tried setting cmdswitches to /s:%%directory%% then later using set cmdswitches=%cmdswitches% but that didn't work.

Code: [Select]set xppc=xppcpath
set cmdswitches=/s:%directory%
set p=somefile.exe

SET directory=%xppc%
%p% %cmdswitches%


Here's the vars.bat file I'm using:
Code: [Select]:: Color of DOS window
:: For help visit http://malektips.com/xp_dos_0015.html
color 0A

:: Name of update
set n=Windows Installer 3.1 v2

:: Path of update
set p=C:\WinDVD2\INTEGR8\WindowsInstaller31v2.exe

:: Switches to apply to installation
set cmdswitches="/s:%directory%"


:: Full path of the directory containing the i386 folder
:: If you wish to skip the installation, give the variable the value skip.
:: For example, to skip Windows XP MEDIA Center & Tablet PC:
:: set xpmt=skip
:: DO NOT change the variable names.

:: Windows 2000
set as2k=C:\windvd2\setup\2K\Advanced
set dc2k=C:\windvd2\setup\2K\Datacenter
set pr2k=C:\windvd2\setup\2K\Professional
set sv2k=C:\windvd2\setup\2K\Server

:: Windows XP
set xphc=C:\windvd2\setup\xp\HomeCorp
set xpho=C:\windvd2\setup\xp\HomeOEM
set xphr=C:\windvd2\setup\xp\HomeRetail
set xppc=C:\windvd2\setup\xp\ProCorp
set xppo=C:\windvd2\setup\xp\ProOEM
set xppr=C:\windvd2\setup\xp\ProRetail
set xpmt=C:\windvd2\setup\xp\MCETAB

:: Windows Server 2003
set dc23=C:\windvd2\setup\23\DatacenterCorp
set do23=C:\windvd2\setup\23\DatacenterOEM
set ec23=C:\windvd2\setup\23\EnterpriseCorp
set eo23=C:\windvd2\setup\23\EnterpriseOEM
set sc23=C:\windvd2\setup\23\ServerCorp
set so23=C:\windvd2\setup\23\ServerOEM
set wc23=C:\windvd2\setup\23\WebCorp
set wo23=C:\windvd2\setup\23\WebOEM



:: Custom Windows Name
:: Custom Windows Directory
:: Use this if you have a custom windows installation, like "Windows XP Pro Corp for Classroom N-3107"

set cwinname=
set cwinpath=skip


Here is the part that cleans up the files created by the main batch file.
Code: [Select]IF EXIST STFU (DEL STFU)
IF EXIST vars.bat (DEL vars.bat)
Cheesh, 650 lines! I guess the KISS method doesn't work here.

Looking at your code, what I see are 19 variables floating around the environment, all logic is unconditional and my personal favorite, the unresolved variable waiting for a variable that has yet to be defined. What I don't see are conditional statements or any attempt to try and tie all these variables together.

How does the front-end of this unit run? Is the user presented with a menu to choose which distribution is to be updated, or does this unit simply run from top to bottom updating every distribution?

Having so many variables makes is hard (if not impossible) to write a generic batch file. It's the value of the variables that will drive vars.bat not the names.

If the front-end of this unit presents a menu, once the user's choice is captured, a series of if statements would set a series of variables. Each if statement would set up the same set of variables using different values of course. Instead of creating variables to hold values in order to set another variable, this would be the area to hard code the values that are needed to run vars.bat. It would also make your code more readable, by virtue of setting variables to values and not other variables.

Example:
Code: [Select]echo 1. Windows 2000 Advanced
echo 2. Windows 2000 DataCenter
set /p opt=Enter CD to slipstream:
if .opt==.1 (
set directory=somepath
set cmdswitches=/s:somepath
set p=somefile.exe
)
if .opt==.2
set directory=someotherpath
set cmdswitches=/s:someotherpath
set p=somefile.exe
)
.
. rest of options go here
.
)
.
. unconditional logic to create/execute vars.bat goes here
.

Obviously if you find common code in all the if statements, you can move it outside the if sequence. Actually the set p=someprogram.exe is duplicated and can be moved outside the if sequence. The vars.bat can then use this common set of variables allowing you to write generic code and letting the processor resolve the variables.

On the other hand, if all the distributions get updated during a single run, you might consider a for loop to cycle thru all the CD's. The same logic for the variables applies, but the for command will drive the logic sequentially for all 19 distributions.

Example:
Code: [Select]for /l %%x in (1,1,19) do (
if %%x==1 (
set directory=somepath
set cmdswitches=/s:somepath
set p=somefile.exe
)
if %%x==2
set directory=someotherpath
set cmdswitches=/s:someotherpath
set p=somefile.exe
)
.
. rest of options go here
.
)
.
. unconditional logic to create/execute vars.bat goes here
.

Once you've written the logic for one option, the others should be easy and you'll notice a pattern developing. Unless you have some extreme bells and whistles in your file, I'm pretty sure you can cut down on those 650 lines.

Maybe this will give you some ideas. hehe most of the user interaction uses the getkey.com file to process the user's selection I'm going to say that it's roughly between 1/6 and 1/3 of it, between the echo lines and the IF statements that the MENUS require because of that method.

Here's my menu options:
Code: [Select]ECHO 1) Windows 2000, XP, and Server 2003
ECHO 2) Windows XP and Server 2003
ECHO 3) Windows 2000 and XP
ECHO 4) Windows 2000 and Server 2003
ECHO 5) Windows 2000 Only
ECHO 6) Windows XP Only
ECHO 7) Windows 2003 Only
ECHO 8) Custom Windows Distro

And if a user selects any one of 5-7, they are prompted with the option to install all of them, or to pick a specific version of it (IE: XP Pro Corporate).


keep in mind that I am a noob and since my knowledge is so immensely limited, I may be going about this with a totally illogical, complex approach when simplicity is simply achieved through logic

I'll play around with the FOR command, but if I have any questions do you mind if I send you a PM or e-mail via the forum, maybe attach my code so you can check it out if you have time?

Thanks
Overkill

3721.

Solve : Determine Total Folder Size?

Answer»

I want to loop through my C:\ drive and determine all folders whose size is greater than 100MB, and OUTPUT their names. I THINK this can be done with by piping dir output into the find command, but I'm having trouble because the output that I need from the result of "dir /s" for each subfolder of C:\ looks like this:

Total Files Listed:
1209 File(s) 1,298,576,686 bytes
542 Dir(s) 14,539,620,352 bytes free

So the parsing is difficult. There may be an easier solution altogether. Can anyone help me out here?

Thanks,
gmWriting recursive batch files leaves a lot to be desired. VBScript makes this a bit easier.

Code: [Select]On Error Resume Next

Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives

For each ds in dc
Select Case ds.DriveType
Case 2
Set RootDir = fso.GetFolder(ds & "\")
GetThePaths(RootDir)
End Select
Next

Function GetThePaths(Folder)
For Each Subfolder in Folder.SubFolders
If Subfolder.Size > 100000000 Then
WScript.Echo "Folder: " & Subfolder.Path & vbTab & "Size: " & Subfolder.Size
End If
GetThePaths Subfolder
Next
End Function

It written to check all your hard drive partitions. Save the script with a vbs extension and run from the command prompt as cscript scriptname.vbs.

Sidewinder: To go a step further, let's say I want to create a webpage with a listing of all the files in a directory along with things like date last updated, author, title, comments and other such file attributes.

Actually looking for a dynamic web page so when new files are added and someone clicks a link to display a "directory" of sorts, it would be dynamic instead of static or having to have someone update a webpage for the directory contents to keep it current.

Is there a listing of attributes that can be displayed from the fso?The FileSystemObject offers the following properties for files:

Attributes Property
DateCreated Property
DateLastAccessed Property
DateLastModified Property
Drive Property
IsRootFolder Property
Name Property (FileSystemObject)
ParentFolder Property
Path Property (FileSystemObject)
ShortName Property
ShortPath Property
Size Property
SubFolders Property
Type Property

The other information you requested is metadata which can be extracted by querying the BuiltInProperties of each application.

Title
Subject
Author
Keywords
Comments
Template
Last author
Revision number
Application name
Last print date
Creation date
Last save TIME
Total editing time
Number of pages
Number of words
Number of characters
Security
Category
Format
Manager
Company
Number of bytes
Number of lines
Number of paragraphs
Number of slides
Number of notes
Number of hidden Slides
Number of multimedia clips
Hyperlink base
Number of characters (with spaces)

Sidewinder,

Very cool. I wasn't aware you could use vbscript like this.....

Now I have one additional problem. My original post was a sort of simplified version of the full problem I'm tackling. The other pieces of the problem I already knew how to solve (in DOS, of course), but I don't know how to solve them in vbscript. For example....

Sometimes I need to determine if a file exists
Sometimes I need to determine if a process is running (didnt know how to do this one in DOS actually)

I was also curious about why the syntax calling GetThePath was different when it was used recursively within itself (no parentheses in that case). Do you know of a good vbscript tutorial with examples of these kinds of file system tasks....

Thanks for your help,
gmThe syntax of calling the GetThePath function actually calls for using the parentheses. I have a large closet of code snippets that I use to create workable scripts. Seems the coding style doesn't match across all of them! In any case it will work both ways and if the interpreter doesn't care neither do I.

To check if a file exists, create an INSTANCE of the FileSystemObject and use the FileExists Method:
Code: [Select]Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists("c:\windows\system32\cmd.exe") Then
' your code goes here
End If

To determine if a specific process is executing this is one way to find out:
Code: [Select]strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")

If colProcesses.Count > 0 Then
WScript.Echo "Notepad Is Executing"
Else
WScript.Echo "Notepad Is Not Executing"
End If

The two examples can be done in batch, naturally the syntax is very different! As with any language, there is more than one way to do the same thing.

I ALWAYS send users to the Script Center where you'll find a collection of samples, tools and articles explaining VBScript from the ground up.

Good luck. Thanks again Sidewinder...

Should be very useful.SW,

Thanks for the time on the fso properties. I likely posted it in the wrong forum, but it was a natural add-on to gm's question and your response. Thinking of a simple content management/article archive browser-based little diddy. I will play around with the above. Thanks also for the resource. By the way, is there a standard for metadata. Like you say, each app is different; that makes it difficult to create a dynamic browser page I would think.
You can use tasklist to find if a process is running, by piping its output through FINDSTR and using the && or || operators to check if it was successful (or unsuccessful)

I expect you know about the && and || operators. The || is two pipe symbols

The /I switch for findstr makes it case insensitive

If the operation to the left of the && is successful, the operation to the right of the && is performed.

Code: [Select]tasklist | findstr /I "notepad.exe" && echo notepad is running

If the operation to the left of the || is UNsuccessful, the operation to the right of the || is performed.

Code: [Select]tasklist | findstr /I "notepad.exe" || echo notepad is not running

Redirect to the null device if you do not want the output line of tasklist to show up.

Code: [Select]tasklist | findstr /I "notepad.exe"> nul && echo notepad is running

Of course you could be performing some other action than a simple echo, eg goto a label, or whatever, and you can use braces for multiple lines

Code: [Select]tasklist | findstr /I "notepad.exe"> nul && (
echo notepad
echo is
echo running
)

You can see this is like a block IF...ENDIF in BASIC

(I like to indent braced lines in this type of situation and also in FOR loops to make structure clearer)

Quote from: contrex on April 21, 2007, 04:08:45 AM

Code: [Select]tasklist | findstr /I "notepad.exe" && echo notepad is running
just for info, tasklist can find whether notepad.exe is running without findstr
Code: [Select]tasklist /FI "IMAGENAME eq notepad.exe" /NH
3722.

Solve : Help needed in making a batch file?

Answer»

Hi All, I am new to making batch files.

Situation is that we have a word file of 7 lacs rows. In the file, simple commands of dropping indexes and then recreating them again is there. Most of the indexes are getting recreated. I need to find such indexes which are getting dropped but not getting recreated. sample of the concerned word file is as follows -

---------------------------------------------------------
DROP INDEX DATABASE.PS_SCON_ATT_LNG
;
COMMIT
;
CREATE UNIQUE INDEX DATABASE.PS_SCON_ATT_LNG ON PFPRGP.PS_SCON_ATT_LNG
(SETID,
CNTRCT_ID,
LINE_NBR,
SCHED_LINE_NBR,
FILE_EXTENSION,
DOCUMENT,
LANGUAGE_CD) USING STOGROUP PRDGROUP PRIQTY 48 SECQTY 720 CLUSTER
BUFFERPOOL BP2 CLOSE NO
;
COMMIT
;
DROP INDEX DATABASE.PS_SCON_COMPTTRS
;
COMMIT
;
CREATE INDEX DATABASE.PS_SCON_COMPTTRS ON PFPRGP.PS_SCON_COMPTTRS
(SETID,
CNTRCT_ID,
LINE_NBR,
SCHED_LINE_NBR,
COMPETITOR_CD) USING STOGROUP PRDGROUP PRIQTY 48 SECQTY 720 CLUSTER
BUFFERPOOL BP2 CLOSE NO
;
COMMIT
;
DROP INDEX DATABASE.PSASCON_CUST_CGRP
;
DROP INDEX DATABASE.PS_SCON_CUST_CGRP
;
COMMIT
;
CREATE UNIQUE INDEX DATABASE.PS_SCON_CUST_CGRP ON
PFPRGP.PS_SCON_CUST_CGRP (SETID,
CNTRCT_ID,
SOLD_TO_CUST_ID,
CUSTOMER_GROUP) USING STOGROUP PRDGROUP PRIQTY 48 SECQTY 720
CLUSTER BUFFERPOOL BP2 CLOSE NO
;
CREATE INDEX DATABASE.PSASCON_CUST_CGRP ON PFPRGP.PS_SCON_CUST_CGRP
(SETID,
SOLD_TO_CUST_ID) USING STOGROUP PRDGROUP PRIQTY 48 SECQTY 720
BUFFERPOOL BP2 CLOSE NO
;
COMMIT
;

-------------------------------------------------------------------------------------------------

Can anyone help me with any batch file which can find such indexes which are getting dropped and not getting recreated
Or any way to create such batch file ??

Kindly help...

Thanks in advance.

Anshu.No that I know the ANSWER to this post, but you shouldn't double post your question (actually, I think you triple POSTED). Just wait for replies to come in.If that is some kind of programming language, it isn't batch. Or does he want us to make a batch file that does.....that?Well, he has also posted this on Web Design and Programming (I think), and in Programming he said something about C++ and C. I'm not GOING to do anything like converting that into batch, only to find out I didn't need to (and I;m not that good at it, so it wouldn't even work...)

anshu, are you there? What do you mean? What language is that?

And Carbon, are you like watching my posts or something, because whenever I look at New replies to my posts, you're always there.I'm just clicking the 'show new replies to your posts' and 'show unread posts since last visit' link every few minutes/when i get the chance/soemtimes...

I don't see the reason for triple posting, its hard to maintain for the OP and it can get confusing.Probably too early in the morning, but can you please explain Quote

Situation is that we have a word file of 7 lacs rows
Why are SQL statements in a Word document and what are Quote
lacs rows

Best I can suggest is to take an inventory of the existing indexes using the database catalog before dropping and recreating the indexes. After recreating the indexes, take another inventory. From there it should be a simple matter to see what is missing.



This probably should be on the Programming board but I see other members have already noticed that it has been multi-posted. I think the given sql code is of Oracle-PLSQL.
Why u dont SPOOL list of index from oracle to excel which u have drop and simply by adding the DROP or completing the syntax of drop command. U can copy to word or notepad and will run the QUERY sql editor by only filename.

3723.

Solve : Choice command in Windows2003?

Answer»

Hi All,

I am trying to write a bat file fin windows 2003.
I want to use some special character as Options.
But it is not taking as options.

When I am trying to give
CHOICE /C KHNUXDSAQ?# /M "Choose an Option"

It gives me following ERROR
ERROR: Invalid choice. The valid choice characters are: a-z, A-Z, 0-9 and ASCII
values of 128 to 254.

Please suggest me how to INCLUDE the characters ? and # in choice command options?

Regards,
NilashreeJust another option for you, I stopped using the choice command long AGO, I create menu options. If you wanted the menu to return when finished running sub just add goto menu at the end of the sub.

echo off
setlocal
Title Exchange Tools Menu
set running=c:\menu
GOTO MENU

:menu
CLS
echo Please make a selection
echo.
echo 1. Reboot Server
echo 2. Start Stopped Services
echo 3. Check Status of Exchange Services
Echo 4. Start all services
echo 5. Stop all services
echo 6. Instructions
echo.
echo 7. Exit
echo.
set /P menu1=
if "%menu1%" == "1" goto restart
if "%menu1%" == "2" goto startstop
if "%menu1%" == "3" goto check
if "%menu1%" == "4" goto startall
if "%menu1%" == "5" goto stopall
if "%menu1%" == "6" goto document
if "%menu1%" == "7" goto endApparently the Win2003 version of CHOICE is more RESTRICTIVE than the Win9x version. You may be SOL on this request: # (acsii 35) and ? (acsii 65) are not in the allowable range of keys.

Could I interest you in a square root (ascii 251) or degree symbol (ascii 248 )?

I'm suprised Microsoft resurrected CHOICE in Win2003. I wonder what Vista has planned.

The set /p command has it's uses, but unfortunately it doesn't restrict reponses to a single character without some quirky coding.

If the user doesn't select a specified option do this. Place the code below after "if "%menu1%" == "7" goto end" statment

cls
Echo Sorry you selected an invalid option, Hit enter to try again or press 7 to exit.
set /p error=
IF "%error%" == "7" (
goto end
) ELSE (
goto menu
)

I hope this helps

3724.

Solve : Redirecting command window output to file?

Answer»

Hi.

I have a network with abt. 600 ip devices.
I want to make a quick check if the devices are up or not.
For this I put the following in a batch file:

CALL PING 10.81.195.11 > "C:\ip.txt"
CALL PING 10.81.195.12 > "C:\ip.txt"
CALL PING 10.81.195.13 > "C:\ip.txt"
CALL PING 10.81.195.14 > "C:\ip.txt"
ETC..
etc...

After the batch file has run to the end i want to EXAMINE the ping history in ip.txt to find errors, but the ip.txt is overwritten in every ping.
How can I make the result from the ping APPEND and not OVERWRITE for each LINE in the batchfile?

Best Regards, Rigor


>> instead of >

Does this work for you In fact it does!
I can see why you are classified "Mentor"....
Thanks!>> adds text to the end of the specified file
> creates a file and adds text to it

3725.

Solve : Boot Disk with Hard disk support?

Answer»

Anyone know how i get to access my current C: and D: (2 partitions on the same physical disk) drives from using a Boot disk. As of now i can only use the A: drive and CDRom when i boot using a diskette.

My goal is to access Ghost.exe on the D: partition for the ability to create and restore an image.

Thanks for any help.im not sure if this will work but...

start D:\...\Ghost.exe
///
edit: trash that idea dont workYe, the problem i have is that both of my partitions are NTFS.

Further notes are that i can use Barts NETWORK boot disk and map a shared resource ok and create and restore images to that location fine. That is also a NTFS volume on a win2k server, However this particular image NEEDS to go onto the D: drive of this MACHINE, and im struggling.u should have put that in ur first post...Only the newest versions of Ghost will access NTFS drives i thought...were these FAT32 at one time and converted to NTFS or were the Ghost images created in NTFS ? ?

Bart's PE has a Ghost plugin that will work as long as the ver. of Ghost you have supports NTFS...check Bart's site for the tool.

Then all you have to do is add the Ghost .exe to your bootable Bart's CD...I have resolved it now.

If its of interest to anyone, i used a tool called NTFSdos. I copied those FILES to a second floppy. I booted to dos from a 98 dos disk to the command line. I then ran the ntfsdos.exe on the second disk and it scanned for NTFS drives and mounted them and assigned C: and D: respectively thus allowing the ability to navigate and use these drives from the command line.Quote from: Brummie on April 19, 2007, 03:12:51 AM


... thus allowing the ability to navigate and use these drives from the command line.

I'm curious - is that read only , or can you both read and write to the NTFS drives?

WillyW - see here... and here...

Quote from: Dusty on April 20, 2007, 02:58:56 AM
WillyW - see here... and here...




Had a very quick look.

The first link appears to be read only in the freeware version.
The second appears to be both read and write. Thanks.

3726.

Solve : Net User List?

Answer»

Hey,

Anyone know how to write a batch file or the command you need on MS-DOS in order to get a complete list of all the USERS on the network in the form of a list containing User Name, Full Name and Comment.

You can get a list of all the users by doing:
Net User /Domain

and you can get each users information by running:
Net User username /Domain

Now I was able to get all this stuff by writing a program that creates batch FILES to execute these commands and read the resulting files( The results of redirecting the output to text files).
However it takes way too LONG and is not a very efficient way to do it.

Anyone know any SPECIAL Net User commands or options or any special TYPE of Pipping to acheive this result?

The current environment I'm using is NT if it makes any difference.

ThanksI think the NT resource kit "addusers" (or "adduser" ?) can do this. It's here http://www.dynawell.com/support/ResKit/download/wntaddusers.asp. Have a go..

3727.

Solve : Install XP Home from DOS?

Answer»

We acquired a Fujitsu Lifebook 535xt (?) and it currently has no os on it. Before me it had Win98 and when I tried to upgrade to XP or even Win2K it wont ALLOW me to do &*#@ .
These are the steps thus far I have taken. While 98 was on it (& it might still be on the possessed machine) I used the start up disk to start os. I copied the sys command to the c:drive which then boots up system and then the system begins it eternal (and terminal) 'updating system configurations' routine. HOW DO I GET WINXP OR 2K ON THIS MACHINE VIA DOS? :-?You are making this much harder than necessary. If you have a bootable CDROM drive you make it the FIRST boot device, then just insert it and RESTART the machine then follow the prompts.

If you have a non-bootable CDROM drive, then you can use the APPROPRIATE operating system boot FLOPPIES (4 for WIn2000 and I think 6 for XP) and then it will load up your CDROM drive and finish the install from there.

What of the above are you not doing?

3728.

Solve : No boot drive available ??

Answer»

I have recentlly obtained a Dell Optiplex GXa CPU. PROCESSOR speed is 266 MHz Pentium II with 96 mb SDRAM, 2 mb SGRAM and 512 kb integrated level 2 cache. BIOS version is A09. When I try to boot it up a receive a message on the first DOS screen stating "No boot drive available, strike F1 to RETRY boot, F2 for setup utility". I went to F2 "Setup Screen", set primary drives to "Auto" and secondary drives to "NONE". From opening up the CPU case I see what to me look like 2 hard drives. There are also 2 CD ROM drives. On the setup screen toward the top of the screen it asks to designate which drive the computer should attempt to boot up from first and I indicated the CD ROM drive (as I am wanting to put Windows XP home version on it). I have tried every possible combination of settings to each of the drives, etc. on the setup screen only for the result, each time, to be, "No boot drive available....". I have no boot up disk nor know specifically what I need do do to correct this. I bought this computer used and don't know the previous user in order to obtain any more history on it. The computer will not even allow me to type any characters at all on the first, main DOS screen. Please help, timely responses are GREATLY appreciated.Make sure the drives are jumpered to CS, cable SELECT (all of them!) and then from the F2 screen set them all to auto, then reboot. Go back to F2 and look there. Do they all show up?

From the boot option screen set it to CDROM, floppy and hard drive. (I believe the GXa did have all of those options, although earlier ones did not.)

As we don't know if the drives are formatted, you should boot from a floppy (free download at www.bootdisk.com) I would suggest a Win98 disk. From there you will have to partition and format the hard drives. Post back if you have any questions on this.

Before deciding on XP Home be warned that this is not a system that will run it effectiively. Windows 98 would be a better fit.

Why don't you post he size of the hard drives, if shown, or the brand and model numbers if not. Also if you post the service tag (on the side of the machine) we can see what was originally on it when shipped.

Let's get it operational first though.

3729.

Solve : Msdos help error?

Answer»

i need to find out my subnet and defualt gateways but when i go to run than cmd and type ipconfig/all to view my information it doesnt work it gives me a error

heres a ss

Do you have cmd.exe on your computer? (search for it)
If so, try using it to run ipconfig.i just tried didnt work
What Windows is that? I can't tell anymore everything below windows 2000 seems the same to mexpNever mind I found your solution. Apparently you are stuck in Command.com Prompt. To fix this type in CD \ {enter} you should see C:> Now use IPCONFIG /ALL. You just have to get out of command.com Let me know if it WORKS or not. all im trying to do is get all my information about my inter net Exp. IP Adress Subnet Gateway, Defualt Gatewaystill no Ipconfig /all should work if you do the CD \ . ipconfig /all <- Does not work in dos if you are running from command.com/ Look at your dos screen. Notice that the bar reads Command Prompt. Command.com IPconfig is not run from command.com.. I dont want to et complicated. Yes there is a space when you type in CD / Can I get the new updated screenshot so i can diagnoise it?It is IPCONFIG /ALL

Not IPCONFIG/ALL

Note the space.it got me to c:/ it still wont workDoes the XP version of DOS have the ipconfig command I wonder?
We need SOMEONE with XP to try it.it used to work and thats the only way i know how to find out my internet info if theres away to get around that?If you want to see your Ip address and ETC.. On XP DOUBLE click on the 2 computers on the system task bar. (basically the computers that tell you you are CONNECTED.) From there there should be a tab on it that will show you your IP subnet marks. Local Ip address. etcc


<- PS note my OS

There should be a way for it to show you from that window that shows that you are connected last time i checked and use XP at schoolyeah

3730.

Solve : copying certin segment's from a file?

Answer»

im trying to copy certin segment's from files to save as delimted txt files.

item_begin armor 33 [small_shield] item_type=armor item_end
item_begin weapon 634 [short_sword] item_type=weapon item_end
so on and so on

to look like this

[small01_shield] = 33
[short_sword] = 634

thing is i can do this in excel, a batch is so much faster. i was lookin thu the "for command" but it really didn't stick. and the "copy command" didnt go futher either. maybe 1 of u guy/gal might shed some light this way.
O by the way Happy NEW year.This will parse the line and display it to the CONSOLE:

Code: [Select]@echo off
for /f "tokens=1-4" %%w in (test.txt) do echo %%z = %%y

If you want to output the data to a FILE, USE redirection:

Code: [Select]@echo off
for /f "tokens=1-4" %%w in (test.txt) do echo %%z = %%y > output.dat

Hope this helps. 8-)

3731.

Solve : Printing DOS?

Answer»

Hi, I currently run Windows 98 ver 4.10.98
Printer is HP DESKJET 710

When I am in a dos window I can not get it to print to my printer by using Shift\Print Screen. I have used the Ctrl - P key to make sure it was turned on. But when I am in dos and if I type copy Files.txt prn it will print that file, but will not print the screen, any ideas???

I hope I posted in the right spot. ~ DwightWha happens if you press Print Screen and then open up Paint and use PASTE (Control+V)?It says it can not find Paint. Although it is listed in accesories, it does not work.
I did find that if I type dir>LPT1 in dos it will print the dir, also if I type this entry type files.txt>LPT1 it will print that file. But I can still not get it to print the screen. I also uninstalled the driver for HP printer updated and reinstalled.Try tto get paint installed (Control Panel/Add and Remove Programs)Do you have MS-Office?

You can (control Print) to copy and (control v) to INSERT in Word.

uliDon't use Paint, thats for graphics. Use the block and copy features at the top of the DOS window. Paste into Notepad and print. I keep a shortcut to Notepad on my quick launch bar for easy access.Okay, I GOT paint installed and yes it copies but it copies the whole screen just like a print screen does.
I tried what uli_glueck suggested and that WORKED great, also what 2k_dummy suggested and that too worked great, so I now have two options to use, both of which are good. Thanks to all 3 of you for your help ~ Dwight

3732.

Solve : stream editing in cmd shell?

Answer» HI -
I have a file with some string tags in it like this:
...
FOO/path1
FOO/path2
FOO/path3
...

I want to replace FOO in the above file with values of my choosing (shell/environment variable values). I've tried lots of clunky things with msdos and so far have no luck.

I would much prefer to use ant or even some more functional shell (KORN or bash), but need to stick for now with the standard cmd (Win2K/XP) shell. I cannot add utilities - this has to be with the standard/default install utilities in cmd shell.

Is there any way to do this?

Thanks in advance for your assistance.

dan
The cmd shell does not have a built in SEARCH and replace function. You can try something like this:

Example:
CODE: [Select]for /f "tokens=2 delims=/" %%a in (test.txt) do echo NEW/%%a >> out.dat

The above code is to be used in a batch file. From the command line use:
Code: [Select]for /f "tokens=2 delims=/" %a in (test.txt) do echo NEW/%a >> out.dat

You can change the NEW/ string to any SET of characters you like. Some Windows Scripting languages can do this within the same file. The cmd shell cannot, therefore the output file.

Hope this helps. 8-)
3733.

Solve : Change user in command prompt?

Answer»

Quote from: Diablo416 on April 11, 2007, 09:11:46 PM



if your an xp user you dont have to switch users to be administrator,
i think its in the right click menu of the file you want access to.. but you do need to no the administrators password..

Wrong.Well, guys, I suppose only this is close to what I was looking for:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true
I've been searching for a long time and I didn't found ANYTHING else.
Enjoy i know a way to get administrator. get the computer in securemode. (im not sure if it named secure mode) but if you turn off the computer and turn on and off. then you can get into a account which only open THINGS that you need. that user is administrator!Quote from: patio on April 12, 2007, 08:48:21 AM
Quote from: Diablo416 on April 11, 2007, 09:11:46 PM


if your an xp user you dont have to switch users to be administrator,
i think its in the right click menu of the file you want access to.. but you do need to no the administrators password..

Wrong.


it does exist , my computer now doesent have it either.. but i have seen it, it might be something you have to enable first.. Quote from: Diablo416 on April 11, 2007, 09:11:46 PM
if your an xp user you dont have to switch users to be administrator,
i think its in the right click menu of the file you want access to.. but you do need to no the administrators password..

Do you mean "Run as..."?

It looks like it might WORK for programs but I have not tested it.ok, but is it possible to switch your self from limited to admin through OS on xpQuote from: Diablo416 on April 12, 2007, 07:46:57 PM
Quote from: patio on April 12, 2007, 08:48:21 AM
Quote from: Diablo416 on April 11, 2007, 09:11:46 PM


if your an xp user you dont have to switch users to be administrator,
i think its in the right click menu of the file you want access to.. but you do need to no the administrators password..

Wrong.


it does exist , my computer now doesent have it either.. but i have seen it, it might be something you have to enable first..

Where ?Quote from: goodnatureddog on April 13, 2007, 10:15:59 AM
ok, but is it possible to switch your self from limited to admin through OS on xp
Yes
You click Start, then Log off (the picture of keys) and then "Switch Users"
This is how you do this.

If you are having PROBLEMS with this, then please confirm the following:
I have Antivirus
I have Antispyware/adware
I have a valid copy of Windows XPSeems you mean the "SU" command.
It is in Windows Ressource Kit
Check this link:
http://www.ss64.com/nt/su.html

hope it helps
uliSorry, can you give me an example about this:
http://www.ss64.com/nt/su.html
You have to install the command on your MACHINE and give the account the necessary rights. Read the helpfile of the command. There is also an example in the helpfile.

uli
3734.

Solve : No boot drive available--update?

Answer»

I have recently attempted to boot up my computer (see previous post by myself--dated 1/2/06) and this is where I am at in the process. I am able to get to the screen entitled "Windows 98 Start Up menu". I CHOSE option 2--to proceeed "without CD ROM support" as I did not have Windows 98 on a CD available ( I have now managed to find such a CD). At any rate, after choosing option 2, I was given a message "preparing to start your computer", then "Diagnostic tools successfully loaded to drive D", then DOS prompt "A: \>_. Shortly thereafter, and I am sorry I cannot remember the sequence of commands I typed in (but some of them were "SYS.COM, SYS, CONFIG, FORMAT) I received a message Device driver not found: MSCD001 no valid CDROM drivers selected". At the A: \>_ I also received such ERROR messages as "Bad command or file name" and/or "Required parameter missing". Once I received the message "WARNING: All data on non-removable disk drive C will be lost. Proceed with format Y/N. I chose Yes (thinking that I was FORMATTING the hard drive (?). At one point my son my son typed in "ext" at "A: \> " and was given Extract Command Helper/ MS Cabinet Extractor Tool Version (16) 1.00.603.0, Error: cannot open file: windows (null). So, if someone could sort out this mess and tell me exactly what I need to do install drivers (or whatever else) and install Windows 98, it will be greatly appreciated. THANK YOU.From "Proceed with format Y/N" choose Y and press enter.

When it is FINISHED it will ask you if you want to name the drive. Just press enter.

Now from the a:> type in

e:\setup

and press enter

Off you go. Don't make it tougher than it is. Restart the computer and choose to start with CD-ROM support after having inserted a bootable Windows 98 or 98 Second Edition diskette.

From there, go to whatever drive letter your CD-ROM is assigned and type SETUP. Now follow the instructions and don't let the kids use a computer untill they're old enough to drive.

3735.

Solve : hide dos window?

Answer»

how to hide dos window from batch fileyour GONA need three files,,

the FIRST one save the following as .vbs
CreateObject("Wscript.Shell").RUN """" &AMP; WScript.Arguments(0) & """", 0, False

the next one.. a file to use the .vbs
wscript.exe "c:\yourvbsfile.vbs" "yourbatfile.bat"


the last one is your bat file

3736.

Solve : MSDOS Copying Question?

Answer»

Something happened with my computer and I lost a file called "wininet.dll". I then used another computer to download the file and put it onto a CD. When I turn on my computer I can't do ANYTHING but use an MSDOS command prompt. Is there anyway to copy the file from the CD onto my hard drive to fix my computer?You can, but that will not help you boot back into Windows. you can do a repair from the XP INSTALLATION CD.

Can you get into safe mode (F8 at bootup before the Windows logo)? If so you can copy the file then to see if it helps. You can ALSO choose to boot to last known good configuration afterwards if not.

An important thing to know is what happened prior to this to damage or REMOVE that file. Are you using any spyware/adware/virus protection? If so, what?

3737.

Solve : parallel port test under DOS?

Answer»

I have a parallel loopback plug, and prtport.exe to run under dos.
But i found that, the result is PASS, no MATTER i plug the loopback or not.

Is there any other UTILITY to TEST the parallel port under DOS,
for a loopback.

Or any other good suggestion.Here

3738.

Solve : Simple script Problem?

Answer»

Hi,

Following is my script:

@echo off
setlocal

IF NOT EXIST SAVE.FLG (
set /P Choice="Press Y to give SAVE.FLG = "
echo %Choice%
if /I "%Choice%"=="Y" (
echo Please give the Text to be entered in SAVE.FLG
set /P Text="Text = "
If "%Text%"=="" (
echo You haven't entered Text
echo %Text%
goto End
)
echo %Text% > SAVE.FLG
)) else (
echo SAVE.FLG already exists
)
)

endlocal
:End


The problem is that it isn't reading the VARIABLE "Choice" and "Text".
It simply asks for the values, and then doesn't registers them.
The echo variable beneath them simply prints "echo off"

Please help.I am also posting the output:

Press Y to give SAVE.FLG = Y < I am entering Y here >
ECHO is off.

Since its not reading the Choice Variable, its not asking for the Text variable either.One more update:

If i take the input of 2 variables before the first IF loop, then everything works fine.i donno about your case but this works on mine, at least , it shows me the
"Please give the Text to be entered in SAVE.FLG" step

@echo off
IF NOT EXIST SAVE.FLG (
set /p result=Press Y to give SAVE.FLG
echo choice is %result%
@echo on
if /I "%result%"=="Y" (
echo Please give the Text to be entered in SAVE.FLG
@set /P Text="Text = "
@If '%Text%'=='' (
@echo You haven't entered Text
@echo %Text%
@goto End
)
echo %Text% > SAVE.FLG
)
) else (
echo SAVE.FLG already exists
)
)


:EndAre the variable getting echoed:

Try this by OPENING a new command prompt, as sometimes it gets stored outside and then.Are you sure: :-?

I just copied your script and it doesn't reach the line
"Please give the Text to be entered in SAVE.FLG"

Neither does it echo the variable.
Please try with a new command prompt.

Thanks

You may WANT to consider KEEPING your batch CODE as simple as possible:

Code: [Select]@echo off
setlocal
if exist save.flg (
echo save.flg already exist
goto end
)
set /p result=Press Y to give SAVE.FLG
echo Choice is %result%
if /i not %result%==Y goto end
echo Please give the Text to be entered in SAVE.FLG
set /P Text="Text = "
if "%Text%"=="" (
echo You haven't entered Text
goto End
) else (
echo %Text% > SAVE.FLG )
:end
endlocal

Hope this helps. 8-)Thanks

This one works, any guesses why the above ones were not working.

Let me try to rethink the structure of my script.

3739.

Solve : Password Protect Batch File In XP ????

Answer»

Hi There...

I was wondering how I would go about password PROTECTING a batch file, this may sound silly as batch files can be easily read in a TEXT editor. However I will be compiling the batch file into a ".exe" file and encrypting it.

Is there a way of CREATING a password for a batch file and in such a way that when the user TYPES in the "password" nothing is revealed on the screen such as accessing an FTP server with Windows XP Home Edition "FTP.exe" ?

My Computer runs on Windows XP Home Edition, any help would be greatly apreciated.

Kind Regards,

nk121you can use the choice command, and if choise correct, goto...
for compiling you can use: quick batch file compiler (google for it)

3740.

Solve : FOR command, where to learn?

Answer»

does anyone knows where you can find a good explenation of the command for (example: for /f tokens="") my os is windows xp professionalI have yet to find one myself, but I suppose this one is as good as any: FOR

This is one of those commands where experience, along with trial and error, is more helpful than any documentation.

Good luck. 8-)How could you say that Sideeeee

You were the one who explained that to me. Good link Sidewinder. MAKES me a bit frustating to see the possibilities of XP compared with NT.

I use:
Windows NT Shell Scripting from Tim HILL
(Expert insight into scripting the native NT shell for system and network administrators)
ISBN: 1-57870-047-7
30,98 Euro

Don´t know if there is a new edition for XP. But I think you still can learn a lot of this book.
Hopefully I become good somewhere along the way...

On this Website are a few BOOKS listed:
http://www.robvanderwoude.com/index.html

hope this helps
ulidoes the scripts and information that you said works to under windows xp?XP has more possibilities then NT. (more qualifiers, you can parse strings from right to left in for loops...) The scripting techniques are the same.
But I am not familiar with XP, so no guarantee if the complex examples are working correct.

uli*censored*, is there NOBODY else who haves a cursus or somethingI found this one on Rob van der Woude's hp:

http://www.amazon.com/gp/reader/0789727331/ref=sib_dp_pt/102-8428632-9751345#reader-page

It sucks really that there is less stuff availaible. They all like the scripting host etc.
You can get so many books for the bash shell but...

Good luck for your search. Please tell us if you find good stuff.

uli

3741.

Solve : finding differences between 2 directories?

Answer»

Im trying to figure how I can scipt using a batch file the differences between two directories and only copying only the difference of the two to a new folder, such as lets say fold1 has files 1,2,3 and fold2 has 1,2,3,4,5,6. I want only 4,5,6 copied. thanksThere are too many variables to GIVE a definitive answer. Are you only basing this on file names or do date and times enter into this picture? What OS are you using?

If you have XP, there is a nifty little free utility that will do this: SyncToy

Let us know. 8-)Thanks, for the quick response! a utility would be great to use except for, this is going to be part of an automated script. I need to be able to do this from the command prompt..I need to be able to compare on a file to file bases not based on Date.If you have two directories, for example, d1 and d2, you may try something like:

for %%v in (dir d1) do (
if not exist d2/%%v copy %%v dest.
)

Repeat this for d2

This is not the exact batch. Just some thoughts.
Good luck!

Code: [Select]@echo off
set d1=c:\dir1
set d2=c:\dir2

for /f %%a in ('dir /B %d1%\*.*') do (
if not exist %d2%\%%a copy %d1%\%%a %d2%
)

for /f %%a in ('dir /b %d2%\*.*') do (
if not exist %d1%\%%a copy %d2%\%%a %d1%
)

Change dir1 and dir2 to your local settings.

Hope this helps. 8-)The Example sidewinder posted was perfect, if you have files that are named with spaces you will want to add "TOKENS=1* DELIMS=" to your FOR and PUT quotes around "%d2%\%%a"

(Example)

for /f "TOKENS=1* DELIMS=" %%a in ('dir /b %d1%\*.*') do (
if not exist "%d2%\%%a" copy "%d1%\%%a" %d2%Thanks! for everyones help! I will try these out and let you knowJust incase.

If there are sub directories under the souce fulder it is going to copy all the files from those FOLDERS into the ROOT of your destination folder. To prevent that from happening add /a:-d

'dir /b /a:-d %d1%\*.*'

3742.

Solve : Changing Default Directory?

Answer»

In Command Prompt, the default DIRECTORY is "C:\Documents and Settings\Nick". How can I change this to just "C:\"?RIGHT click the command prompt icon. CHOOSE properties and change the START in field to c:\

Apply the changes and ok your way out.

3743.

Solve : "Set" in batch file?

Answer»

I need to set two environment variables: test_input and test_output

set test_input=..\..\testfiles\test0.txt
set test_output=..\..\temptest\out.%test_input:..\..\testfiles\=%

This works very well under command prompt and in a batch file only with these two lines. But when I
PUT it into one of my batch file, like

if %test_exefile%==repack (
set test_input=%1 :: this line works fine and %1 will set to .\..\testfiles\test0.txt
set test_output="..\..\temptest\out.%test_input:..\..\testfiles\=%
...
)

The first set line works fine. But the second variable (test_output) will set to ..\..\temptest\out...\..\testfiles\=

I also tried to replace the second set with the
set test_output="..\..\temptest\out.%test_input:~16%"
Use this, I will set test_output="..\..\temptest\out.~16", but it works under command prompt.

Anyone can give any kind of helpful thoughts? Thanks in advance!



I do not know a lot about batch files, but I think temptest is too long a directory name.I thought that was the case. So I tried to put only those two lines into a batch file. It works.
There might be some other REASONS I don't knowMy thoughts are that the punctuation is in error:

Code: [Select]f %test_exefile%==repack (
set test_input=%1
set test_output="..\..\temptest\out.%test_input%:..\..\testfiles\=%
)

I'm not sure you really want the leading quote or the trailing % on test_output. But hey, it's your code. For what it's worth, why the set test_input=%1? Why not just use %1 directly in the set test_output?

Just my 2 cents. 8-)

Hi, expert

It's possible to use %1 to replace test_input.

If %1 is ..\..\testfiles\test0.txt and I want to set test_output is ..\..\temptest\out.test0.txt

Use environment variables, we can set test_output=out.%test_input:..\..\testfiles=%. This will remove ..\..\testfiles in %test_input%.

But if I use %1, I don't know how can I do it? Expecting your idear?
Based on your code:
Code: [Select]test_input=..\..\testfiles\test0.txt
test_output="..\..\temptest\out.%test_input:..\..\testfiles\=%

There is nothing to replace. You are TRYING to RESOLVE a variable named %test_input:..\..\testfiles\=% which doesn't exist.

If you move the %, something like this: %test_input%:..\..\testfiles\=, a replacement will be made although I'm not sure that's the result you want. Environment variables are strings resolved to their actual value and are only recognized by the surrounding %. The interpreter will not see %test_input as a replacable parameter.

What result are you looking for? 8-)

3744.

Solve : NEED HELP BADLY?

Answer»

I have a Aptiva IBM with Windows 98 on it.
when I turn it on all I get is a black screen with lots of writing on it.
Then it puts this screen up.I don't under stand it.
Can someone please help me?You're very naughty for making a double post! UserGuideAndManualQuote

You're very naughty for making a double post!

Well, the FIRST ONE wasn't going anywhere, so:
"If you don't succeed, TRY and try again." Of at least I THINK that's how it goes.Very hard to picture this problem without actually seeing it.

Lots of things it could be. Firstly i would CHECK that the hardware is functioning correctly by removeing the devices from the system, like modems, sound cards etc and see if the problem still exists with the bare essentials.What exactly does the screen say?
3745.

Solve : Creating a Folder with the Date as a Name?

Answer»

I'm TRYING to WRITE a batch file once a week to do back ups and I want it to create a folder and name it the date.
So if the date is 1-20-06 then I want the folder to be named 1-20-06.

I've toyed with a few things to try and do this but nothing works so far.

Any help would be grateful!It would have been helpful had you mentioned your OS as not all methods run on all versions of DOS/Windows. This may run on your machine:

Code: [Select] for /f "tokens=6-8 delims=/: " %%a in ('echo. ^| date') do (
set mm=%%a
set dd=%%b
set yy=%%c
)

Use %mm%-%dd%-%yy% to develop your file name.

Hope this HELPS. 8-)I am running XP Pro SP1

I'll try that later and see if it works
Thanks!Hey thanks so much I GOT it to work

Do you know any sites with good tutorials on DOS scripting? This site has a good listing of the DOS commands but not really much past that.

Like what do the delims and tokens commands do?
I just haven't seen that used anywhere.

3746.

Solve : User Account Switching?

Answer»

how/where do you install user account SWITCHING, becuase once you are on a domain, it disables that. or can you not SWITCH in that case, but only log off?What OS are you using? I'm using Windows XP, and Account Switching is already on it.You cannot use user account switching when the computer has been ADDED to a domain. You will need to log off or demote the machine back to a WORKGROUP for that functionality.

3747.

Solve : ms dos commands - simultation?

Answer»

hallo everybody !
I have a project at ms-dos commands. :-?
the project is to write a batch file that do the same thing as one of the dos commands
for example - when you write DIR it show all the files in that directory - what i need to do is to write abatch file that shows all the files in that directory without USING the dir command- (i can't choose dir cause it was the example).
so if you know how to write it or even just explain how to start doing it i'll thank you a lot.
thanx and have AGREAT weekend.
Seems to be mission impossible.

Commands like dir are the basics. They are used in Batchfiles.
You can try to simulate more complex commands.
The Unix command pwd is possible with a for loop.

uliHow about

Using REN to rename a file instead of RENAME...

I mean you WOULD be writing a batch file to do REN's WORK without using REN...not exactly understand what you really want, but when you use the copy/xcopy command
to copy files to a directory, you can see the files being copied

so i guess

copy * destdir 2>&1
or simply copy * destdir
or use xcopy

will let you see the files in the directory ...

or you could use

for %%a in (path) do ( echo %%~ftzaa )

3748.

Solve : Why "at" doesn't work...??

Answer»

Have another problem with my Command Prompt. The command "at" doesn't work. I use a limited account but I think it should work. When I type the command "at" a MESSAGE appears: "Access is denied.". Do you have any ideas how can I fix this...?Can you create a normal scheduled task under this limited account? I'm going to bet you can't. Anyways you can always use the runas command to execute the command under elevated user credentials.If you're account is limited, you probably wouldn't be able to use at because it allows you to delete schedualed (<--- CORRECT spelling needed here) events that may be used by other users.At my school, the WHOLE Command Prompt program is BLOCKED.

3749.

Solve : diablos fast find?

Answer» SIMPLE script , first ADDS all files with attributed files to a day-month-year_01A
then uses findstr to FILTER them instantly.. , then saves your search as year-mysearch.0b
so if you search for the same file again, its instant the next time... i added dates because files change,
so everyday it creates a new day-month-year_01A file

syntax
first scan - %0
search - %0 %1


@ECHO OFF
Rem Get Day,Mth & Year from %Date%
SET Day=%Date:~0,2%
set Mth=%Date:~3,2%
set Yr=%Date:~6,4%
set UF=%1
if exist %Yr%_%UF%.0B GOTO HPPR
if exist 1_%Day%-%Mth%-%Yr%_01A GOTO SERH
if not exist 1_%Day%-%Mth%-%Yr%_01A GOTO BEGN

:BEGN
CD\
dir *.* /B /S /X >>01A
ren 01A 1_%Day%-%Mth%-%Yr%_01A
attrib +S +H 1_%Day%-%Mth%-%Yr%_01A
GOTO END

:SERH
CLS
findstr %1 1_%Day%-%Mth%-%Yr%_01A >>%Yr%_%UF%.0B
attrib +S +H %Yr%-%UF%.0B
CLS
findstr %1 1_%Day%-%Mth%-%Yr%_01A
GOTO END

:HPPR
type %Yr%_%UF%.0B
GOTO END

:END


3750.

Solve : Timed task?

Answer»

can i PUT a BATCH file in timed command USING command prompttry the AT command

AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "commandthx, THATS exactly wat i needed