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.

6601.

Solve : Backing up profile data?

Answer»

Hello again!

I have a new project and Google isn’t really ASSISTING too much. Here at work, we backup the “desktop”, “favorites”, “My Recent Documents” and “My Documents” folders under each user PROFILE when replacing a computer. Lately I have been having to backup more than 60 user on several computers that have been replaced. Is it possible to create a BAT file that would copy all those folders from each profile and paste then in the same format. (i.e. copy %userprofile%\desktop to \\server\profile backups\%username%\desktop?

I have spent a BIT of TIME searching and cannot find too much about it.

Also, sometimes we connect the HDD from the computers to be replaced, to an external adapter. So we will not always be on the computer we would need to backup.

If any of this is worded weird or you need more explanation, please let me know.

I know there is a lot to this one and I REALLY appreciate the help!

Thank you!!

HoFL

6602.

Solve : Enabling my cd rom for Dos?

Answer»

Was finally able to get the memory PROBLEMS taken care of after looking around for a bit today. It finally WORKED with dos=high,umb loaded before the himem.sys DEVICE line, and emm386.exe ram loaded after himem.sys.

I notice that Arena has long loading times under dos, but runs at about the same speed in windows or dos, so I might stick with windows to play that. However, Wizardry 7 USED to always crash if I tried to run it in windows, and it is now running fine under dos.

Thank you all again for your time, I wouldn't be ENJOYING these games again without the help.

6603.

Solve : Unable to open txt file using start command?

Answer»

My BATCH file operation is,
Code =
1) Read process date & time and current date & time,
2) compare process login-date & time with current-Date & time
3) If difference is greater than 4hrs
4) terminate the process called "EXCEL.EXE"
4.1) make the entry of process termination in ClientLog.txt = which is OK, happening correctly
4.2) also write an warning message in Warning.txt & display that warning message on user screen = which is NOT WORKING, on termination of process the message txt file is getting generated but not opening/displaying on user machine(same is working OK - if i execute the batch file manually)
But here on client machines, I have scheduled this batch file to run at every 4hours using command as [for /L %h in (0,4,20) do AT \\Remote_PC_hostname %h:00 /EVERY:m,t,w,th,f,s,su "C:\PC\ClientBatchFile-Ver4.bat"],
all the operation is perfect as desired, only the Line no-5 is not functioning correctly,
pls help,
-------------------------------
set boool=0
IF %LOGGDATE% LSS %CDATE% set /a boool=%boool%+1
IF %TTDiff% GEQ 400 set /a boool=%boool%+1

if %boool% GEQ 1 (
TASKKILL /F /IM EXCEL.EXE
echo %date% l %time% l %computername% l Client Server Communication Terminated >> ClientLog.txt
echo Your AspenPlus Client-Server communication is terminated, beacause it was active for more than 4 hrs. PLEASE Save your pending work before running the simulation>>Warning.txt
start Warning.txt
) else (
echo Application is not opened for more than 4 hrs
)
GOTO End
:End
echo all d things are OK enjoy working on application sw
pause
-----------------------------------------

Thanks in advance,Quote from: Yogesh123 on February 15, 2010, 12:53:10 AM

My Batch file operation is,
Code =
1) Read process date & time and current date & time,
2) compare process login-date & time with current-Date & time
3) If difference is greater than 4hrs
4) terminate the process called "EXCEL.EXE"
4.1) make the entry of process termination in ClientLog.txt = which is OK, happening correctly
4.2) also write an warning message in Warning.txt & display that warning message on user screen = which is NOT WORKING, on termination of process the message txt file is getting generated but not opening/displaying on user machine(same is working OK - if i execute the batch file manually)
But here on client machines, I have scheduled this batch file to run at every 4hours using command as [for /L %h in (0,4,20) do AT \\Remote_PC_hostname %h:00 /EVERY:m,t,w,th,f,s,su "C:\PC\ClientBatchFile-Ver4.bat"],
all the previous operation from step 1 to 4.1 is perfect as desired, only the Line no-8 is not functioning correctly,
pls help,
-------------------------------
set boool=0
IF %LOGGDATE% LSS %CDATE% set /a boool=%boool%+1
IF %TTDiff% GEQ 400 set /a boool=%boool%+1

if %boool% GEQ 1 (
taskkill /F /IM EXCEL.EXE
echo %date% l %time% l %computername% l Client Server Communication Terminated >> ClientLog.txt
echo Your AspenPlus Client-Server communication is terminated, beacause it was active for more than 4 hrs. Please Save your pending work before running the simulation>>Warning.txt
start Warning.txt
) else (
echo Application is not opened for more than 4 hrs
)
GOTO End
:End
echo all d things are OK enjoy working on application sw
pause
-----------------------------------------

Thanks in advance,
6604.

Solve : getting stuck with rename scripts?

Answer»

I am trying to create a .bat that will move, rename (filename - date) and zip a number of files.

i have got so far and the files move successfully but the rename doesnt seem to work - i dont get any error messages back though.

also i cannot find a command which will create a zipped folder with the new files in it. i have tried wzzip, pkzip and zip but none are recognised commands.

does anyone have any suggestions?

MOVE /-y c:\Responsebackup\* c:\responsearchive\

set mm= %Date:~3,2%
set dd = %Date:~0,2%
set yy = %Date:~8,2%
for %%i in (c:\Responsearchive.*) do ren %%i %%dd-%mm-%yy.TXT


Many thanks
There are different types of variables. There are FOR LOOP variables that look like %%a or %%b , and there are also regular variables that are %variablename%. When you define dd, mm and yy, you have to wrap them in % because they are regular variables. C:\batch>type kizzie.bat

Code: [Select]@echo off
setlocal enabledelayedexpansion

copy c:\batch\backup\* c:\batch\archive\

echo Date = %date%

set mm=%Date:~4,2%
echo mm =%mm%

set dd=%Date:~0,2%
echo dd =%dd%

set yy=%date:~10,4%

echo yy =%yy%

dir c:\batch\archive\


dir /b c:\batch\archive\* > arc.txt


for /F "delims=" %%a in (arc.txt)do (ren "c:\batch\archive\%%a" "%dd%%mm%%yy%.txt" )

dir c:\batch\archive\
OUTPUT:

C:\batch>
C:\batch> kizzie.bat
c:\batch\backup\liz1212.txt
c:\batch\backup\liz1213.txt
2 file(s) copied.
Date = Sun 12/13/2009
mm =12
dd =Su
yy =2009
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3

Directory of c:\batch\archive

12/13/2009 06:01 PM .
12/13/2009 06:01 PM ..
12/13/2009 12:25 PM 13 liz1212.txt
12/13/2009 12:25 PM 13 liz1213.txt
12/13/2009 12:25 PM 13 Su12 2009.txt
3 File(s) 39 bytes
2 Dir(s) 305,513,332,736 bytes free

Directory of c:\batch\archive

12/13/2009 06:01 PM .
12/13/2009 06:01 PM ..
12/13/2009 12:25 PM 13 liz1212.txt
12/13/2009 12:25 PM 13 liz1213.txt
12/13/2009 12:25 PM 13 Su12 2009.txt
3 File(s) 39 bytes
2 Dir(s) 305,513,332,736 bytes free
C:\batch>

P.s. ren has duplicate problemsQuote from: Kizzie on December 13, 2009, 07:05:09 AM

I am trying to create a .bat that will move,copy, rename (filename - date)
I have got so far and the files move successfully but the rename doesnt seem to work - i dont get any error messages back though.

The rename above wouldhave produced duplicate names ( the system would not allow.)

The following uses the ORIGINAL name as part of the following new name.
( now the name is too long. ). Play with it to reduce name size. GOOD luck. )


for /f "delims=" %%a in (arc.txt) do (ren "c:\batch\archive\%%a" "%%a %dd%%mm%%yy%.txt" )

C:\batch>kizzie.bat
c:\batch\backup\liz1212.txt
c:\batch\backup\liz1213.txt
2 file(s) copied.
Date = Sun 12/13/2009
mm =12
dd =Su
yy =2009
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3

Directory of c:\batch\archive

12/13/2009 06:01 PM .
12/13/2009 06:01 PM ..
12/13/2009 12:25 PM 13 liz1212.txt
12/13/2009 12:25 PM 13 liz1213.txt
12/13/2009 12:25 PM 13 Su12 2009.txt
3 File(s) 39 bytes
2 Dir(s) 305,543,217,152 bytes free
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3

Directory of c:\batch\archive

12/13/2009 09:03 PM .
12/13/2009 09:03 PM ..
12/13/2009 12:25 PM 13 liz1212.txt Su12 2009.txt
12/13/2009 12:25 PM 13 liz1213.txt Su12 2009.txt
12/13/2009 12:25 PM 13 Su12 2009.txt Su12 2009.txt
3 File(s) 39 bytes
2 Dir(s) 305,543,213,056 bytes free
C:\batch>

p.s. A full path to the name ( for ren ) of the original file works best. The file with the new name must remain in the same folder. copy or xcopy are more versatile.Thankyou this second one worked great
6605.

Solve : help with a .bat file?

Answer»

Quote

if *_std.idx(

not sure what you think this will do?

Anyhow, I use this modified version (changed line in blue)


@echo off

set thisdir=%cd%

Echo Scanning subfolders

for /f "delims=" %%D in ('DIR /b /ad') do (

echo Entering subfolder: %%D

cd /d "%%D"
Echo Renaming *_std to *_std.mpg

if exist *_std (

for /f "delims=" %%S in ( ' dir /b *_std ^| FIND /v "_std.idx" ' ) do (

echo Renaming %%S to %%S.mpg

ren "%%S" "%%S.mpg"

)

) ELSE (

echo *_std : no files to process

)


Echo Renaming 2-* to 9-* to 02-* to 09-*
for %%N in (2 3 4 5 6 7 8 9) do (

if exist "%%N-*" (

for /f "delims=" %%F in ('dir /b %%N-*') do (

echo Renaming %%F to 0%%F

ren "%%F" "0%%F"

)

) else (

echo %%N-* : no files to process

)

)

cd /d %thisdir%

)

pause
Quote from: xfusion on December 14, 2009, 12:48:20 PM
then again, wouldn't this work?

Code: [SELECT]@echo off

set thisdir=%cd%

Echo Scanning subfolders

for /f "delims=" %%D in ('dir /b /ad') do (

echo Entering subfolder: %%D

cd /d "%%D"
Echo Renaming *_std to *_std.mpg
ren *_std *_std.mpg
Echo renaming 2 to 02
ren 2-* 02-*
ren 3-* 03-*
ren 4-* 04-*
ren 5-* 05-*
ren 6-* 06-*
ren 7-* 07-*
ren 8-* 08-*
ren 9-* 09-*


cd /d %thisdir%

)

pause
less informative

Why not give it a try?
6606.

Solve : bat file to copy files from folder with changing name YYYYMMDD?

Answer»

I am needing to write a bat file that copies files from a folder whose name changes daily and I need to copy those from YESTERDAYS folder. I.e. if TODAY is feb 12, 2010 i need to copy files from folder 20100211 and tomorrow I will need to copy from folder 20100212. Can anyone help me? THANKS in advanceOpen up the command prompt and type in Code: [Select]echo %date% then post what is displayed on the screen. We need to know this so we can make a code that works for your date format.it's : Sat 02/13/2010Watch out for the end-of-the-month...i could also approach this by copying contents of the most recent folder where folder name is like YYYYMMDD to a folder named current. Would this make it any more doable?pls answer helpmeh's question.
Quote from: Salmon Trout on February 14, 2010, 02:22:46 PM

pls answer helpmeh's question.

Quote from: jonfrye on February 13, 2010, 10:16:53 AM
it's : Sat 02/13/2010
Quote from: Helpmeh on February 14, 2010, 03:19:35 PM


Sorry I must be going blind. Anyhow, we don't really need the date format if we can use VBS.

Code: [Select]@echo off
Echo Wscript.echo eval(WScript.Arguments(0))>evaluate.vbs
For /f "delims=" %%A in ('cscript //nologo evaluate.vbs "year(date-1)"') do set YYYY=%%A
For /f "delims=" %%B in ('cscript //nologo evaluate.vbs "month(date-1)"') do set MM=%%B
For /f "delims=" %%C in ('cscript //nologo evaluate.vbs "day(date-1)"') do set DD=%%C
del evaluate.vbs
if %MM% LSS 10 set MM=0%MM%
if %DD% LSS 10 set DD=0%DD%
set sourcefolder=%YYYY%%MM%%DD%
set filespec=*.*
set destinfolder=c:\whatever\whatever
copy "%sourcefolder%\%filespec%" "%destinfolder%"





Outstanding, thanks very much--I APPRECIATE it immensely.Quote from: Salmon Trout on February 14, 2010, 03:39:26 PM

Code: [Select]@echo off
....
Echo Wscript.echo eval(WScript.Arguments(0))>evaluate.vbs
For /f "delims=" %%A in ('cscript //nologo evaluate.vbs "year(date-1)"') do set YYYY=%%A
For /f "delims=" %%B in ('cscript //nologo evaluate.vbs "month(date-1)"') do set MM=%%B
For /f "delims=" %%C in ('cscript //nologo evaluate.vbs "day(date-1)"') do set DD=%%C

this can be shortened (by combining the evals) so that you don't have to call cscript.exe engine 3 times. Quote from: ghostdog74 on February 14, 2010, 08:30:17 PM
this can be shortened (by combining the evals) so that you don't have to call cscript.exe engine 3 times.

Indeed. And you can eliminate the parameter passing altogether.

Code: [Select]@echo off
REM must use sign - or +
set diff= -1
Echo Wscript.echo year(date%diff%) ^& "," ^& month(date%diff%) ^& "," ^& day(date%diff%)>datecalc.vbs
For /f "tokens=1-3 delims=," %%A in ('cscript //nologo datecalc.vbs') do (
set YYYY=%%A
set MM=%%B
set DD=%%C
)
del datecalc.vbs
if %MM% LSS 10 set MM=0%MM%
if %DD% LSS 10 set DD=0%DD%
set foldername=%YYYY%%MM%%DD%
6607.

Solve : if exist bgr 100mb?

Answer»

I've a QUESTION.

i need a script that check if a file is bigger then 100MB.
if have 10 folders that contains each 2 files (c:\backup\example1.bak & c:\backup\example2.bak)

each file must be bigger than 100MB

if the file "example.bak" is smaller then 100MB, it must open the explorer.exe, so i can check that pad.
if the size is bigger then i must check the next folder

I'm a noob with dosscript and read some script here, but must i use "if exist" or "errorlevel"
can somebody help me pls with a bat file ?

thx
I think I understand what you are asking. Question: Do you have all 10 of those folders in the same folder with nothing else in it? I.e. Is it setup
C:\BakFiles\Folder1
C:\BakFiles\Folder2
etc...?
The following code will assume that you have it setup the way described above. Please identify if it is not set up in this manner so that the code can be adjusted to fit.

Code: [SELECT]@echo off
setlocal enabledelayedexpansion

cd c:\BakFiles

for /f "delims=" %%F in ('dir /s /b') do (
set path=%%~dpF
set size=%%~zF

if !size! lss 1048576 (
start /wait explorer.exe !path!
)
)

This opens explorer.exe to a folder if any file in that folder is less than 100MB. You will need to close explorer.exe for the script to continue to RUN. If they are not all under one folder, please identify if the locations change on a consistent basis or if they are set locations and not going to change regularly.thank you Raven19528 for your quick response,

i've a few servers and the files are located in different folders/names and different disk (c:, d: and e: )
and there are more files in those folders with other EXTENSION.
but in each folder are only 2 files with extension .bak

what i want to do (if possible) is that i start this .bat file on one of this server and that the script check automatic the other servers
for example a folder:

\\192.168.1.2\C$\backup
\\192.168.1.4\D$\backups\backup1
This is fairly easy to take care of. I would suggest you set up a folder that contains this batch file being written and the following .txt file so that it works as smoothly as possible. Create a new .txt file and type the full path names into it. Normally I would use computer names when you are on a server-client network as it is much more difficult for the computer name to change than the IP address:

>paths.txt
\\Server1\C$\backup
\\Server2\D$\backups\backup1
\\Server3\E$\backupstobackups\bytestobytes


Then use the following script to go through all locations and all files:

Code: [Select]@echo off
setlocal enabledelayedexpansion

for /f "delims=" %%A in (paths.txt) do (
for /f "delims=" %%B in ('dir %%A /s /b') do (
set path=%%~dpB
set size=%%~zB

if !size! lss 1048576 (
start /wait explorer.exe !path!
)
)
)
First it didn't work on my PC (windows 7 64 bit)
but when i tested on a virtual XP machine it works great.
so now i'm going to test it Monday on a windows 2003 and 2008 server.

I'll let you know the results.

thanks



Thx Raven19528,

it works great Raven,

it still works great, but needs some fine tuning

sometimes the path will change by user(s)

now i get sometimes the message "The network path was not found"

is it possible that the script give a output, when a path(s) not exist anymore
or a output .txt from all the succesfull path check ?

thx
This should help.
Code: [Select]@echo off
setlocal enabledelayedexpansion

for /f "delims=" %%A in (paths.txt) do (
IF EXIST "%%A" (
for /f "delims=" %%B in ('dir %%A /s /b') do (
set path=%%~dpB
set size=%%~zB

if !size! lss 1048576 start /wait explorer.exe !path!
)
) else (
ECHO %%A DOES NOT EXIST>>Logfile.Log
)
)Squashman,

sorry for the late respons.

but it's works.

thx for your input

6608.

Solve : Remotely create folder & copy files?

Answer»

Dear Experts,
1) I need to REMOTELY create a new folder in the C:\ of user machines,
2) also need to Remotely copy files from my machine to user machines.

Note:-
The REMOTE machines are in the DOMAIN,
I have the domain ADMIN rights/permissions.


Thanks in advance.

6609.

Solve : string inside a sting?

Answer»

So I need to loop a 'choice /c ...' %B% amount of times, setting a new veriable each time it loops named p%b%. I got the pulling thing, but %p%b%% doesnt work, and neither does %%p%b%%%. I believe you have to do this with a for loop, but when I typed for /?, I had no clue what they were talking about. If anyone could walk me through one of these that would be GREAT! A workaround would be great too code below.


Code: [Select]@echo off
if exist stop.txt del /f stop.txt
title extraSecurity
set /p p#=<p.exs
set a=0
:ploop
set /a a+=1
set /p p%a%=<p%a%.exs
if %a% EQU %p#% goto exit.ploop
goto ploop
:exit.ploop
set b=0
:cloop
set b+=1
choice /c 1234567890qwertyuiopasdfghjklzxcvbnmABCDEFGHIJKLMNOPQRSTUVWXYZ /n /cs /m "Password?"\
set de=%p%%b%%
IF %errorlevel%==%p%b%% goto end
goto exit

:end
echo OK >>stop.txt
if not exist stop.txt goto end
exit

:exit
if exist stop.txt shutdown -s -f -t 1 & if exist stop.txt exit
goto exit
Could not test your code beyond the ploop. Need more info about the exs files and their contents. Not sure why you want/need a choice statement in a for loop. Perhaps if you told us what you're trying to accomplish, we might better find a solution.

In general, I have found using a variable value as part of another variable name, it works to call a set statement and double up on the percent symbols.

I think what you are trying to do is access an array variable. In which case you would need to use delayed expansion.Quote from: Sidewinder on June 11, 2012, 06:35:04 AM

Could not test your code beyond the ploop. Need more info about the exs files and their contents. Not sure why you want/need a choice statement in a for loop. Perhaps if you told us what you're trying to accomplish, we might better find a solution.

In general, I have found using a variable value as part of another variable name, it works to call a set statement and double up on the percent symbols.


I am attempting to create a password that does not show up on the screen, thus it would CLEAR out all input as soon as you enter it, that was why I was using choice /c.

The p#.exs are just renamed text files that corrospond with the errorlevel of choice /c for the correct password.

Would you mind expanding on the 'call a set' thing you were talking about? I have never heard of it before.

Quote from: Squashman on June 11, 2012, 10:02:30 AM
I think what you are trying to do is access an array variable. In which case you would need to use delayed expansion.

Not sure what this is, but will look into it when I get home.Quote from: Lemonilla on June 11, 2012, 10:08:48 AM
I am attempting to create a password that does not show up on the screen, thus it would clear out all input as soon as you enter it, that was why I was using choice /c.

Check out this post for information on passwords and batch processing.

The posted code will not run on a 64 bit OS. Have you considered VBScript or Powershell? More verbose to be sure but you'll have more secure results.

Control-Break can circumvent any 'protections' made by way of a batch file....Quote from: BC_Programmer on June 11, 2012, 12:36:23 PM
Control-Break can circumvent any 'protections' made by way of a batch file....
Quote from: Sidewinder on June 11, 2012, 12:23:33 PM
Check out this post for information on passwords and batch processing.

The posted code will not run on a 64 bit OS. Have you considered VBScript or Powershell? More verbose to be sure but you'll have more secure results.


Sorry to be the pessimist, but I believe you guys are TOTALLY missing the point of the program. It isn't for the sake of security, I could really just ASK him not to use my computer and problem solved. It's more for the practice programming and for learning new commands.

Anyway, problem was fixed with a reorganization of code.
Code: [Select]@echo off
if exist stop.txt del /f stop.txt
title extraSecurity
set /p p#=<p.exs
set b=0

:cloop

title Letter Number:%b%
set /a b+=1
choice /c 1234567890qwertyuiopasdfghjklzxcvbnmABCDEFGHIJKLMNOPQRSTUVWXYZ /n /cs /m "Password?"
cls
set /p p=<p%b%.exs
IF %errorlevel% NEQ %p% goto exit
if %b% EQU %p#% goto end
goto cloop


:end
echo OK >>stop.txt
if not exist stop.txt goto end
exit

:exit
if exist stop.txt shutdown -s -f -t 1
if exist stop.txt exit
goto exit
6610.

Solve : Problem: Dir output to file?

Answer»

I'm writing a program that utilizes the DIR command with the windows XP command prompt and ran into a problem...

One of the directories contains the character "é" (ALT + 130) and when I output to screen it prints fine, but when I try to dump the result to a file the "é" is changed to a comma.

C:\Example> dir "*é*" /B
C:\Example\Foldér

C:\Example> dir "*é*" /b > list.txt

C:\Example> more < list.txt
C:\Example\Foldér

all seems well, but when i try to view the file with notepad/wordpad or read it with another program, i see this:
C:\Example\Fold‚r

It seems that the "comma" character is written in hex as 82 (converts to 130 in decimal which is the alt code) and is being interpreted by the command prompt as é when the character actually written in hex as "E9" (233 in decimal)

Long story short...without having to hardcode all of the possible exceptions into my program is there a way to get the command prompt to dump the text verbatim?This is a code page problem. When doing the DIR, the active code page must be one that supports accented characters. I guess your system default is an Anglo-Saxon one that does not? (most likely 850). You can check by issuing the CHCP [=change code page] command without a parameter, it will then show the current active code page. To change, use the chcp command with the number of the code page you want. For example chcp 1252 (When I am doing stuff in FRENCH or Spanish I use code page 1252 which supports the commonly used accented characters for Western European languages.) See these screen captures. Or you can change the default system code page using the Control PANEL, Regional and Language Options, Advanced tab. Plenty of info on the web about what code pages there are.

E.g.

http://www.sisulizer.com/support/codepages.shtml#HowToChange




That's certainly it; using 437 ATM. Going to write something into the source to save original code page, change to 1252 temporarily, and change back.

Appreciate the help...glad it wasn't the alternative of spending several hours coding a weak fix.

6611.

Solve : Shortcut from batch??

Answer»

Can A Batch File Posible Make A Shortcut?

THXNot directly. Shortcut are a Windows invention. There is a shortcut utility (shortcut.exe) in the Windows NT Resource Kit. I have been unable to find a singular download for the shortcut.exe file, however the kit contains other UTILITIES you may find useful.

The other method (tried and true) involves a VBScript which is fairly boilerplate and uses the same parameters you'd find if you made the shortcut manually.

The little snippet creates a desktop shortcut.

Code: [Select]set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop &AMP; "\Shortcut Script.lnk")
oShellLink.TargetPath = WScript.ScriptFullName
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "CTRL+SHIFT+F"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = strDesktop
oShellLink.Save

Fill in the oShellLink parameters with the appropriate information.

Good LUCK. There is A Software Called "XXMLINK" Which Creates Shortcut From Batch.

I've Applied Software With This

Code: [Select]xxmklink spath opath [ arg [ wdir [ desc [ mode [ icon[:n] ]]]]] [switches...]
[Saving space, attachment deleted by admin]Quote from: rem_bc on February 12, 2010, 10:16:12 PM

Can A Batch File Possible Make A Shortcut?


Here is the easy way:

Code: [Select]@echo off
start Iexplore.exe http://www.pement.org/awk/awk1line.txt
or the difficult way:

C:\>type Awk.url
Code: [Select][DEFAULT]
BASEURL=http://www.pement.org/awk/awk1line.txt
[InternetShortcut]
URL=http://www.pement.org/awk/awk1line.txt
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2C:\

p.s.: KISS ( Keep It Simple Sam )Bill brings up a good point (although the VBS solution works wonders). .URL files are still shortcuts. If you use
file://
instead of
http://
then in theorey, you can use a web shortcut as a REGULAR shortcut. Quote
[DEFAULT]
BASEURL=http://www.pement.org/awk/awk1line.txt
[InternetShortcut]
URL=http://www.pement.org/awk/awk1line.txt
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2

Oh Man Its Awesome! It Works!
6612.

Solve : Changing to a usb drive when you do not know the drive letter?

Answer»

My question is how can I change to the drive letter of my usb drive when I do not know the drive letter it is ASSIGNED to?

Here is an example...
f:
net USE Z: \\nts29\nofdata3\national /user:******
z:
cd lenovo\t61\internal\win732
xcopy *.* d:\*.*
f:
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c:
PAUSE
echo Press any key to continue
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:


When booting off a windows PE boot usb drive, it defaults to open the x drive. I want to change to my usb drive (like f: in the example) without knowing the drive letter. Can I use the usb drive label? That will at least be consistent. Any other ideas are welcome.

Thanks,
KeithLet me clarify this a bit... I realize I need to change to my usb drive to run this batch file, but I do not want to have to change the USB drive letter in this batch file everytime I run it. Say one time I boot off my Windows PE usb drive and it assignes my usb drive as e:. I do not want to have to edit this batch file and change the f: to e:. I want this batch file to select the usb drive automatically. Does this make sense? If I am not explaining this very well, sorry.

Like this...

usbdrive:
net use z: \\nts29\nofdata3\national /user:******
z:
cd lenovo\t61\internal\win732
xcopy *.* d:\*.*
usbdrive:
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c:
PAUSE
echo Press any key to continue
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:This may work, however if you have more than one removable drive on the system (not counting the USB drive, this will probably fail. You might try Windows Script.

Code: [Select]@echo off
for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "removeable"') do (
echo Removable drive is %%i:
)


Thank you very much for the reply. Keep in mind, there should be an OPTION of "EXTREME" newbie when joining this site.

I tried this...

net use z: \\nts29\nofdata3\national /user:KII\kvogler
z:
cd lenovo\t61\internal\win732
xcopy *.* d:\*.*
@echo off
for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "removeable"') do (
echo Removable drive is %%i:
)
i:
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c:
PAUSE
echo Press any key to continue
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:

It returns an error that says "The system cannot find the drive specified." and "The system cannot find the path specified."

I did do a diskpart /list volume to make sure that is the only "removable drive" available and it is...

volume 0 E dvd drive
volume 1 C partition
volume 2 D partition
volume 3 F Removable

Am I typing the syntax incorrectly? If not, i'll try the scripting forums. Thanks againCode: [Select]net use z: \\nts29\nofdata3\national /user:KII\kvogler
z:
cd lenovo\t61\internal\win732
xcopy *.* d:\*.*
@echo off
for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "removeable"') do (
echo Removable drive is %%i:
set usbdrive=%%i:
)
i:
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c:
PAUSE
echo Press any key to continue
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:

I added a variable (usbdrive) that based on your diskpart results should have a value of f: Use %usbdrive% wherever you need the f: value.

Also, these two statements:

%cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c:
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:

might be in error. The %cd% variable does not include the trailing back slash. If you need the back slash, you need to enter it yourself:

%cd%\tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c:
%cd%\tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:

Good luck. The best way to have any external drive keep it's designation as a drive letter is to give it a Volume Label and a drive letter that is outside of the parameters of any machine you use it on...
For rexample if your last drive is E: or F: commonly than pick a letter way out of the range such as L: or M;.....you get the picture...
With a Volume Label the drive will hold it's drive letter from machine to machine and won't care about getting swapped.

This Public Service announcement is brought to you by all the fine contributors here at CH Forums.

6613.

Solve : html batch?

Answer»

I need a way to retrieve html from a specific webpage WITH BATCH, and then parse it through the batch file. Any ideas?http://www.chami.com/tips/windows/062598W.html


Quote

"First, download and INSTALL URL2File Windows Application, which is the program we'll be using in this example (URL2File Windows Application is a product of Chami.com). URL2File can retrieve and save the content of a given World Wide Web URL to a local file. So, to retrieve the web page at http://www.chami.com/tips/ and save it to a local file named tips.htm, run the following command from a Windows Command Prompt/DOS Box:

URL2File http://www.chami.com/tips/ tips.htm"

Quote
I need a way to retrieve html from a specific webpage WITH BATCH, and then parse it through the batch file. Any ideas?

I doubt you can do this with batch UNLESS you run a Windows script out of a batch file. The previous post suggested a download, but that program will download the web page, not the HTML source.

This little snippet can be saved and then run from a batch file:

Code: [Select]Const url="http://www.yahoo.com/"

Set http = CreateObject("Microsoft.XMLHTTP")
Set fso = CreateObject("Scripting.FileSystemObject")

On Error Resume Next
http.open "Get", url, False
http.send ""

If Err.Number <> 0 Then
WScript.Echo "Error: " & Err.Number & ": " & Err.Description
WScript.Quit
End If

Set f = fso.CreateTextFile("Html.txt", True)
f.WriteLine http.responseText

Change the URL to whatever. The HTML source will be saved in a file named HTML.txt Save the script with a VBS extension. You can put this reference in your batch file to execute the script: cscript scriptname.vbs

Good luck.

PS. I'll leave it to you to parse the HTML code in your batch file, but it might be a whole lot easier to WRITE the entire project in VBScript.
6614.

Solve : Execute batch script depending on no. files in folder?

Answer»

Hello everybody,

I have this .bat script which has been scheduled to be executed on a SPECIFIC time of day.
The problem, is that I want to execute it as many times, as the number of files stored in a particular folder (to which this .bat Script is applied)

Can anybody help ?

Thnx in advance,
Puplithe code fragment to get the count of files in a folder:
Code: [Select]dir/a-d/b/s "c:\test"|find/c /v""Quote from: Prince_ on February 09, 2010, 03:58:20 AM

the code fragment to get the count of files in a folder:
Code: [Select]dir/a-d/b/s "c:\test"|find/c /v""
Not sure if that works, but this should do the trick.

Dir /b FOLDERNAME>dir.txt
for /f %%a in (dir.txt) do set /a count+=1
echo Number of files in the folder is %count%.
Pause > nulQuote from: Pupli on February 09, 2010, 02:45:59 AM
Number of files stored in a particular folder ?


C:\batch>type countfiles.bat
Code: [Select]@echo off

dir *.txt | wc -l
Output:
C:\batch>countfiles.bat
101 files

C:\batch>

p.s. We need to see the code for "C:\Dir1\job.bat" in order to modify to use the above count information.
Quote from: Pupli on February 09, 2010, 02:45:59 AM
Number of files stored in a particular folder?

NAME
wc -l (line count ) - lines in files
SYNOPSIS
wc [OPTION]... [FILE]...
DESCRIPTION
Print byte, word, and newline counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input.

-l, --lines
print the newline counts

http://linux.about.com/library/cmd/blcmdl1_wc.htmwc is a very good Linux/Unix utility but in view of the fact that the OP says

Quote
I have this .bat script

and POSTED in an "MS-DOS" forum, I think they would be well advised to get a version compiled for Win32, for example the one contained in the excellent GNU Core Utils.
Code: [Select]Dir /b FOLDERNAME>dir.txt
for /f %%a in (dir.txt) do set /a count+=1
echo Number of files in the folder is %count%.
Pause > nul
Yes HELPMEH ,
This snippet of code, will do the trick.
But, what if we want to test the %count% variable???

For example:

Code: [Select]Dir /b particular_Folder>dir_p_f.txt
for /f %%a in (dir_p_f.txt) do set /a count+=1
if %count%==0 ( echo.>> FolderCounter.log No files FOUND in the specified folder
move FolderCounter.log Dir1)
for /L %%b in (1 1 %count%) do call test.bat %%b
echo.>> FolderCounter.log %count% files werre loaded
move FolderCounter.log Dir1

I think that:
this piece of code:
echo.>> FolderCounter.log %count% files werre loaded
move FolderCounter.log Dir1

after:
for /L %%b in (1 1 %count%) do call test.bat %%b

will prevent the FOR loop being executed correctly.

I am right For /l %%b in (1,1,%count%) do ...

Just a little mistake. No biggie. Can you please tell me the difference

Quote
(1,1,%count%) vs. (1 1 %count%)
Becouse, it keeps executing fine in both ways !!!


P.S.
...and what about the IF condition inside the FOR loop, ... am I coding it the right way?


Thnx,
PupliQuote from: Pupli on February 10, 2010, 05:22:45 AM
Can you please tell me the difference

No difference. The documentation shows a comma but in fact it works with just a space.

Quote
and what about the IF condition inside the FOR loop, ... am I coding it the right way?

It isn't inside a loop.
Quote
It isn't inside a loop.


Oh no,
So, I have conditioned nothing regarding %count%==0

Can anyone help?
Quote
I just want my batch to test if %count%==0, and if true, just generate a .log file to explain this, and after it, exit (suspend execution)

Can it be:

Code: [Select]dir /b /a-d particular_Folder>dir_p_f.txt
for /f %%a in (dir_p_f.txt) do (set /a count+=1)
if %count%==0 (
echo.>> FolderCounter.log No files found in the specified folder
move FolderCounter.log Dir1
) else (
for /L %%b in (1 1 %count%) do call test.bat %%b
echo.>> FolderCounter.log %count% files werre loaded
move FolderCounter.log Dir1
)
Is this code a valid batch script language?
Code: [Select]dir /b /a-d particular_Folder>dir_p_f.txt
set count=0
for /f %%a in (dir_p_f.txt) do (set /a count+=1)
if %count% EQU 0 (
echo No files found in the specified folder>>FolderCounter.log
) else (
for /L %%b in (1 1 %count%) do call test.bat %%b
echo %count% files were loaded>>FolderCounter.log
)
move FolderCounter.log Dir1
Tidied up a bit; corrected spelling of 'were'.
Thank you Salmon Trout,

Thnx again

6615.

Solve : Dos command to disconnect from server drive?

Answer»

When I boot up every morning at work on my Windows XP Pro SP2 computer, 15 different network drives are loaded. Using Windows Explorer, I right click and disconnect from the unneeded drives.

Is there a Dos command for disconnecting network drives?Quote from: timrob on February 11, 2010, 08:33:25 AM

Is there a Dos command for disconnecting network drives?

Quote
"To disconnect a network drive from a DOS PROMPT (in this case drive N:) run the following
command (This will work on Windows NT and Windows XP, MAY also work on other windows but I'm not sure."
net use N: /delete
"

http://www.tiplib.com/140/disconnect-network-drive-command-prompt
Works like a CHARM. I'll put it in a batch file. Thanks.
6616.

Solve : building new dos drive for old 486 computer?

Answer»

I have and old 486 computer and ONE day the bios just stops seeing the 40gb hard drive. It has an old Award bios that isn't SUPPOSED to be able to see such a large drive. I have no idea how the computer worked with the larger drive but it did. I can boot an old QNX 500mb drive so I know the computer is ok. I'm not at the point of TRYING to flash the bios YET since it has some sort of custom made Andron 486 CPU card. I have created and formated a 500mb partition on an old drive. The bios can see it ok and I can also see the drive on an old NT desktop I have. I would like to create an image of the old hard drive partition. However the old drive partition is 2gb of which 300mb is used. The question is can I create an image of the old drive that is about 500mb so it will fit on my newly created drive?You will need to use a drive overlay software ...usually from the drive manuf. to utilize that 40G drive in a DOS enviornment...
And yes...at that point imaging thew drive would work.

6617.

Solve : Im a noob and i need help ;D?

Answer»

Hi im a noob to this..

anyway i made a batch file to load a proxy (hotspot shield), and then load a
webpage

www.pandora.com

i could really use a way to optimise the script,
foe example, the download part, i need a way for it to download directly
from hotspot
this is the link "
http://hotspotshield.com/downloads/thank-you-HR/?type=na&p=ftp&"
then i need a way for it to completly SILENTLY install hotspot
next it needs to install addon for firefox "
https://addons.mozilla.org/en-US/firefox/downloads/latest/1865/addon-1865-latest.xpi?src=search
"
if user doesnt already have firefox instaled then ofcourse
"http://download.mozilla.org/?product=firefox-3.6&os=win&lang=hr"
script should check for stuff above, and silently costume install if
something is missing
maybe it would be best to make install.bat
witch would do steps described above, and then produce main script, and move
it in c:\users\%computername%\Pandora.bat
then create a shortcut on desktop to pandora
then download
"http://marcosblog.com/gfx/pandora-favicon.gif"
and change icon to above

in the script i made an animation, to wait for 45 seconds, is there a way
for the script to check, when the hotspot has finished connecting to vpn ?
and is there a way to chose in witch browser will the link open ?

thanks for your time, i put my original script in .txt, in the attacment
note that the download section no longer works, COUSE the link to file was
temporary

and just one more question,
can the openvpntray.exe be reconfigured to just connect to vpn network,
instead of connecting, and filling up browser with comercials,
and can the batch files be used to control what browser does, (refresh
curent page, or navigate avay from current page)

and is there a way to add a download progressbar ?

thank you for your time and effort

[Saving space, attachment deleted by admin]What is the purpose of all this?
I really don't like the silently word in this context.Quote from: Salmon Trout on February 09, 2010, 01:53:40 PM

What is the purpose of all this?


Aha...

Quote
Use Hotspot Shield to access US-only websites like Hulu and Pandora

Websites like Hulu and Pandora stop non-US-American visitors right at the doorstep telling them that the contents of the website are not available to them at all. Only US-Americans are allowed and able to view the contents, in the case of the mentioned sites movies and Internet radio.

Lob was pointing out in my article on accessing Hulu from OUTSIDE the United States that there was another possibility to watch Hulu movies even if you would be living (currently or permanently) outside of the United States. His suggestion was to download and install a software called Hotspot Shield which is a free VPN solution located in the United States.

How does this fit with CH policy?

yes tahts the purpose

anyway is there a way to make my scriopt better and faster

the true purpuse of this script is to learn batch file commands (hands on)

heres the script again:
Code: [Select]
@echo off

IF EXIST "C:\Program Files\Hotspot Shield\bin\openvpntray.exe" GOTO Prolaz
Echo building script.vbs

:: starting script for downloading hotspot shield

echo ' Set your settings >> script.vbs
echo strFileURL = "http://software-files-l.cnet.com/s/software/11/19/85/99/HSS-1.37-install-anchorfree-76-conduit.exe?e=1265484555&h=a7e834c8e32b71f4a970c846b7c635fd&lop=link&ptype=1901&ontid=2092&siteId=4&edId=3&spi=3693f3a32b3f47048deaa17f4ce8ff2b&pid=11198599&psid=10594721&fileName=HSS-1.37-install-anchorfree-76-conduit.exe" >> script.vbs
echo strHDLocation = "D:\HSS-1.37-install-anchorfree-76-conduit.exe" >> script.vbs
echo. >> script.vbs
echo ' Fetch the file >> script.vbs
echo Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP") >> script.vbs
Echo. >> script.vbs
echo objXMLHTTP.open "GET", strFileURL, false >> script.vbs
echo objXMLHTTP.send() >> script.vbs
echo. >> script.vbs
echo If objXMLHTTP.Status = 200 Then >> script.vbs
echo Set objADOStream = CreateObject("ADODB.Stream") >> script.vbs
echo objADOStream.Open >> script.vbs
echo objADOStream.Type = 1 'adTypeBinary >> script.vbs
echo. >> script.vbs
echo objADOStream.Write objXMLHTTP.ResponseBody >> script.vbs
echo objADOStream.Position = 0 'Set the stream position to the start >> script.vbs
echo. >> script.vbs
echo Set objFSO = Createobject("Scripting.FileSystemObject") >> script.vbs
echo If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation >> script.vbs
echo Set objFSO = Nothing >> script.vbs
echo. >> script.vbs
echo objADOStream.SaveToFile strHDLocation >> script.vbs
echo objADOStream.Close >> script.vbs
echo Set objADOStream = Nothing >> script.vbs
echo End if >> script.vbs
echo. >> script.vbs
echo Set objXMLHTTP = Nothing >> script.vbs
Echo. >> script.vbs
Echo. >> script.vbs
echo Skript.vbs napravljena

:: script .vbs for downloading hotspot complete

echo Connecting to cnet and downloading instalation file hotspot shield
ping localhost -n 2 >nul

start/wait script.vbs

ping localhost -n 2 >nul
echo starting instalation for hotspot
ping localhost -n 2 >nul
cls

echo 1. you will get a popup for instalation of hotspot.
echo Hotspot shield je program za spajanje na VPN mrezu, koja u ovom slucaju se ponasa kao proxy. Proxy trebas iz razloga sto pandora.com odbija sve zemlje osim amerike
echo nakon sto zavrsis ovaj dio, vise se ovo nece ponavljati, dok ne izbrises hotspot shield
echo 2. Odaberi jezik instalacije
echo 3. Pritisni next
echo 4. pritisni I Agree/slazem se
echo 5. pritisni next
echo 6. skini kvacicu sa include toolbar( netreba ti to) i pritisni next
echo 7. odaberi direktorij za instalaciju (mora bit C:\Program files, tamo ce pandora.bat trazit)
echo 8. pritisni install
"D:\HSS-1.37-install-anchorfree-76-conduit.exe"
cls
echo.
echo congrats you sucesfuly installed hotspot
ping localhost -n 3 >nul
echo jos jedna vazna stvar...
echo hotspot se financira od reklama, i jako su iritantni sa svojim reklamama,
echo preporucujem da odes na https://addons.mozilla.org/en-US/firefox/
echo i instaliras si adblock plus (filter za REKLAME)
echo i preplatis/subscribe se na en us listu
echo.
echo and thats that
del D:\HSS-1.37-install-anchorfree-76-conduit.exe
del script.vbs
pause
:Prolaz
Echo hotspot installed


mode con:cols=60 lines=8

echo 1.build pandora htm

echo ^<html^>^<head^>^<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.pandora.com"^>^<head/^>^<body^>^<body/^>^<html/^> > pandora.htm


echo 2.start hotspot

start/min "" "C:\Program Files\Hotspot Shield\bin\openvpntray.exe"
echo 3. korak cekaj 45 sekundi

:: original script ia as you can see in croatian, the animation counts down...

echo 45 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 44 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 43 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 42 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 41 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 40 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 39 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 38 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 37 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 36 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 35 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 34 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 33 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 32 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 31 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 30 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 29 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 28 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 27 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 26 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 25 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 24 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 23 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 22 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 21 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 20 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 19 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 18 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 17 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 16 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 15 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 14 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 13 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 12 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 11 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 10 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 9 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 8 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 7 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 6 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 5 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 4 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 3 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 2 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 1 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo.
echo 0 \

ping localhost -n 2 >nul
cls

:: starting of pandora.htm

start/min pandora.htm

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 15 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 14 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 13 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 12 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 11 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 10 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 9 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 8 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 7 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 6 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 5 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 4 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 3 \

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 2 /

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 1 -

ping localhost -n 2 >nul
cls

echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo.
echo 0 \

ping localhost -n 2 >nul
cls


echo 1.korak napravi pandora.htm ^-znaci ignoriraj
echo 2.korak otvori hotspot shield
echo 3.korak cekaj 45 sekundi
echo 4.korak pokreni pandoraradio.htm
echo 5.korak izbrisi pandora.htm

:: deliting pandora.htm
del pandora.htm

echo.
echo.
echo closing down
ping localhost -n 5 >nul
exit




6618.

Solve : How to dump text and lines displayed in CMD to a text file?

Answer»

Hi,

I am executing a batch FILE, which calls few softwares and will RUN for few hours. The process in FORM of TEXT is displayed in command prompt . I am looking to dump the text diaplayed on the cmd to seperate file.

Kindly suggest on thisYou can redirect the output from your programs to you text file, like this

Code: [Select]REM empty the file
>textfile echo.
REM run programs and save output
>>textfile program1 param param etc
>>textfile program2 param param etc
>>textfile program3 param param etc
Thank you very much for the prompt reply

6619.

Solve : Scheduling a batch file execution?

Answer»

Hello everybody,

I have this batch script, and I want him to be executed on daily basis at 2:15PM
Now, there is always the “Schedule Tasks” of Windows XP (start -> programs -> accessories -> system tools -> scheduled tasks)
But I was told by a friend of mine, that it is not sure that it will work for .bat files 100%

Ruther he suggested, I better make use of AT Command:
Well
I tried working on it, and I got my batch script executed on 2:15PM while stating:
at 2:15PM /interactive C:\Dir1\bat_File.bat

I just want to have it executed everyday in 2:15PM

Does anyone have any idea how can I achieve this?

Moreover, is there any difference if I run the same code on a server (not remotely)

thnx in advance,
PupliTry the /Every: switch.Hi back, and thank you for your asnwer

Yes, I tried using
at 2:15PM /interactive /every:date C:\Dir1\bat_File.bat

but I don't know, why i am not TAKING what I want Quote from: Pupli on February 08, 2010, 06:42:20 AM

"He suggested, I better make use of AT Command."

rem at 2:15PM /interactive /every:date C:\Dir1\bat_File.bat

rem the interactive option will not allow to run a 2AM automaticallly

rem at /?

C:\Dir1>type bat_File.bat
echo Hello at command > c:\Dir1\bat_File.txt

C:\Dir1>

Code: [Select]C:\Dir1>at 9:51am c:\Dir1\bat_File.bat
Added a new job with job ID = 1
C:\Dir1>at
Status ID Day Time Command Line
-------------------------------------------------------------------------------
1 Today 9:51 AM c:\Dir1\bat_File.bat

C:\Dir1>dir
Volume in drive C has no label.
Volume Serial NUMBER is F4A3-D6B3

Directory of C:\Dir1

02/08/2010 09:51 AM .
02/08/2010 09:51 AM ..
02/08/2010 09:49 AM 0 at
02/08/2010 09:48 AM 44 bat_File.bat
02/08/2010 09:51 AM 19 bat_File.txt
02/08/2010 09:49 AM 0 CLS
4 File(s) 63 bytes
2 Dir(s) 300,503,519,232 bytes free

C:\Dir1>type bat_file.txt
Hello at command

C:\Dir1>Quote
rem the interactive option will not allow to run a 2AM automaticallly

Is that supossed to mean that removing the interactive option from
the code, I can have my bat_File.bat executed periodically on
daily basis at 2:15PM by making use of:

Code: [Select]at 2:15PM /every:date C:\Dir1\bat_File.bat


It just doesn't work.
Well, of course ... It really works if I just schedule it at a specific time, but just for today
It will need another "manual" schedulation the next dayI have not had a problem using Schedule Tasks. Why not try it and see if it works for you?

You can read all about the AT command here.

You can use the interactive switch to allow the task to interact with the DESKTOP of the user who is logged on at the time the task runs.

The every switch is used for either days of the month or days of the week (M,T,W,Th,F,S,Su).

Note: jobs put on the schedule by the Scheduler GUI cannot be seen by the AT command. Jobs put on the schedule by the AT command can be seen by the Scheduler GUI.

Good luck. Quote from: Pupli on February 08, 2010, 10:32:19 AM
Code: [Select]at 2:15PM /every:date C:\Dir1\bat_File.bat
http://ss64.com/nt/at.html
AT 23:30 /EVERY:m,t,w,th,f,s,su c:\backups\every_day.cmd
( I have not tested the /EVERY day procedure. brr )

"Rights needed to issue an AT command

By default only a Local Administrator can issue an AT command, a Domain Admin can direct the command at any machine.

To configure an AT job as part of a users login script - the user must be a member of the local Administrators group.

Schedule vs Task Sheduler"

Thank you, to all of you

Finally, I got my job scheduled:
Code: [Select]AT 09:00AM /INTERACTIVE /EVERY:m,t,w,th,f,s,su C:\Dir1\job.bat
Now, I have a final question:
I am loged as a local administrator in my machine, and I scheduled my job,
Now, what does it actually mean:
Quote
Note: jobs put on the schedule by the Scheduler GUI cannot be seen by the AT command. Jobs put on the schedule by the AT command can be seen by the Scheduler GUI.
Is this supposed to mean, that I can see it as a process in task manager?
Quote
Note: jobs put on the schedule by the Scheduler GUI cannot be seen by the AT command. Jobs put on the schedule by the AT command can be seen by the Scheduler GUI.
Is this supposed to mean, that I can see it as a process in task manager?

No. It means if you run the AT command with no parameters, only jobs put on the schedule with the AT command will appear in the list. If you bring up the GUI scheduler (start==accessories==>system tools==>scheduled tasks), you will see tasks scheduled with the AT command and the jobs scheduled manually with the GUI.

You are scheduling a bat file, the task manager will show cmd.exe executing when the job executes, not the name of the batch file. The cmd shell is required for all batch files as it is the interpreter for the batch code.

Quote
I am loged as a local administrator in my machine, and I scheduled my job,
Now, what does it actually mean:

Nothing in particular. The job will get the same permissions that the local administrator has. The local administrator name should show up in the task manager as the user name when the job runs.

Question: why did you use the AT command and not the GUI?

Quote
Question: why did you use the AT command and not the GUI?

Because a friend of mine told me that for jobs that need to be executed just once a day I'd better make use of the AT command. He also told me that I'd be capable to "control" it while it runs. (as I have used some pause commands thruoghout the code

Now, will you allow me to ask you:
What did you think I'll ever prefer the AT commands rather then GUI?
Quote
What did you think I'll ever prefer the AT commands rather then GUI?

Actually I didn't.

Quote
Because a friend of mine told me that for jobs that need to be executed just once a day I'd better make use of the AT command.

Did your friend explain why? Either way is fine. In fact the AT command can be used in a batch file as the target of an if statement where you can schedule a job if a certain condition is TRUE (or false). In any case, they're better than a Windows script where you have to account not only for the time but the offset from GMT.

All,

It would be great if i get a help from anyone to know how to execute a .pl script from batch file.

1. My perl script look for 3 arugment on command line

eg: g:\app\scriipts>abc.pl -Year2009 Month01 -useconfig.cfg

2. I have to make the batch file with the below logic.

Have to cut the year alone from command "date \T"

Have to cut the month from the command "date \T" and need to do -1 from the current month

Please let me know if you need anymore clarifiactions on my request.

Quote from: aarruunnmd on February 10, 2010, 10:42:22 AM
2. I have to make the batch file with the below logic.

Have to cut the year alone from command "date \T"

Have to cut the month from the command "date \T"


C:\batch>type datet.bat

Code: [Select]@echo off
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c
echo year=%year%
pause
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b
set TODAY=%year%-%month%-%day%
rem echo %TODAY%
echo.
echo.
echo The following commands build the 'date variable' called "TODAY".
echo.
echo for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c
echo for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a
echo for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b
echo set TODAY=%%year%%-%%month%%-%%day%%
echo.
echo Now ... TODAY = %TODAY%
echo.
Output:

C:\batch> datet.bat
year=2010
Press any key to continue . . .


The following commands build the 'date variable' called "TODAY".

for /f "tokens=2-4 delims=/ " %a in ('date /T') do set year=%c
for /f "tokens=2-4 delims=/ " %a in ('date /T') do set month=%a
for /f "tokens=2-4 delims=/ " %a in ('date /T') do set day=%b
set TODAY=%year%-%month%-%day%

Now ... TODAY = 2010-02-10


C:\batch>Quote from: aarruunnmd on February 10, 2010, 10:42:22 AM
All,

It would be great if i get a help from anyone to know how to execute a .pl script from batch file.

1. My perl script look for 3 arugment on command line

eg: g:\app\scriipts>abc.pl -Year2009 Month01 -useconfig.cfg

2. I have to make the batch file with the below logic.

Have to cut the year alone from command "date \T"

Have to cut the month from the command "date \T" and need to do -1 from the current month

Please let me know if you need anymore clarifiactions on my request.


if you want to cut this and that from the date command, that means you are trying to getting current time correct? Then do it inside your Perl script since you are already using it! Why do you want to use crappy batch (cmd.exe) for that , especially when it comes to dealing with date !? There are various date modules you can use with Perl for date maths, one of them is DateTime. Some others are Date::Calc etc.

6620.

Solve : This works but i'm sure there's a shorter (correct) way.?

Answer»

Hey guys, the object is to play a wav file in media player
for 37 secs. then close media player. Invisible would also be nice.
I came up with the batch file below, after a few days of learning about batch files.
I had seen a method with /play /close but that hasn't WORKED. I'm running xp, media player 11.

Start C:\chimes.wav
ping -n 38 127.0.0.1 >NUL
tskill wmplayer
EXIT







You can use a third PARTY program for a timed delay.
In my box of lost programs there is one called SLEEP.COM that lets you specify how many seconds to wait.
I can't find the link for it. I will come back later.

Yea, i have a little "SLEEP" app i could use, the closing and invisibility of wmplayer were the parts of the batch i was more curious about.
just for my own knowledge.

thanks.
H.Quote

the closing and invisibility of wmplayer were the parts of the batch i was more curious about.

By opening chimes.wav, you are presumably opening wmplayer indirectly thru the file association. You need to send a start /MIN parameter directly to the player.

Code: [Select]@echo off
Start /min wmplayer C:\chimes.wav
ping -n 38 127.0.0.1 >NUL
tskill wmplayer
exit

Don't worry about the sleep command (it comes with the Win2003 toolkit). Ping is perfectly serviceable.


thanks a lot SIDEWINDER, APPRECIATE it
6621.

Solve : adding lines to a output text file?

Answer»

I WANT to add line1 line2 line3 hard coded in the batch file to a text file. I need crlf after each line.
If I press enter it doesn't work so I need to add a crlf not enter in the batch program.

for /F "delims==" %%A in (c:\nameftp\list.txt) do
echo push/pull:push remotedirectoryname:ABC\EntryB\
filename:%%A
remoteserverIP:123.123.123.5
userID:abcid
passwd:password
emailaddr:[emailprotected]
newfilename: >> c:\ABCftp\%%A.xfr
This is how, in a batch file you add lines to a text file. Each line has a cr/lf at the end.

echo This is a line of text >> already_exists.txt
echo This is another line of text >> already_exists.txt

I am not sure what that code you posted is supposed to do? As written, it will just throw up a lot of error messages.




The prog copies the files in the list.txt the next list takes each file and add it to a line in the text file and names the file the file name plus a new ext. For each file in the dir a text file is CREATED with the file name in the txt and ren to the file name. Each line has to be on a new line.

dir/B/O:n > c:\abcftp\list.txt
for /F "delims==" %%A in (c:\abcftp\list.txt) do
echo push/pull:push >> c:\abcftp\%%A.xfr
echo remotedirectoryname:abc\EntryB\ >> c:\abcftp\%%A.xfr
echo filename:%%A >> c:\abcftp\%%A.xfr
echo remoteserverIP:123.123.12.43
echo userID:abcftpid >> c:\abcftp\%%A.xfr
echo passwd:abctflhd >> c:\abcftp\%%A.xfr
echo emailaddr:[emailprotected] >> c:\abcftp\%%A.xfr
echo newfilename: >> c:\delphiftp\%%A.xfr

thanks for the helpQuote

for /F "delims==" %%A in (c:\abcftp\list.txt) do

What do you expect this line to do?
I want to be able to start with push/pull:push and add each line to a text file on a separate line. The var %%A is the file name and is also plugged into the text where it says filename=%%A. The script works but the text to the file is on one line.

thanks muchThis line does nothing

for /F "delims==" %%A in (c:\abcftp\list.txt) do
for /F "delims==" %%A in (c:\nameftp\list.txt) do echo push/pull:push remotedirectoryname:ABC\EntryB\ filename:%%A remoteserverIP:123.123.123.5 userID:abcid passwd:password emailaddr:[emailprotected] newfilename: >> c:\ABCftp\%%A.xfr

This works but it put everything on one line in the text file. I want it on separate lines in the text file. How do you add crlf or how do you write it to add each group on a line.
example

push/pull:push
remotedirectoryname:ABC\Entry\Filename:%%A
remoteserverip:123.123.123.5
the FOR command has 2 forms

1. SINGLE line

for [...] %%V in (something) do [command]

2. Multiple line - NOTE parentheses!

for [...] %%V in (something) do (
[command]
[command]
[command]
[command]
)


So...

dir /B /O:n > c:\abcftp\list.txt
for /F "delims==" %%A in (c:\abcftp\list.txt) do (
echo push/pull:push > c:\abcftp\%%A.xfr
echo remotedirectoryname:abc\EntryB\ >> c:\abcftp\%%A.xfr
echo filename:%%A >> c:\abcftp\%%A.xfr
echo remoteserverIP:123.123.12.43 >> c:\abcftp\%%A.xfr
echo userID:abcftpid >> c:\abcftp\%%A.xfr
echo passwd:abctflhd >> c:\abcftp\%%A.xfr
echo emailaddr:[emailprotected] >> c:\abcftp\%%A.xfr
echo newfilename: >> c:\abcftp\%%A.xfr
)


thank you it works
6622.

Solve : batch file to upload PDF to dev server?

Answer»

Hi all,
New to batch files so I've got no clue where to start. After researching for hours, I've decided to finally make a post.

I need to create a batch file that uploads a pdf file to a development server. And from there, I need another batch file that will upload to our intranet server. Basically, we can't give access to the intranet server to the person who saves the original pdf but need for the pdf to be updated daily, or even better updated by a trigger when the original machine uploads to the dev server.

Help is very much appreciated.

So this is what a friend of mine WROTE for me but there seems to be something going on with the oldfiledate.txt. It's created initially and then it writes to the Y;\ but after its been created, it doesn't update anymore. The oldfiledate.txt also doesn't update the time stamp in the date MODIFIED column in Explorer, which is suspect is why the files aren't getting copied with the exception of the initial transfer.

Suggestions?

Code: [SELECT]
REM @echo off
REM **** This was written by Me for You.
REM **** This cost 2 beers. The tab is now at 8 beers. :-)

REM **** This is a batch file that can be run every minute on the server that the
REM **** end user is copying to.

REM **** Get the current file date of the file.
FOR /F "tokens=1,2,3,4,5,6 delims=/: " %%d in ('dir/n SUBLIST.pdf^|findstr /I /C:"sublist"') do set

currentfiledate=%%d%%e%%f%%g%%h%%i

REM **** Store the current date time stamp into a file.
ECHO %date% %time% > currentfiledate.txt

REM **** Uncomment the REM below here if you need to debug.
REM echo %currentfiledate%

REM **** Make sure the old file is there. If it's not, then we know we need to copy it right away.
IF NOT EXIST oldfiledate.txt GOTO nomatch

REM **** Read in the previous date time stamp of the file.
FOR /F "tokens=* " %%a in (oldfiledate.txt) do set oldfiledate=%%a

REM **** Uncomment the REM below here if you need to debug.
REM echo %oldfiledate%

REM **** Compare the current file date with a previously stored file date.
IF %oldfiledate% == %currentfiledate% (goto match) ELSE goto nomatch

REM **** Done with CHECKING. To avoid running the commands below, good programming practice
REM **** dictates we should put in a goto to the end of the program
GOTO finish

REM **** Don't do anything. The file is the same. Skip down to the end of the program.
:match
GOTO finish

REM **** Do something as the file date has changed. Once done, skip down to the end of the program.
:nomatch
REM **** Update the oldfiledate.txt so it contains the new file date/timestamp for comparison the
REM **** next time around.
COPY currentfiledate.txt oldfiledate.txt
REM **** Copy the file from server to server.
COPY /Y C:\Inetpub\wwwroot\Spirit\Forms\HR\sublist.pdf Y:\intranet\Forms\HR\sublist.pdf
GOTO finish

REM **** End of program
:finish

6623.

Solve : Batch Script not properly working --- Assign value to a variable ????

Answer»

Hello everybody,

I am working on a batch file which should load files into an ORACLE database.
Now, the overall idea is:
I have a folder in directory Dir1 in which the files are going to be stored periodically.
:: I am trying this way for loading these files into the DB:
:: At first I’m making use of this portion of code to get the file_Name of the last created file in Dir1, and
:: to write it as a single line in another file lastFileName.txt, and finally moving the lastFileName.txt to another directory Dir2


************************************************
@echo off & setLocal EnableDELAYedeXpansion
pushd C:\Dir1
for /f "tokens=* delims= " %%b in ('dir/b/a-d/o-d/tc') do (
> lastFileName.txt echo 'C:\Dir1\%%b
goto :move_file
)
:move_file
move lastFileName.txt C:\Dir2
************************************************


:: Than, I use this second portion of code, in order to get the content of lastFileName.txt, assign it to a variable (var_path_temp)
:: and use this variable THROUGHOUT the rest of this portion of code, in order to create some other files (Control.ctl and log_File.log in Dir3).
:: Finally, I load the file (retrieved from lastFileName.txt) and remove this (just loaded) file to another location Dir4


************************************************
for /f "tokens=1 delims= " %%a in (C:\Dir2\lastFileName.txt) do ( set var_path_temp=%%a
set var_path=!var_path_temp:~-20!
> Control.ctl echo load DATA infile %var_path_temp%' append into table TBL_NAME fields terminated by "," optionally enclosed by '"' (Field1, Field2, Field3)
pause
goto :move_file2
)
:move_file2
move Control.ctl C:\Dir3
sqlldr username/[emailprotected] control=C:\Dir3\Control.ctl log=C:\Dir3\% var_path %.log.log data=%var_path_temp%
goto :move_proc_files
)
:move_proc_files
for /f "tokens=1 delims= " %%c in (C:\Dir2\lastFileName.txt) do (
move %%c C:\Dir4
)
************************************************


Thnx in advance,
PupliThnx everybody,

It seems that I just resolved my problem.
I had an extra "(" in my code, and I also removed to of my GOTO statements
as they preventet the loop to be executed properly.

By the way,
I would have needed some help regarding some
error checking issues. I am now working on stating some error checking conditions depending on whether the files have been loaded successfully or not.
How can I achieve this using .bat syntax

The first condition that this batch script has to follow, is based on the Control.ctl file (and therefore the .log file)
In an algorithmic way, it would have been:

***********************************************************
IF NOT Exists Control.ctl
THEN
BREAK;
> error_log.log echo Could not create file Control.ctl;
EXIT;
ELSE
IF NOT Exists xxx.log
THEN
BREAK;
> error_log.log echo Could not create file xxx.log;
EXIT;
ELSE Continue with execution
******************************************************************

Hi again,

Well, it seems that I'm after it

I've arived in this part
Code: [Select]if not exist Control.ctl (
> error_log.log echo Could not create file Control.ctl
exit
)
if not exist xxx.log (
> error_log.log echo Could not create file xxx.log
exit
)
... HEREINAFTER STATEMENTS TO CONTINUE EXECUTION ...

but I do not understand, what is wrong

6624.

Solve : help with a batch file?

Answer»

how to make batch FILE that start when i LOG in on my pc?Put it in your Start Menu startup folder.
ok THANK you

6625.

Solve : Random words in batch??

Answer»

Hey ppl,
I have a little question, is it possible to create a BATCH file in witch the program chooses a random word from a list of words that you write in the txt file?
And what about doing the same but with words and numbers all together?
I hope u get my POINT, and yeah, im a noob, so i beg your patience
Thx!Ok. This is what you can use.

@echo off
set /a rnd=%random%%%10
for /f "tokens=1,2" %%a in (list.txt) do if %rnd%==%%a echo %%b
pause
That will get a random number from 1-10 and display a corresponding word.Im sorry but could u please explain it? For example, what i am supposed to write in list.txt? And how does it work?
Sorry but im completely lost here
Thanks for answering anyway.Quote from: Batch on FEBRUARY 07, 2010, 04:28:33 PM

Im sorry but could u please explain it? For example, what i am supposed to write in list.txt? And how does it work?
Sorry but im completely lost here
Thanks for answering anyway.
So, I will start off explaining what NEEDS to be in list.txt. This is what you could put in list.txt

Quote
1 Word1
2 Word2
3 Word3
4 Anotherword
5 ...
6 get_the_picture?

Now, I will re-post the script, with comments explaining how the code works.

@echo off
rem Turns echoing commands on-screen to off.
set /a rnd=%random%%%10
rem Gets a random number from 1-10.
for /f "tokens=1,2" %%a in (list.txt) do if %rnd%==%%a echo %%b
rem Taking the first two tokens of each line in list.txt delimited by spaces,
rem it will check if the first word is the same as the random number, and if it is,
rem it will display the SECOND word.
rem
pauseOh, ok I get it now.
Thanks a lot, problem solved!

6626.

Solve : batch file for streaming using VLC Media Player?

Answer»

How can I STREAM/multicast a video file using VLC MEDIA Player using BATCH file?

Path to the video file is C:\Users\b0068664\Desktop\Ghanshyam\New Folder\abc.vob

Generated Stream output string while I do stream using vlc mannually is:

:sout=#transcode{vcodec=mp2v,vb=1792,fps=25,scale=0.5,acodec=mpga,ab=128,channels=2,samplerate=44100}:std{access=udp,mux=ts,dst=230.1.1.1:5000}

6627.

Solve : Problem on If exist...?

Answer»

This is my code:
QUOTE

@echo off
MODE CON: COLS=80 LINES=20
Color f0
if exist /BGMBackup/ goto :continue else goto :backup
:backup
md "BGMBackup" 2>nul
md "BGMOriginal" 2>nul
copy /b "\bgm\*" "\BGMBackup"
copy /b "\bgm\*" "\BGMOriginal"
TIMEOUT 5 >nul
if exist \BGMBackup goto :edit
:continue
Color f0
copy /b "\BGMOriginal\*" "\BGM\"
START MyLauncher.exe
TIMEOUT 16 >nul
copy /b "\bgmedit\*" "\BGM\"
COLOR f2
echo: You can now start!!
TIMEOUT 5 >nul
exit
:editado
Color f0
start MyLauncher.exe
TIMEOUT 16 >nul
copy /b "\bgmedit\*" "\BGM\"
COLOR f2
echo: You can now start!!
TIMEOUT 5 >nul
exit
I want to CHECK if the folder is there... but i don't know the code ...Quote
if exist /BGMBackup/ goto :continue else goto :backup

The line above should be expressed like this.

if exist "\BGMBackup\" (goto :continue) else (goto :backup)


Your code creates folders in the current directory but then copies file EXPLICITLY to ROOT folders. That's a recipe for failure.
Change the MD commands so they create root folders too.
6628.

Solve : Verify Directory?

Answer»

I have this batch:
Code: [SELECT]@ECHO
Color f0
cd C:\Music\Game\
md BGMBackup
md bgmoriginal
cd C:\
copy C:\Music\Game\bgm\* C:\Music\Game\BGMBackup
copy C:\Music\Game\bgm\* C:\Music\Game\BGMOriginal
color f2
echo: Process Finished
TIMEOUT 3
I want to add a code that checks for for C:\Music\Game\BGMBackup
If it's there i want it to Stop the batch and not to do the backup. And a Display message that says Backup is already created, Cancelling OPERATION...

I am sorry for the trouble... Code: [Select]@echo
Color f0
If exist "C:\Music\Game\BGMBackup\" (
echo Backup is already created, Cancelling operation...
GOTO :EOF
)
cd C:\Music\Game\
md BGMBackup
md bgmoriginal
cd C:\
copy C:\Music\Game\bgm\* C:\Music\Game\BGMBackup
copy C:\Music\Game\bgm\* C:\Music\Game\BGMOriginal
color f2
echo: Process Finished
TIMEOUT 3This should do the same thing as your code but be a little more robust and also handle long pathnames.

Code: [Select]@echo
Color f0
If exist "C:\Music\Game\BGMBackup\" (
echo Backup is already created, Cancelling operation...
goto :EOF
)
echo Creating backup... please wait
md "C:\Music\Game\BGMBackup" 2&GT;nul
md "C:\Music\Game\bgmoriginal" 2>nul
copy /b "C:\Music\Game\bgm\*" "C:\Music\Game\BGMBackup" >nul
copy /b "C:\Music\Game\bgm\*" "C:\Music\Game\BGMOriginal" >nul
color f2
echo: Process Finished
TIMEOUT 3Thnx i really needed that!!

6629.

Solve : Searching for specific string in previous command output and using in next cmd?

Answer»

Hi All

I'm trying to write a batch file performing steps I've never done before (I've only done some basic stuff before).
I did search for answers but not sure exactly what to search for (terminology to use etc).

This is what I'm currently doing manually (image conversion) that I want to automate with a batch file:

I first need to identify which frame in a *.ICO file contain the 128x128 image. There is two ways to do this.

Option1:
D:\>identify icon1.ico
icon1.ico[0] ICO 16x16 16x16+0+0 32-bit DirectClass 82.7KB 0.000u 0:00.001
icon1.ico[1] ICO 32x32 32x32+0+0 32-bit DirectClass 82.7KB 0.000u 0:00.020
icon1.ico[2] ICO 48x48 48x48+0+0 32-bit DirectClass 82.7KB 0.000u 0:00.027
icon1.ico[3] ICO 128x128 128x128+0+0 32-bit DirectClass 82.7KB 0.000u 0:00.037

Option2:
D:\>convert icon1.ico -format "%s %wx%h" info:
0 16x16
1 32x32
2 48x48
3 128x128

After determining with this image that frame 3 is 128x128 I then convert the image:
D:\>convert icon1.ico[3] icon1.xpm

From the searches it seems an option is to output the info from Option1 or Option2 to a text file. Then use findstr to search through the text. But this is where I fall off the bus!!

I can search for 128x128, but how do I return the correct frame to the convert command?
I assume it will be easier to use option1 which specified the full 'frame name' to use i.e. icon1.ico[3]?
Or is there a different option instead of findstr?

This process repeats then for icon2 to 4.

Thanks in advance!I tried identify, but it didn't work, so i'm just guessing right now, but try
Code: [Select]identify icon1.ico | find "128x128"
if %errorlevel% EQU 0 convert icon1.ico[3] icon1.xpm
REM this checks if there is text output from 'identify icon1.ico' that is = "128x128"
REM this will not work if the frams 128x128 is not [3].
dont know if this helps you much, but its a start


EDIT
this will find the number that 128x128 is
Code: [Select]set a=0
:loop
convert icon1.ico -format "%s %wx%h" info: | find "%a% 128x128"
if %errorlevel% EQU 0 goto break
set /a a+=1
REM this checks if there is text output from 'identify icon1.ico' that is = "128x128"
REM this will not work if the frams 128x128 is not [3].
goto loop
:break
convert icon1.ico[%a%] icon1.xpm
ThanksI forgot to mentioned, I'm using ImageMagick to do the conversion from command line.

Thanks for the suggestion. Got it to work nicely.

When running the bat the "%s %wx%h" part was not read correctly. Ended up with convert icon.ico -format "wx instead and the batch would fail.

I had to use double % ("%%s %%wx%%h") to get it working.

I can now happily loop through the various frames and convert the correct frame/resolution.Quote from: Chaka on JULY 12, 2012, 02:40:15 AM

I forgot to mentioned, I'm using ImageMagick to do the conversion from command line.

Thanks for the suggestion. Got it to work nicely.

When running the bat the "%s %wx%h" part was not read correctly. Ended up with convert icon.ico -format "wx instead and the batch would fail.

I had to use double % ("%%s %%wx%%h") to get it working.

I can now happily loop through the various frames and convert the correct frame/resolution.

Quote
C:\>for /?
Runs a specified command for each file in a set of files.

FOR %variable IN (set) DO command [command-parameters]

%variable Specifies a single letter replaceable parameter.
(set) Specifies a set of one or more files. Wildcards may be used.
command Specifies the command to carry out for each file.
command-parameters
Specifies parameters or switches for the specified command.

To use the FOR command in a batch PROGRAM, specify %%variable instead
of %variable. Variable names are CASE sensitive, so %i is different
from %I.
Quote from: Chaka on July 12, 2012, 02:40:15 AM
I forgot to mentioned, I'm using ImageMagick to do the conversion from command line.

Thanks for the suggestion. Got it to work nicely.

When running the bat the "%s %wx%h" part was not read correctly. Ended up with convert icon.ico -format "wx instead and the batch would fail.

I had to use double % ("%%s %%wx%%h") to get it working.

I can now happily loop through the various frames and convert the correct frame/resolution.

Sorry to put you through that: just realized
Code: [Select]convert icon1.ico -format "%s %wx%h" info: | find "%a% 128x128"
was interchangable with
Code: [Select]identify icon1.ico | find "icon1.ico[%a%] ICO 128x128"
6630.

Solve : Places utility with variables?

Answer»

Quote from: Squashman on June 30, 2012, 04:48:29 PM

It would be really great if you could actually shows us the output of this following from the command prompt.
Code: [Select]C:\>echo %date%
Sat 06/30/2012

C:\>There is a way to make this regionally independent. It is a ton of of code though to add to your batch file.

The screenshot with the command line



[year+ old attachment deleted by admin]I'll for your advice after revising the screenshots

Best Regards
There is no need to post screen shots for the output of the CMD line or batch files. You can copy and paste the text from the cmd window into the forums. Posting an image just consumes more resources.this should work in spanish but if there is an option to put the month in three letter version then change jan feb mar, etc to the spanish version in the script below:

@echo off&SetLocal EnableDelayedExpansion&goto :start
:GetDate [EnVar]
echo.GetDate [EnVar] Sets date into environment variable, EnVar as: dd-mm-aaaa
echo.Usage: GetDate dma^&set ymd=%%errorlevel%%, ^(use %% rather than ^^! in command line)
echo.Usage: GetDate dma^&set ymd=^^!errorlevel^^!, ^(use ^^! rather than %% in script^)
echo.If no argument passed it echo's the date in dd-mm-aaaa format
echo.Returns aaaammdd in errorlevel regardless if Envar is passed as argument or not
echo.Works on NT/2K/XP/Vista/Win7 machines independent of most regional date settings
EndLocal&exit /b

:start
set P1=%~1&if /i "!p1!" equ "/?" goto :GetDate
if /i "%date%A" lss "A" (set toks=1-3) else (set toks=2-4)
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('date^ for /f "tokens=%toks% delims=.-/ " %%d in ('date/t') do (
set %%a=%%d&set %%b=%%e&set "%%c=%%f"
)
)
if /i "%mm:~0,1%" gtr "9" CALL :month_convert mm
if /i 1%mm% lss 20 set "mm=0%mm%"
if /i %aa% lss 100 set "aa=20%aa%"
if defined p1 (
Endlocal
call set "%~1=%dd%-%mm%-%aa%"&exit /b %yy%%mm%%aa%
)
EndLocal&echo.%dd%-%mm%-%aa%&exit /b %yy%%mm%%dd%

:month_convert
set "months=Jan Feb Mar Apr May Jun Jul Aug Sep Oct NOV Dec"
call set "month=%%%~1%%"
set/a mnum=0
for %%m in (%months%) do set/a mnum+=1&if /i %month% equ %%m call set "%~1=!mnum!"&exit /bQuote from: carlsomo on July 08, 2012, 11:37:30 PM
this should work in spanish but if there is an option to put the month in three letter version then change jan feb mar, etc to the spanish version in the script below:

@echo off&SetLocal EnableDelayedExpansion&goto :start
:GetDate [EnVar]
echo.GetDate [EnVar] Sets date into environment variable, EnVar as: dd-mm-aaaa
echo.Usage: GetDate dma^&set ymd=%%errorlevel%%, ^(use %% rather than ^^! in command line)
echo.Usage: GetDate dma^&set ymd=^^!errorlevel^^!, ^(use ^^! rather than %% in script^)
echo.If no argument passed it echo's the date in dd-mm-aaaa format
echo.Returns aaaammdd in errorlevel regardless if Envar is passed as argument or not
echo.Works on NT/2K/XP/Vista/Win7 machines independent of most regional date settings
EndLocal&exit /b

:start
set p1=%~1&if /i "!p1!" equ "/?" goto :GetDate
if /i "%date%A" lss "A" (set toks=1-3) else (set toks=2-4)
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('date^<nul') do (
for /f "tokens=%toks% delims=.-/ " %%d in ('date/t') do (
set %%a=%%d&set %%b=%%e&set "%%c=%%f"
)
)
if /i "%mm:~0,1%" gtr "9" call :month_convert mm
if /i 1%mm% lss 20 set "mm=0%mm%"
if /i %aa% lss 100 set "aa=20%aa%"
if defined p1 (
Endlocal
call set "%~1=%dd%-%mm%-%aa%"&exit /b %yy%%mm%%aa%
)
EndLocal&echo.%dd%-%mm%-%aa%&exit /b %yy%%mm%%dd%

:month_convert
set "months=Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
call set "month=%%%~1%%"
set/a mnum=0
for %%m in (%months%) do set/a mnum+=1&if /i %month% equ %%m call set "%~1=!mnum!"&exit /b

I'll try .
Best Regards
6631.

Solve : ping not responding in batch?

Answer»

Sorry to flood the forums (something like 4th thread in a month >.<), but my script SEEMS to stall on a certain command and I'm not sure why. I TRIED retyping the command into cmd and it worked, but when I try to run the script it stops on the command and just sits there. Any idea's?

Code: [Select]REM @echo off
@echo on
set c=0
if exist *.1 del /f *.1
setlocal EnableDelayedExpansion

REM set nam=%0
REM FOR /F "tokens=8 delims=\" %%G IN ("%nam%") DO (
REM set nam=%%G
REM )
REM FOR /F "tokens=1 delims=." %%G IN ("!nam!") DO (
REM set nam=%%G
REM )
REM title %nam%
title pingnet

net view | FIND "\\" >>network.1
echo.



for /f "delims=\\" %%G IN (network.1) DO (
set /a c+=1
echo %%G >>net!c!.1
)

set m=%c%
set c=0

:loop.ping
set /a c+=1
set /p y=<net%c%.1
ping %y% -n 1 | find "Min" >>ping%c%.1 <--------------------- Stalls on this command (even when i take out the redirect)
if %c% EQU %m% goto break.rename
goto loop.ping
:break.ping

set c=0

:loop.view
set /a c+=1
type net%c%.1
set /p a=<ping%c%.1
FOR /F "tokens=4 delims==" %%G IN ("%a%") DO (
del /f ping%c%.1
echo %%G >>ping%c%.1
)
if %c% EQU %m% goto break.view
goto loop.view
:break.view

:__
set c=0
set b=0
:1
set /a c+=1
del /f ping%c%.1
set /p a=<net%c%.1
ping %a%| find "Min" >>ping%c%.1
set /p a=<ping%c%.1
FOR /F "tokens=4 delims==" %%G IN ("%a%") DO (
del /f ping%c%.1
echo %%G >>ping%c%.1
)
:2
set /a b+=1
if %b% EQU %c% goto 3
type net%b%.1
type ping%b%.1
goto 2

:3
set /p 0=< net%c%.1
echo %0%*
type ping%c%.1
if %c% EQU %m% goto __
:4
set /a b+=1
type net%b%.1
type ping%b%.1
if %c% EQU %m% goto __
goto 1

screen output:
Code: [Select]

C:\Users\andude3\Documents\bat>set c=0

C:\Users\andude3\Documents\bat>if exist *.1 del /f *.1

C:\Users\andude3\Documents\bat>setlocal EnableDelayedExpansion

C:\Users\andude3\Documents\bat>REM set nam="C:\Users\andude3\Documents\bat\pingn
etAutoUpdate.bat"

C:\Users\andude3\Documents\bat>REM FOR /F "tokens=8 delims=\" %G IN ("") DO (

C:\Users\andude3\Documents\bat>REM set nam=%G

C:\Users\andude3\Documents\bat>REM )

C:\Users\andude3\Documents\bat>REM FOR /F "tokens=1 delims=." %G IN ("!nam!") DO
(

C:\Users\andude3\Documents\bat>REM set nam=%G

C:\Users\andude3\Documents\bat>REM )

C:\Users\andude3\Documents\bat>REM title

C:\Users\andude3\Documents\bat>title pingnet

C:\Users\andude3\Documents\bat>net view | find "\\" 1>>network.1

C:\Users\andude3\Documents\bat>echo.


C:\Users\andude3\Documents\bat>for /F "delims=\\" %G IN (network.1) DO (
set /a c+=1
echo %G 1>>net!c!.1
)

C:\Users\andude3\Documents\bat>(
set /a c+=1
echo LEMONILLA
1>>net!c!.1
)

C:\Users\andude3\Documents\bat>(
set /a c+=1
echo NATHANSCHOOL
1>>net!c!.1
)

C:\Users\andude3\Documents\bat>set m=2

C:\Users\andude3\Documents\bat>set c=0

C:\Users\andude3\Documents\bat>set /a c+=1

C:\Users\andude3\Documents\bat>set /p y= 0<net1.1

C:\Users\andude3\Documents\bat>ping LEMONILLA
-n 1 | find "Min" 1>>ping1.1
I was going to suggest using @echo on but I see you have already tried that.

By the way the second line below is redundant...

REM @echo off
@echo on

Your output seems to be from a different script. The one you posted does not seem to have echo LEMONILLA or echo NATHANSCHOOL in it

For some reason the window uses wordwrap when I run the scrip, it says echo LEMONILLA on one line when in fact the line is cut into 2 diffrent segments on the screen. The command from the scrip is
Code: [Select]echo %y% >>net!c!.1
where:
y = LEMONILLA
c = 1

this is also true with ping, which sticks. could this have something to do with the problem?You code shows a label called break.rename but does it exist?

If so then try this to see if the ping line is executing in an endless fashion.

Code: [Select]:loop.ping
set /a c+=1
set /p y=<net%c%.1
ping %y% -n 1 | find "Min" >>ping%c%.1 <--------------------- Stalls on this command (even when i take out the redirect)

echo %c% %m%

if %c% EQU %m% goto break.rename
goto loop.pingQuote from: foxidrive on July 11, 2012, 08:19:27 AM

You code shows a label called break.rename but does it exist?

If so then try this to see if the ping line is executing in an endless fashion.

Code: [Select]:loop.ping
set /a c+=1
set /p y=<net%c%.1
ping %y% -n 1 | find "Min" >>ping%c%.1 <--------------------- Stalls on this command (even when i take out the redirect)

echo %c% %m%

if %c% EQU %m% goto break.rename
goto loop.ping

I made the change, and also added the echo %c% you did for testing, but it never echoed. Thank you for the response.Does %y% expand to a meaningful ip or host name?
Host name, in the case of the stall 'LEMONILLA' which is the host computer.You are trying to ping localhost using its network name?

To test this try changing this

ping %y% -n 1 | find "Min" >>ping%c%.1

to this

ping %y% -n 1
pause

and watch it to see what the error message is.That seems to be the problem :/ I'm not actually getting an error.
Code: [Select]C:\Users\andude3\Documents\bat>(
set /a c+=1
echo NATHANSCHOOL
1>>net!c!.1
)

C:\Users\andude3\Documents\bat>set m=2

C:\Users\andude3\Documents\bat>set c=0

C:\Users\andude3\Documents\bat>set /a c+=1

C:\Users\andude3\Documents\bat>set /p y= 0<net1.1

C:\Users\andude3\Documents\bat>ping LEMONILLA
-n 1

\\LEMONILLA
\\NATHANSCHOOL

\\

No idea why it's showing the network, or why it is waiting for a prompt. Usually pause gives a written prompt, but this only response to enter. when you press enter you get :

Code: [Select]FIND: Parameter format not correct
ad
FIND: Parameter format not correct
aasdfasdf
FIND: Parameter format not correct

This HAPPENED even when I deleted the pipe (not just REMed it out).

I guess this is a start, but I still have no idea what it is talking about. Thank you for your help.Have you got a find.bat and/or ping.bat (or .cmd) in the same folder?
Quote from: Salmon Trout on July 11, 2012, 07:53:37 PM
Have you got a find.bat and/or ping.bat (or .cmd) in the same folder?

Or anywhere on the path. Is this batch file you are using called ping?Quote from: foxidrive on July 11, 2012, 11:08:24 PM
Or anywhere on the path. Is this batch file you are using called ping?
Quote from: Salmon Trout on July 11, 2012, 07:53:37 PM
Have you got a find.bat and/or ping.bat (or .cmd) in the same folder?

That's not the first time someone has made that mistake on this forum.Quote from: Squashman on July 12, 2012, 05:46:38 AM
That's not the first time someone has made that mistake on this forum.

It's the first thing I think of in a situation like this, along with a new variable called PATH .
Quote from: foxidrive on July 11, 2012, 11:08:24 PM
Or anywhere on the path. Is this batch file you are using called ping?
LOL yup. Changed it'd name and that part works now. Thank a bunch.
6632.

Solve : command for looping and stop?

Answer»

what command to add to make my test PROGRAM run for 100 cycles, then Stop.
i NEED to add in my autoexec.bat file.for /?.sorry? for???i can;t understand.
i USE GOTO command.
but it is a loop command,the utility will keep runnning,unless i press ctrl+C.
if there any command to PRESET the cycles?
then stop it after completed.I m not sure what u want but if u want to do loop 100 cycles echo message u do TRY run in command window.

for /l %a in (1, 1, 100) do @echo hello

Thanks,
Jay

6633.

Solve : how to retrieve file creation date and how to compare tat date with the s/m dat?

Answer»

hi,

can anyone tell me how to retrieve the file creation date and how to compare that file creation date with that of the s/m date.

it wud be very helpful if some one could help me imm regarding this issue.

thanks.The documentation uses the following notation of date/time of file. (%~t1). Unfortunately it does not specify which date this refers to (creation, written, or accessed). You can pull dates from a directory listing using the relevant switch (/tc=create, /tw=written. /ta=accessed)

What is a s/m date? Sounds like a play date for the kinky crowd! hey hi...

thanks for ur reply..... s/m date is system date........ HOPE ur clear now.... anyhow ll try wat u have told me an get back to u...

thanks.....you can use vbscript/wsh:
an example
Code: [Select]Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("c:\temp\test.bat")
Wscript.Echo "Date created: " & objFile.DateCreated
Wscript.Echo "Date last accessed: " & objFile.DateLastAccessed
Wscript.Echo "Date last MODIFIED: " & objFile.DateLastModified
Wscript.Echo "Drive: " & objFile.Drive
Wscript.Echo "Name: " & objFile.Name
Wscript.Echo "Parent folder: " & objFile.ParentFolder
Wscript.Echo "Path: " & objFile.Path
Wscript.Echo "Short name: " & objFile.ShortName
Wscript.Echo "Short path: " & objFile.ShortPath
Wscript.Echo "Size: " & objFile.Size
Wscript.Echo "Type: " & objFile.Type

save it as a file with .vbs extension. then on command line, type
Code: [Select]c:\> cscript yourfile.vbs
thanks ll try t out!!1 can u excute this scirpt using dos prompt?yes, i have shown it to you. using cscript . pls check my post again.thanks!!!!

can u help me with C++???you may post to the programming section. C++ is a long time ago for me. sorryQuote from: ghostdog74 on April 09, 2007, 03:15:20 AM

("Scripting.FileSystemObject")

Scripting.FileSystemObject-?? A little more about this how it used and properties.



File System Object
Quote
Contains methods and properties that allow you to create, DELETE, gain information about, and GENERALLY manipulate drive, folders, and FILES.
Source: Windows Scripting Technologies (compiled Help file)

For a technical discussion, check out Files and Folders

Note: The FileSystemObject does not handle databases which have their own set of objects.

Good luck.
6634.

Solve : Eject/Load CD-ROM?

Answer»

what command in mdos to eject/load cd-romyou can use WSH, if you have
Code: [Select]CONST CDROM = 4
For Each d in CreateObject("Scripting.FileSystemObject").Drives
If d.DriveType = CDROM Then
Eject d.DriveLetter & ":\"
End If
Next

Sub Eject(CDROM)
Dim ssfDrives
ssfDrives = 17
CreateObject("Shell.Application")_
.Namespace(ssfDrives).ParseName(CDROM).InvokeVerb("E&ject")
End Sub
save it as .vbs, and use cscript to run it.Sidewinder had a simple VBS file, that was not this involved. I will see if I can find him to post it again.Or you could use a utility program.

Some examples can be found here:
http://www.simtel.net/category.php%5Bid%5D42%5BSiteID%5Dsimtel.net

I'm sure there are many others out there, I just found these quickly with Google. On that page is shareware and freeware, so look closely.

One there is a TSR. I've no idea if that would work with something like XP - might be an INTERESTING experiment.
Code: [Select]Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
do
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
loop
end if If you save that as a .vbs and run it, it will constanly open and close your cd drive. To stop it, go to task manager, PROCESSES tab, and end 'wscript'ghost dog,

i alredy try it. but the script eject all my rom.

my G: drive is DVD rom /

i want create 2 script.
-1 for eject G:
-1 for load G:

how to write ?I'm not AWARE of any method that will load CD/DVD drives but for unloading (opening) a specific drive, this may work:

Code: [Select]Set WMP = CreateObject("WMPlayer.ocx")
Set colCDROMS = WMP.CDROMCollection

If colCDROMS.Count > -1 Then
For i = 0 to colCDROMS.Count - 1
If colCDROMS.item(i).driveSpecifier = "G:" Then
colCDROMS.Item(i).eject
End if
Next
End If

Save script with a vbs extension and run from the command prompt with cscript scriptname.vbs

Good luck. Impeccable timing.

6635.

Solve : Hidden Messages?

Answer»

I found SOMETHING out which is kind of useless but still kind of cool.
You know when you drag a file (like a picture) into notepad, you get all this gibberish which make up that file. If you add text at the end of the file, you destroy the file and when you try to open it, you cant.
I found out how to put text into files without damaging them so you can put like SECRET messages in them and send them between a friend and no one besides him will know how to view the message.

Here is how to do it (i am doing it with a picture):
Get a picture file (.jpg .bmp .png ect...) and put it on the desktop
Open command prompt and type
Code: [Select]echo This is a secret message >>"%userprofile%\desktop\file.jpg"and press Enter (in Command Prompt, not batch file although it will still WORK)

When you open the file, you can SEE the origional image but when you open the picture in Notepad and scroll to the bottem, you can see the message. Hehe, nice, this is exactly that kind of "useless" STUFF i like ;p thanks

6636.

Solve : change in copy command of dos?

Answer»

I want to rename or delete the copy command of dos or windows98. Is this possible if yes PLS help meIt is built into the command processor; it is not possible to remove ITI seem to remember this topic not so LONG ago.

The answer was - Yes - but you have to edit Command.com, not a job for the faint-hearted or anyone with limited knowledge of hex/binary editors.

If you decide to have a go at editing Command.com backup your existing file before any attempt, the end result could mean a re-install..

Good luckRisk exceeds benefit.how i can rename or change it pls explain in DETAIL as soon as possible Quote from: Dusty on April 11, 2007, 03:39:29 PM

I seem to remember this topic not so long ago.

The answer was - Yes - but you have to edit Command.com, not a job for the faint-hearted or anyone with limited knowledge of hex/binary editors.

If you decide to have a go at editing Command.com backup your existing file before any attempt, the end result could mean a re-install..

Good luck

What part of that do you not understand?
6637.

Solve : Path of batch file?

Answer»

I am going to make a batch file and I want to show where the file is located. For EXAMPLE:
I make the batch file and save it to '%userprofile%\desktop\folder\hi.bat'
Then I open that file and it will tell me its LOCATION. ANYONE know how to do that?

Thanks for any help.Try "chdir"Try using echo %~p0 in your batch file. There will be a TRAILING backslash which you may or may not want to remove.

Good luck. or just cd.Thanks, i GOT it

6638.

Solve : Kill !??

Answer»

I was wondering if it would be POSSIBLE to make something for killing a running process, if so, what ?Are you TRYING to find out how to kill a running process? You do that by going into task manager by right clicking your taskbar then clicking task manager then to processes or applications then hit end task or process.Which operating system?

You can use taskkill.exe in XP. With lower versions you'll have to DOWNLOAD kill.exe from the 2k server resource kit (might be NT resource kit, i can't remeber).A yeah sorry i want to do it from a batch :# OS: XP Pro SP1so try something like this then:

Code: [Select]@echo off
taskkill /im xxx.exe

Where xxx is the name of th exe you want to kill (the switch "/im" specifies an IMAGE name). Type taskkill /? at the command prompt for further usage information.Quote from: Pr0FiT on April 14, 2007, 09:01:09 AM

so try something like this then:

Code: [Select]@echo off
taskkill /im xxx.exe

Where xxx is the name of th exe you want to kill (the switch "/im" specifies an image name). Type taskkill /? at the command prompt for further usage information.


Thanks Pr0FiT, yea i did that on taskkill, it didnt feel like working, i'll try this 1 outAdd /f to the end to force it to close.
So: Code: [Select]@echo off
taskkill /im xxx.exe /f
6639.

Solve : Help with script (please!)?

Answer»

Okay so my goal here is to have a script search a users' homedrive for any and all pst files. It will then edit a text file and update certain LINES of the text file with the path to the pst, the END goal being for the script (or a series of scripts) to compile a .prf file used to import config info into Outlook. Here's the code I'm using right now:

Code: [Select]@echo off
for /f "delims=" %%q in ('dir /b /s %homedrive%\*.pst') do call :prf "%%q"
:prf
for /f "delims=" %%a in (%temp%\prf.txt) do call :process "%%a" "%~1"

goto EOF
:process
set line=%~1
if /i "%line%"=="PathToPersonalFolders=" set line=PathToPersonalFolders=%~2
echo %line% >> "%temp%\test.txt"
:EOF

The contents of prf.txt is:
Code: [Select][SERVICE2]
UniqueService=No
Name=Personal Folder
PathToPersonalFolders=
EncryptionType=0x40000000

Right now it works fine EXCEPT it adds the contents of prf.txt one too many times, so I end up with this:

[Service2]
UniqueService=No
Name=Personal Folder
PathToPersonalFolders=H:\Mail\personal folder.pst
EncryptionType=0x40000000
[Service2]
UniqueService=No
Name=Personal Folder
PathToPersonalFolders=H:\Mail\Personal Folder - MGMT.pst
EncryptionType=0x40000000
[Service2]
UniqueService=No
Name=Personal Folder
PathToPersonalFolders=H:\Mail\Personal Folders - IT.pst
EncryptionType=0x40000000
[Service2]
UniqueService=No
Name=Personal Folder
PathToPersonalFolders=
EncryptionType=0x40000000

I can't figure out why it's doing this, help!It appears the :process logic is executed twice, one from the first for statement by way of the :prf logic and then by falling into the :prf logic on it's way to the goto statement.

I think you may just have to re-sequence your logic (put the goto statement immediately after the first for statement.Sidewinder, as always, you are the man. The script works pretty much as expected now. After I moved the "goto EOF", it started adding "ECHO is off." at the end of each echo, but whatever, that's fine, Outlook will ignore the line when importing the prf. Once I have everything figured out I'll post the FINAL script for everyone, hopefully somebody else can get some use out of it too. adding a second "goto EOF" after the second "for" fixed the echo thing btw.It's all done! Thanks to sidewinder for his help is solving some of the issues. There doesn't seem to be an attachment option on this forum so if anybody would like the script just drop me a pm and i'll e-mail it. To recap what it does is creates and imports an outlook prf. The prf includes a pab and and all existing pst's on the users %homedrive%. Also changes some misc settings in outlook.

6640.

Solve : Need a Batch file to append txt in all files first line?

Answer»

I need a batch FILE that, when given a list of files in a folder will insert the filename itself in the first LINE for all the files.

For Eg :- C:\12345 folder is having abc.txt, def.txt, ghi.txt with some junk text in them.

When the batch file is executed it should insert abc in the first line of abc.txt and def in first line of def.txt and ghi in the first line of ghi.txt

Is this POSSIBLE??

Thank u for ur time.
Raj
Anything is possible. Whether batch is the best SOLUTION is another story.

Code: [Select]for /f "tokens=* delims=" %%x in ('dir C:\12345 /a-d /b') do (
echo %%x &GT; c:\temp\%%x
for /f "tokens=* delims=" %%i in (%%x) do (
echo %%i >> c:\windows\temp\%%x
)
)

The batch file must be in the C:\12345 directory and you need to run it logged into that directory (the file paths are not carried forward). The output files are sent to the c:\windows\temp directory. You can change the output directory. This will make a mess of non-text files.



Standard disclaimer: Batch language is not a programming language, it is a command language. There are better tools for this such as any Windows scripting language (vbscript, jscript, perl, rexx, python etc). here's another way:
Code: [Select]for /f "tokens=* delims=" %%x in ('dir C:\12345\*.txt /a-d /b') do (
echo %%x > temp
more /E +1 %%x >> temp
move temp %%x
Hi,
This gives me 2 destination folder where one folder contains files with the content being its file name alone and another folder containing the same set of source files without any modification.

Actually i need one destination folder which contains the same set of source files WITH JUST ONE LINE (FILE NAME) ADDED TO IT AS THE FIRST LINE only.

One more condition to be checked is, if the first token is PROMPT in source file then dont disturb the file, just copy source to destination as such.

Thanx
Raj

6641.

Solve : Problems with integrating my SCSI CD ROM drive into MS-DOS?

Answer»

Hello!

First of all I would like to excuse my bad english - I'm from Germany

I have a problem here including my SCSI CD ROM drive in MS-DOS

Please have a look at my config.sys and autoexec.bat files I'm posting here and tell me what's wrong:

Quote

Autoexec.bat

C:\DOS\SMARTDRV.EXE /X

PROMPT $p$g
PATH C:\DOS;C:\TREIBER
SET TEMP=C:\DOS
MODE CON CODEPAGE PREPARE=((850) C:\DOS\EGA.CPI)
MODE CON CODEPAGE SELECT=850
KEYB GR,,C:\DOS\KEYBOARD.SYS
LH C:\Treiber\MSCDEX.EXE /S /D:ASPICD0 /M:12 /L:F
REM LH C:\DOS\MOUSE.COM

Config.sys

[menu]
menuitem=CD, mit CD Rom
menuitem=NOCD, ohne CD Rom
menudefault=CD,30
menucolor=7,0

[CD]
device=c:\DOS\himem.sys /testmem:off
device=c:\Treiber\btdosm.sys
device=c:\Treiber\flashpt.sys
DEVICEHIGH=C:\TREIBER\ASPI8DOS.SYS
DEVICEHIGH=C:\TREIBER\ASPICD.SYS /D:ASPICD0

[NOCD]
device=himem.sys /testmem :off

[COMMON]
DEVICE=C:\DOS\SETVER.EXE
FILES=30
Buffers=10
DOS=HIGH,UMB
Stacks=9,256
Lastdrive=z
COUNTRY=049,850,C:\DOS\COUNTRY.SYS
DEVICE=C:\DOS\DISPLAY.SYS CON=(EGA,,1)

This is the failure message appearing at the very end:
Device driver not found: "AspiCD0".
No valid CD Rom device drivers selected

What's wrong? Thank you so much in advance!Try adding the directory that contains the SCSI drivers in the path statement in the autoexec.bat file...

Example:

PATH C:\DOS;C:\TREIBER\ASPI8DOS.SYSThanks, but unfortunalety it didn't help. There's STILL the same error message.

I have made a photo from this screen - please have a look:
http://www.bilder-hochladen.net/files/2gjg-3-jpg.htmlYou will have to go to the manuf. site and see if they have native DOS drivers for that unit....

If not i'm afraid you might be out of luck.Quote from: patio on April 10, 2007, 09:30:39 AM
You will have to go to the manuf. site and see if they have native DOS drivers for that unit....

If not i'm afraid you might be out of luck.

Thanks for this little hint!!!
I have worked it out now and I'm very very happy!!!!!! It was a long way to solve it.
With your hint I got to the manuf. site of the SCSI Controller...Adaptec. In a driver package I found a readme.txt with a list of all drivers and the models associated. I have a special model which needs another driver as the standard controllers (<- ASPI8DOS.SYS ...) named MCAM18XX.SYS. With this driver it works perfectly.

Thanks for your help and the IMPORTANT little hint which LED me to the manuf. page from the scsi controller.Excellent ! And WELCOME Aboard ! !
6642.

Solve : Identifying source drive in XCOPY?

Answer»

Can you help with using XCOPY from within a BAT file that I put on a CD? I have been using the following:

xcopy /i /s D:\*.* C:\temp

but the problem is that not all PCs have the CD drive as D:

Is there a way to identify the "D:" drive as this can change depending on how a PC is configured. I read in an earlier forum message that one way could be to ask the user with e.g. set /p SetDrive=Type your CD drive and press enter

but this is not practical as some users WOULD not know their drive.

Any ideas would be WELCOME ...

6643.

Solve : bat file - how to ignore window errors?

Answer»

I'm LAUNCHING pdf files within a bat file. I pass the instruction into bat file as a parm. It works great except for when the pdf doesn't EXIST and displays error window. Is there any way to ignore the error and don't display the error window? Is there a way to check if the pdf exist first before launching the pdf?

The bat file has the FOLLOWING code:

@Echo off
start %1
EXIT

The following is the nstruction sent as a parm:

\\USDCAWS37750237\softwares\Temp\PDFs\CBL_2005.pdf

Thanks,
Alex(NEWBIE)

[old attachment deleted by admin]Try using the IF command. Type IF /? at the command prompt.Your suggestion worked indirectly. I entered "IF /?" and it returned an syntax error displaying possible corrections which mentioned "Exist". The combination of "IF EXIST filename START filename" worked.
Thanks for the tip!
Alex

6644.

Solve : changing the desktop bg?

Answer»

does ANY1 know how to change the desktop bg using command promptif you got xp this works

@echo off
reg add "HKCU\control panel\desktop" /t REG_SZ /v Wallpaper /d %1 /f


%1 = Location of .bmp Example: c:\mybackround.bmp , not sure , but i think it has to be .bmp
and the next step , since its registry.. you have to restart explorer , you can do that with rundll32

RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True

nevermind , you dont have to restart explorer .. just update user registry , ^ that worksI tryed that as both a batch file and imidate COMMANDS, it DIDNT work at all as imidate, but wen i made it a batch file, and RAN it, it first says the command was successfully completed then a box would COME up that says
Error in USER32.DLL
Missing Entry:UpdatePerUserSystemParameter,1,TrueHmm id also like to have this working, cant seem to get it though..What's the point of changing the background through the command prompt? Is it just a little faster or is this just an item of curiosity?Quote from: goodnatureddog on April 13, 2007, 10:13:04 AM

does any1 know how to change the desktop bg using command prompt

how should I learn dos from the very basicwww.google.com

You'll first have to learn that DOS is not the command prompt on XP. if you typed it .. the second part i mean , it looks like the comma is beside the s , it isnt.. theirs a space in it ,
if you have xp it should work , even if it doesent the wallpaper changes if the first part works .. just restart
6645.

Solve : Color Result.txt?

Answer»

Hello,
It is possible to get colored result of different DOS Commands like:
Echo, Dir, Ping....

For example:I want to ping 2 or more IP's and i want to get the result colored RED if is not respondig GREEN if is responding.
I know that notepad cant dipslay color but WordPad or other TEXT editors can sow if possible would be helpfull.

Thank you!try to use ctext.exe.
put it to windows\system32 and start it in cmd to view HELP.


[attachment deleted by admin]I will try it.
Are there any other tools like that?
COULD be intresting to discover!!!
TY.I have used Crimson editor and Textpad which both also have the ability to display color attributes to code. As far as your output to be conditional RED for Ping Failing and Green Ping successful, it could be done aftre the command is executed after the output to the display is passed to an IF statement. If the string output equals the output match for successful then COLOR command to force the text output as GREEN on Black Background or if failing then COLOR command with HEX combination for RED and Black Background.

As far as having it all in RED or GREEN for the PING output text, it would only be possible if the ping condition can be tested prior to the execution of the command in which the COLOR command would be RED or GREEN and the ping command would then display in GREEN or RED...so you might need a routine like below

ping the IP or systemname, then test if live or not. CLS Clear screen then COLOR xx command where xx is the HEX for the GREEN or RED on Black or White Background, then run the ping command again to have it display in the correct color for the condition.

You will need an IF statement to test for the echo of the ping string output to be able to designate RED or GREEN and use COLOR xx command to change text color on execution.

Only other way I can thing of is to withhold the output of the ping command without it echoing to the display, test the condition which will set the proper color, then output the RESULTS of the ping in that color. More complicated and I am not sure if the output can be withheld for output after execution without displaying its operation when executed which is forced to display to the display by default.

6646.

Solve : block certain sites using batch file????

Answer»

Quote from: Sidewinder on December 26, 2008, 04:54:31 AM

An IP address is a quartet of binary numbers.

A (traditional IPv4) IP Address is a 32-bit value. Because the different bytes have meanings, they are often seen represented as 8-bit quadruplets (or "dotted quads") of decimal numbers. These are more convenient for humans to get their heads around. You can use the 32-bit value in most internet clients (i.e., web browser, FTP client) instead of the dotted quads or the domain name.

Converter here

http://www.geektools.com/cgi-bin/ipconv.cgi

Or use ping to convert from long to quad

For example, the 32 bit IP address 1249725795 translates to the dotted quad form 74.125.77.99

Code: [Select]C:\>ping 1249725795

Pinging 74.125.77.99 with 32 bytes of data:

REPLY from 74.125.77.99: bytes=32 time=398ms TTL=244
Reply from 74.125.77.99: bytes=32 time=442ms TTL=244
Reply from 74.125.77.99: bytes=32 time=323ms TTL=244
Reply from 74.125.77.99: bytes=32 time=427ms TTL=244

Ping statistics for 74.125.77.99:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
MINIMUM = 323ms, Maximum = 442ms, Average = 397ms
varunjose, make sure you have the dotted IP address 127.0.0.1 correctly shown in your hosts file!

You could use 2130706433 but let's not complicate matters!

Why have you not posted your hosts file?

Do so or risk termination of help.




6647.

Solve : Creating a shortcut for user after extracting a setup file?

Answer»

I've been on this for more than a day already, cracking my brains out.

I have set up an installation DISK based on the programme, CreateInstallFREE. The files can be extracted properly and used. However, in this programme, Under the option Desktop, i created a desktop based on my DOS batch file.

However, i am unable to get the command that will "track" the user who is ABLE to choose where he or she wants to save the file in. Thus, i am only able to open the desktop shortcut batch file properly on my desktop. However, when i save it on a thumbdrive and open up in another computer, i am unable to do so.

Are there any commands that will track where the user SAVES the file into, so that i can track my desktop shortcut to his folder and be able to execute correctly?

OS: Microsoft Windows 2000 [Version 5.00.2195]
Hey people,

I've solved out the problem already. it actually is the option under CreateInstallFREE > Shortcuts > Target File. Just change it to "INSTALL PATH" and you can get it.

BUT! i have another problem now. Even though my DOS batch file tracks the user's choice of saved directory and can be seen via the properties of the shortcut, now that when i open it, the default directory is


"D:\Documents and Settings\Administrator\Desktop

The system cannot find the path specified."

and my command is

D:\Documents and Settings\Administrator\Desktop> |cd Server-MasterCopy\CS\Release|

So, the Administrator\Desktop is unable to track my file as it isn't in that file after extraction. Why is that so? Is there any way i can change my desktop DOS batch file's default location to another location instead of "D:\Documents and Settings\Administrator\Desktop" ?

Please help, thank you!HELLO SIR,
I AM USEING WIN SERV 2003 ,IN DOS I SHOW C:\DOCUMENTS AND SETTING\ADMINISTRATOR> BUT I WANT JUST C:\ (PERMENANT) HOW CAN DO THIS PLEASE HELP ME SIR

6648.

Solve : How to exlude parts of a filename?

Answer»

I have files in my FOLDER:

C:\files\002-31234567.dat
C:\files\002-31234568.dat
C:\files\005-51234567.dat

and I want to copy them to another folder WITHOUT the 002- and 005- PART.

So I get:

C:\copy\31234567.dat
C:\copy\31234568.dat
C:\copy\51234567.dat

I've tried "copy c:\files\002-*.dat c:\copy\*.dat" but that copies the 002- part too.

How can I LEAVE the first 4 characters out of the filename?




Welcome to CH Forume!!

type the following command in dos prompt.

Code: [Select]for /f "tokens=1,2 delims=-" %a in ('dir c:\files\*.dat /b') do copy c:\files\%a-%b C:\copy\%bThanks! That did the trick!

6649.

Solve : A batch file I made?

Answer»

Hey everyone, I just want to share a batch file I made because i was bored.
Basically, you enter a NUMBER and it will MULTIPLY it by 1 and 2 and 3 up to 25.

Brings back the memories of your parents and MATH teachers making you learn the times tables

Just download that text file and save it as a .bat.

NOTE: It might only work on Win XP and Win 2k.

[old attachment deleted by admin]you could have IMPROVED it USING for loops
Code: [Select]FOR /L %%a IN (0,1,25) DO (
....
....
)
yeah but it still works

6650.

Solve : Entering 'spacebar' in script?

Answer»

Hey all,
Ok i'm only new to scripting of any kind (i found out about creating .bat files yesterday).
Simply enough i want to create a batch that opens the programs that i use regularly and also some websites.

Problem is every time i have TRIED i get an error stating that 'such and such cannot be found' one of the programs is in the 'Program Files' section of the computer and i think it is because the batch file can't read the space.

Is there a special COMMAND to enter instead of pressing spacebar?

I'm running Windows Xp HOME Edition

Also i am using the start... command to OPEN the program
Should i be using dir... or run... or something else?Values with embedded spaces need to be quoted.

ex. "c:\Program Files"

Good luck. So it's like:

start "c:\docume~1\username\desktop\file.exe"
or
start "www.google.com"
also works with websites.thankyou sidewinder and carbon Dudeoxide ok, i tried what you suggested and it opens the command prompt under the programs name. Is there a way to make it open the program itself?You need to enter the entire path to the file and the filename itself.

Something like this perhaps:

C:\Program Files\Windows NT\Pinball\pinball.exe

An easier way is to use Windows EXPLORER and launch the programs from there.

Good luck.