Over 1 million tech questions and answers.

Script or batch

Q: Script or batch

I have a batch file I just need ran on and after certain days/dates.. these days vary.

So here is my question..

I want to create a file that I can put in the start up menu, so when my computer boots up it will run this file and check

the date. If the date is for example: november,18,2009 or later it will run the batch file.

That batch file is located in c:\Documents and settings\user\My Documents

So what kind of file would I need to create and what would the script be.

I need to be able to plug in different dates when I need to and using the schedule task in windows is not going to work.

Time doesnt matter just need dates.

Preferred Solution: Script or batch

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)

A: Script or batch

Welcome to TSF!

This should do it. Set the target date in the 2nd line. Use the same format and symbols as your system does, so if your computer displays the date for Nov 18 as 18-11-2009, use that, not 11/18/2009.

Set the file name of your batch file in the 3rd line. The 4th line is the path to the file, which will be the My Documents folder of the logged on user. If you want this to run for more than one user, you'll need to change that as well, and put the batch file into a folder all users can read.

You can put this batch file in your Startup folder, or create a Scheduled Task to run this batch when you log on.

@Echo Off
Set _TargetDate=11/18/2009
Set _FileName=mybatch.bat
Set _Filepath=%Userprofile%\My Documents\%_Filepath%
:: Get todays date
Call :GetDate
Set _yy=%_fDate:~,4%
Set _mm=%_fDate:~4,2%
Set _dd=%_fDate:~6,2%
:: Convert todays date to Julian
Call :JDate %_yy% %_mm% %_dd%
Set _JToday=%_JDate%
:: Get Target Date
Call :GetDate %_TargetDate%
Set _yy=%_fDate:~,4%
Set _mm=%_fDate:~4,2%
Set _dd=%_fDate:~6,2%
:: Convert target date to Julian
Call :JDate %_yy% %_mm% %_dd%
If %_JToday% GEQ %_JDate% Start "" "%_Filepath%"
Goto :EOF

:: ::
:: - S u b r o u t i n e s - ::
:: ::
:: Convert date to Julian
:: Arguments : YYYY MM DD
:: Returns : Julian date in variable _JDate
:: Usage
::Call :JDate %__GYear% %_GMonth% %_GDay%
:: First strip leading zeroes; a logical error in this
:: routine was corrected with help from Alexander Shapiro
::Code taken from datediff.bat written by Rob van der Woude
:: Modified to handle months and days witout leading zeros
:: By TheOutcaste http://forums.techguy.org
Set _JMM=%2
Set _JDD=%3
IF 1%_JMM% LSS 110 Set _JMM=%_JMM:~-1%
IF 1%_JDD% LSS 110 Set _JDD=%_JDD:~-1%
:: Algorithm based on Fliegel-Van Flandern
:: algorithm from the Astronomical Almanac,
:: provided by Doctor Fenton on the Math Forum
:: (http://mathforum.org/library/drmath/view/51907.html),
:: and converted to batch code by Ron Bakowski.
Set /A _JMonth1 = ( %_JMM% - 14 ) / 12
Set /A _JYear1 = %1 + 4800
Set /A _JDate = 1461 * ( %_JYear1% + %_JMonth1% ) / 4 + 367 * ( %_JMM% - 2 -12 * %_JMonth1% ) / 12 - ( 3 * ( ( %_JYear1% + %_JMonth1% + 100 ) /100 ) ) / 4 + %_JDD% - 32075
For %%A In (_JMonth1 _JYear1) Do Set %%A=
:: This subroutine will always display the same results,
:: for the date independent of "International" settings.
:: This batch file uses REG.EXE from the NT Resource Kit
:: (already installed with WinXP and Vista)
:: to read the "International" settings from the registry.
:: Date is returned as yyyymmdd in variable _fdate
:: Modified from SortDate Written by Rob van der Woude
:: http://www.robvanderwoude.com
If NOT [%1]==[] Set Date=%1
If "%date%A" LSS "A" (Set _NumTok=1-3) Else (Set _NumTok=2-4)
:: Default Delimiter of TAB and Space are used
For /F "SKIP=3 TOKENS=2*" %%A In ('REG QUERY "HKCU\Control Panel\International" /v iDate') Do Set _iDate=%%B
For /F "SKIP=3 TOKENS=2*" %%A In ('REG QUERY "HKCU\Control Panel\International" /v sDate') Do Set _sDate=%%B
IF %_iDate%==0 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%date%") Do Set _fdate=%%D%%B%%C
IF %_iDate%==1 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%date%") Do Set _fdate=%%D%%C%%B
IF %_iDate%==2 For /F "TOKENS=%_NumTok% DELIMS=%_sDate% " %%B In ("%date%") Do Set _fdate=%%B%%C%%D

Read other 3 answers

I am having a problem with a batch script that prompts a user to enter a set of responses which then set variables - Then the script will call in another batch and writes the output to a new Batch file.

The problem is the batch file doesn't output the new Batch file the way I intended.

This is the script I have:


ECHO Please enter the full filename reference (e.g. 1-210208)
ECHO Please enter the full description (e.g. 12:15 on Thursday 21 FEBRUARY 2008)
SET Description=
SET /P Description=
ECHO Please enter the date reference (e.g. 210208)
ECHO Please enter the reservation slot time (e.g. 1215)
ECHO Please enter the script file you are replacing (e.g. 001)
SET Replace=
SET /P Replace=
ECHO Please enter the continuing script file (e.g. 002)
SET NxtFile=
SET /P NxtFile=
CALL "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\ADMIN\TEMPLATE.CMD">"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\DATES\%Replace%.BAT"
ECHO REPLACEMENT OF %Reference% completed!


E... Read more

A:Help with Batch script that creates a Batch script

Try This


IF EXIST "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT " (
) ELSE (
ECHO Would you like to reserve this time?
ECHO Yes (Y) or No (N) or Cancel (C)
SET /p CHOICE=Enter response to continue (Case sensitive):
IF not '%choice%'=='' set choice=%choice:~0,1%
IF '%choice%'=='Y' goto YES
IF '%choice%'=='N' goto NEXT
IF '%choice%'=='C' goto CANCEL
ECHO "%choice%" is not valid please try again
ECHO "%DATE%","%TIME%","%USERNAME%","%FullName%","%Team%","%DTE%","%TME%">>"\\hb eu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\LOG\AUDIT.CSV"
ECHO Thank you %FullName% - Your reservation has been successful.
CALL "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\DATES\002.BAT&quo... Read more

Read other 3 answers

Hi, I just had a question about a script I'm trying to make for hiding/unhiding folders.

Here is the script I have come up with so far:

cls if exist "C:\Documents and Settings\Tom\Desktop\GM Games\folderlock\test" goto lock else goto unlock :lock echo off attrib "C:\Documents and Settings\Tom\Desktop\GM Games\folderlock\test" +s +h goto end :unlock echo off attrib "C:\Documents and Settings\Tom\Desktop\GM Games\folderlock\test" -s -h goto end :end exit

For some reason, it works to hide the folder, but when you click it after it hides the folder, it does not reveal the file again,
yet if I run the line "attrib "C:\Documents and Settings\Tom\Desktop\GM Games\folderlock\test" -s -h" in a separate batch file, it works fine...

Theres got to be something wrong with my script that is stopping it from running the "unlock" line...

Any ideas?

A:Need help with batch script

Read other 16 answers


I have my vendor's ftp url over SSL. it's like ftps://myvendor.com and i have username and password. So please help me on writing batch script t o downlod the file from my vendor repository.
If this is not possible in dos script, please suggest me opensource tool. But i would love the solution in dos script as i need to use this forever to avoid any manual work.


Read other answers

Can somebody assist me with a .bat file I am trying to create?
This is what I have now:

start /d "C:\Users\Me\Desktop\ghost" ghost.exe
start /d "C:\Users\Me\Desktop" Poweroff.exe

C:\Windows\System32\powercfg.exe /setactive e428f8a5-615e-488f-b7f7-1ed39450e522
The first 2 lines start programs on my desktop. The next line, I try to change the power setting so my computer won't go to sleep, but I am not sure how to put this in my script. When I enter the line in command prompt, it works, but I am new to writing batch files.

What I essentially want to do is to run those two programs and set my power settings to another profile.
The second program shuts down my computer when the first program ends. It would be nice if I could do this in a batch file without the second external program support. Another idea I had was to start up GHost.exe (1st program) and then run shutdown -t 20, but I also need help expressing this in a batch file, so the line runs only after GHost.exe ends.

Thanks for your input.

A:Help me with Batch script!

Oh boy, it's been several years since I did a lot of batch file commands...

Looks like you might want to add the start " " to that 3rd line, thats the 1st thing that comes to mind.

Read other 1 answers

Hey im trying to create a batch script that will create the pattern for IP address's

I started with code that looked like

set /a four="%four% + 1"
if ("%four%")==("9") goto loop2
echo %one%.%two%.%three%.00%four%
%cmd% >>"C:\%cmd%.txt"
if not ("%four%")==("9") goto loop1

set /a four="%four% + 1"
if ("%four%")==("99") goto loop3
echo %one%.%two%.%three%.0%four%
%cmd% >>"C:\%cmd%.txt"
if not ("%four")==("99") goto loop2

set /a four="%four% + 1"
if ("four")==("255") goto loop4
echo %one%.%two%.%three%.%four%
%cmd% >>"C:\%cmd%.txt"
if not ("%four%")==("255") goto loop3

which worked to an extent but once it hit loop3 it would continue adding to the next set of numbers and not reset itself back to 0.

how to i create a bunch of loops for creating the pattern for an ip address ( from 0-255.

I read into the For /L command but wasnt successful at figuring it out.


Read other answers

Hi Ime Quite New here I Know A Little on Batch Scripts but i need Help Please

1.)How Can I Bypass UAC In Vista Without Restart In Batch Script
2.)How Do I delete All Files And Folders In My %TEMP% Without Confirmation
3.)How Can I Enter Text Into A Batch Script And Then Have The Script Save It As "info.ini"

Saved File Info.ini should read


Name= Entered Text
Model= Entered Text

[Support Information]
Line1= Entered Text

Any Help Or Just Point Me In the Rite Direction Please


Thank you Mobile-latham

A:Help With A Batch Script Please

Ok Worked The delete %TEMP%
FOR /F %%A IN ('DIR /B /AD /S') DO RMDIR /S /Q %TEMP%\

Read other 2 answers

how can I start the service: "wireless zero configuration-service"
with a script or batch file?
witch code do I need?

OS Windows XP prof SP2

Thanx Mark

A:script or batch

Is it listed in the list of services in the services manager?

Read other 2 answers

Hello All,


I am a BI guy.I need a batch script(.bat) for Winodws 7 enterprise edition.
My requirement:
I have some 100 files in a network drive which i can access.Each text file contains some 1000 records with some filed names.Now my question is i want to read those files and put result in another file.I dont want all the record of data in the text file. Now i need filename,record count,date of the file .

result file would be:
Filename record count date
Filename-1 100 01/dec/2017
filename-2 1000 01/dec/2017
filename-3 900 30/nov/2017. This i sthe data i need in a result file(like .csv,exel,.txt as result file)

At same time i have to increment automatically file when new file arrives into the directory.i,e i have executed file today i can see the files upto today.Tomorrow the file should run automatically and update the all files including history files....in the result text.This is because i use this file in a scheduled report in other technology where all these data to display.

I hope you understand.

Thanks in advance.

Read other answers

dear all
any help to make batch script this the reason i want to make a batch file is to help me update the online games in 60 computers by overwriting or copying big files in one click from 1 source computer...
instead of turning on all 60 computers and updating all online games, he'll just have to update one computer and just copy the update or overwrite the old files in all 60 computers...

i have 1 server game i want only copy newer files to pc all pc client
pc server =
pc -01 = 192.1683.1
how to batch script

thx before

A:batch script help

i try to make script but no work
this my scripy

@echo off
set "pc_server=\\\D\GameOnline\DOTA 2\"
set "pc-24=\\\D\DOTA 2\"
robocopy /"%pc_server%/" /"%pc-24%/" /mir

Read other 6 answers


I am trying to write a batch script, that will copy users "My Documents" Folder. I want to put a for loop in the script that will ping the computer first and if the ip address of the computer is in to range, then only it will prompt the user to copy enter user name, otherwise it will exit. This is what I got so far. It does the copy and prompt the user fine, but I don't know how to get the for or if loop working to decide only to do the backup for to range.

@echo off
Title "Back up My Documents"

ipconfig | find "IP Address" > ip.txt
for /F "tokens=* delims=:" %%I in (ip.txt) do GOTO copy

start /wait NET USE /delete /Y z:
start /wait NET USE z: "\\servername"
set /p source="Enter your username: "
echo Please wait...Backing up My Documents...

If not exist "c:\Documents and settings\%source%" (echo You have entered wrong user name. Program will exit. Contact the admin. & pause & exit)

xcopy "c:\Documents and settings\%source%\My Documents\*.*" "z:\%source%\My Documents" /e /q /r /h /d /k /c /y /i

end if

start /wait NET USE /delete /Y z:
Thanks for all the help

A:Batch script

Read other 9 answers

Hi All,

I am writing a dos batch file for windows7 and it has many commands which need elevated access to run. For elevation I am using elevate.exe. I am doing like below -

set Elevation=elevate -wait cmd.exe /c
%Elevation% "cd /d %CD% && xcopy /E /Y ...."
%Elevation% "cd /d %CD% && command 2 .."
%Elevation% "cd /d %CD% && command 3 .."
%Elevation% "cd /d %CD% && command 4 .."

My script calls elevate for cmd and then "cd /d %CD% for each command as elevate changes the working path to /system32 I am forced to change the directory every time I run elevate. It also prompts user for "UAC" dialog for each elevate command, so for ten such command UAC prompts will come 10 times . Commands I am using are mix of DOS command(like xcopy, diskpart etc) and some other 3rd party executable. So there is two problem for which I need some help-

1. How to call elevate for cmd.exe once and run rest of the command in same elevated console.
2. How to change working directory once instead with every command. I think solution to first one will take care of this also.

Any help is most welcome.

A:How to run cmd.exe elevated in batch script

Hi and welcome to SevenForums,

For batch files I run manually I set the shortcut for it to run as administrator and I get ONE UAC prompt.

I've never heard of elevate.exe

Read other 1 answers


I have 1000 image url in my text file(sample.txt) and i want to download the images using the url. Can anyone please share with me the sample script which can do this in single shot.

Also, is there any way to reduce the size of the image into 20/20 px with png extension.


A:Help Needed in Batch Script

hmmm im not very good with batch... but you can do this with wget.
your txt content is


then get wget and use this command
wget -i sample.txt

and for resizing, get irfanview and use batch resize function.

Read other 4 answers

I want to be able to run chkdsk on all my drives at start-up before much has loaded. It would appear I need to write or find a batch script file to carry out this task. I found the following script on a google search:[email protected] y|chkdsk c: /[email protected] y|chkdsk <next drive letter>: /[email protected] y|chkdsk <next drive letter>: /[email protected] y|chkdsk <next drive letter>: /[email protected] y|chkdsk <next drive letter>: /fetcetcThe | character is shift+backslash.This batch script is placed in the root of the boot drive (c: in my case) and executed via a shortcut from the desk top. The problem for me is that the script runs immediately, skips the c: drive but does offer the option of y/n to scan it at next boot, the script then goes on to check the other drives. There is no time delay after the skipping of the c: drive to select either y/n option and it does not check the drives at boot-up.Please could someone tell me how to alter the script or tell/show me an alternative method. The other thing is that I would like to be able to view a log of the scan/check.Cheers.

A:altering batch script

How many drives and what size are they?
Do you suspect that one of the drives might be failing?

I think that this will slow down the boot process dramatically & there really is no need to run chkdsk on startup unless you suspect a hard drive problem.

Read other 4 answers

Well, I'm sitting here and can't this to work right.
Here's what I want to do:
- Login to a ftp server
- Download qconsole.log from demott
- Upload the same file to another folder at the remote server. (/logs)

Then the next thing:

I want then to upload this file from /logs to another FTP server, could anyone give me an example how to do that? Anyway here's my code:


open **.***.**.*** [COLOR=Red](IP)[/COLOR]
******** [COLOR=Red](USERNAME)[/COLOR]
******** [COLOR=Red](PASSWORD)[/COLOR]
lcd c:\logs
quote PASV
cd /demott
quote PASV
get qconsole.log
cd /demott/logs
quote PASV
put qconsole.log


A:Help with a Batch file script (FTP)

Hi mariusk,

Welcome to TSG !

You may adapt your script this way :
open **.***.**.*** (IP)
******** (USERNAME)
******** (PASSWORD)
lcd c:\logs
quote PASV
cd /demott
quote PASV
get qconsole.log
cd /demott/logs
quote PASV
put qconsole.log
open **.***.**.*** (NEW IP)
******** (USERNAME)
******** (PASSWORD)
lcd c:\logs
quote PASV
cd /logs
quote PASV
put qconsole.log


Read other 2 answers

Me and my friends are constantly plagued by Local Area Network connection issues when trying to connect to each other for streaming, game, etc. I was wondering how to create a file (like a batch file or script) that would execute the following commands to make the process quicker and easier to set computers up for a LAN.

- disable windows firewall
- disable/enable network adapters
- end unneeded processes such as ituneshelper.exe, ApplemMobileDeviceService.exe, etc.
- set computer's IP address to a specific static one (i.e. as well as dns servers to particular settings

The whole point is to ease the process of connecting several computers on short notice in a short amount of time. I just need help learning how to write such a script or batch file or something that can execute all these things.

Thank you in advance for your help

A:batch file/script help!

a lot of those would probably be done via netsh
netsh /? for help
(I haven't played with this much, but I'm sure it's not too hard to figure out, you have to play with it a lot though)
for example http://social.technet.microsoft.com/...9-df9eb5700561 for windows firewall

tskill for ending processes

Read other 9 answers

How can I do a batch file that automate the archival storage operation with a batch file?

thank you,

[email protected]

Read other answers

I have a program that requires multiple steps to load (click on the icon then select the data folder ect...) I would like to write a batch file or script that would automate the process for the end users. Is there a good tool for doing this or examples of the code I could use???

A:Script/batch files


Batch files are a lost art but they still work.
The following site has info on how to create different types of files: http://www.robvanderwoude.com/


Read other 1 answers

Hello, i was trying to make a small batch script that backs up some directories on a network share and copies them to another network drive..

Can anybody point me in the right direction..

Think itīs just best i show you the problem in code:

@echo off

::This code works..
::for comparison i made a version of similar backup script that works, but the only diffrence is that this script is run localy

set drive =\\"Network share that i have"\%username%$\backup
set backupcmd =xcopy /s /c /d /e /h /i /r /y

eecho ### backing up the desktop as an exsample...
%backupcmd% "%USERPROFILE%\Desktop" "%drive%\Desktop"

@echo off

::This code does not work..
::This code is made for backing up computer (A) to network drive from computer(B)
::This code gives an error that a networkdrive is not found, but when i type in the location myself i can connect to the network location..

set /p nr = computer share name? :
set /p name = name of user to back up from? :
set computer = \\%nr%\d$\Documents and Settings\%name%

set drive = \\"Network share that i have"\%name%$\backup
set backupcmd = xcopy /s /c /d /e /h /i /r /y

echo ### backing up the desktop as an exsample...
%backupcmd% "%computer%\Desktop" "%... Read more

Read other answers

We have encountered a problem at work. We use a rocket port connection for multiple com port usage. We use several different softwares by different manufactures and they all work fine by using the rocket ports. One certain software will not work with this configuration. It will only work on com port 1. (Rocket port is com 2 - 11.) We have to go in to device manager and disable the rocket port, then when we are finished, enable the rocket port. I have asked the head IT guy if it would be possible to write a batch or script to do this by simply clicking on an icon. He said that it is possible, but might be hard to figure out. They have tried to do this before by making a script to toggle off or on ( 1 or 0 ) the registry setting, but no luck. They have also done the same with a script that mirrors key strokes, to disable/enable, no luck either.

Hope I explained it clearly. (I'm kinda foggy about the whole thing.)

Any ideas on a script or batch.

edit: We are using Win2000pro

A:Device Manager Script or Batch help.

If it is running as a service you can stop and restart it with the NET STOP and NET START commands from a batch file. The proper syntax is NET STOP "SERVICENAME" /Y

Look in the services applet for the exact name and replace the "servicename" above. If it needs to be timed you can use the AT utility also.

Read other 2 answers

I have absolutely no idea where to put this, so I just picked a place. If anyone thinks there's a better spot for it, have it moved there please

My intentions: to make a DOS batch script that will shut down four machines, then to set it as a scheduled task running at, say, 1 AM

The Problem:
I type something in DOS:

shutdown -s -m \\computername -c "This machine will shut down in two minutes To cancel click the abort shutdown icon on your desktop" -t 120 -f

It works, the remote machine displays a warning and a countdown timer. I have an icon on their desktop that is a batch script with contents:

shutdown -a

to abort the shutdown if someone is on the machine at 1 AM.
If I copy the same script (the shut down one) into notepad save and run the batch file, it goes into this endless loop and does nothing. Anyone know why?

I've attached a screenshot of the running batch script in its endless loop"

A:Solved: Shutdown DOS batch script

Read other 15 answers

I had a file, then I lost it. Don't know how I could possibly have lost it. Now, I am unable to find the shortcut that I used. It may have been a script. I don't recall which, but it was a button on my desktop and I double-clicked it to put my PC to sleep, instead of hitting the Start button, then choosing Sleep from the shutdown.

Bonus unrelated question: I've got 8. Should I install?

Thanks so much in advance for your help.

A:Batch/Script to Sleep Windows 7

first thing google found for me.

Read other 2 answers

I want to make a batch script, which does the following:

nircmd win activate title "Microsoft Office Outlook"
nircmd sendkey enter press
very easy code, but I need to loop it indefinitely, how will I do that? I found the following reference:

for /l %%x in (1, 1, 100) do echo %%x
but this only loops a 100 times, could I also let it loop indefinitely?

I could also loop it for say 24 hours, then I can start the batch script every day at the same time for instance...

A:Solved: How to loop Batch Script

while TRUE do ...

Read other 3 answers

Hi all, i use this script to compress all .txt and .cpi files into the backup folder in separated files with 7zip. After the files are zipped i delete the original files. However this script has a logical flaw. Lets say if the 7zip program fails to run, the files will also get deleted. How can i change the script so that it should not delete the files if they don't get zipped first. Also how can i change this script so it zips files that are older than 7 days? Thanks for your help. Jason

@echo off
set _source=C:\test7zip\bak
set _dest=C:\test7zip\bak
set _wrpath=C:\Program Files\7-Zip
if NOT EXIST %_dest% md %_dest%
for %%I in (%_source%\*.txt,%_source%\*.cpi) do "%_wrpath%\7z" a "%_dest%\%%~nI.7z" "%%I" & del "%%I"

A:Command Line Batch Script

Read other 6 answers


A file contains path as
I want to write a batch script which can find single '\' in particular file and replace it with '\\'
Can anyone help me with this ??

Read other answers

Morning i have a problem with batch script in Windows 7.
this is my code:

@echo off
set mypath=c:\tools
if not exist "%mypath%\architet.txt" goto check3264
find /I "x64-based PC" "%mypath%\architet.txt" >nul 2>&1
if %errorlevel% EQU 0 (set architet=64) ELSE (set architet=32)
goto uacok
echo Find Windows 7 32 or 64 Bit
systeminfo.exe >"%mypath%\architet.txt" 2>&1
find /I "x64-based PC" "%mypath%\architet.txt" >nul 2>&1
if %errorlevel% EQU 0 (
echo 64bit Found
set architet=64
echo Disable UAC
"%mypath%\file\hstart64.exe" /RUNAS "WScript //Nologo c:\tools\uac.js"
goto restart
) ELSE (
echo 32bit Found
set architet=32
echo Disable UAC
"%mypath%\file\hstart.exe" /RUNAS "WScript //Nologo c:\tools\uac.js"
goto restart
rem find if pc is Eeetop 2010
if exist "%windir%\EeeTOP.scr" (
echo EeeTop ET2010 Found
echo Removing components
del /F /Q "%windir%\EeeTOP.scr"
wmic nic list brief >"%mypath%\net.txt"
type "%mypath%\net.txt" | findstr /I "ethernet 802.3" | findstr /v /I wireless >"%mypath%\net2.txt" 2>&1
For /f "tokens=3" %%F in (%mypath%\net2.txt) Do echo 000%%F>"%mypath%\id.txt" 2>&1
rem *1
For /f "tokens=*" %%G in (%mypath%\id.txt) Do set networkid=%%G
REG ADD "HKLM\SYSTEM\ControlSet001\Control\Class\{4D36E9... Read more

A:Problem with echo in batch script

this appen only in the batch.. if i cut the part and insert into another batch this work

Read other 4 answers

I administer a number of remote PCs (all over the country) that are Windows 7 32-bit computers.  I update these computers occasionally via batch script (this is my only option).  These computers are clients on a network and at 3:20am, they check
their Primary Server to see if an update script is waiting.  If so, it FTPs the update over and runs it at 3:30am. 

However, sometimes the users leave their computer logged in.  They all have the same user account name.  I want to check if they are still logged in and if so, log them off.

I currently have my own test system at my desk.  In my batch script, I have added these lines -

query session >session.txtfor /f "skip=1 tokens=3," %%i in (session.txt) DO logoff %%idel session.txt
But I wanted to test them to make sure they work.  I've logged onto my test PC remotely (ssh to the command line) and I have tested each of these commands.  The first line works great, the third line works great.

The second line doesn't seem to do anything.  I can see my computer is still logged in and is at the user's desktop.  Nothing changes.  It does not log off.  I even run the "query session" command again and it still shows that
user as logged in and active.

I have tried
for /f "skip=1 tokens=3," %%i in (session.txt) DO logoff %%i /l /f
for /f "skip=1 tokens=3," %%i in (session.txt) DO logoff %%i -l -f
for /f "sk... Read more

Read other answers


I need help with creating batch script which install programs in Win XP (Win 7). I have a part of it...

Here is source code:

@echo off

set installed_app=C:\app\temp\installed_app.txt
set regexport=C:\app\temp\regexport.txt
set regexport1=C:\app\temp\regexport1.txt
set regexport2=C:\app\temp\regexport2.txt

If Exist %installed_app% Del %installed_app%

regedit /e %regexport% "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall"
find "DisplayName" %regexport1%
find /V "ParentDisplayName" %regexport1% >%regexport2%

for /f "tokens=2 delims==" %%a in (%regexport2%) do echo %%~a >>%installed_app%
The content of C:\app\temp\installed_app.txt is the following:

FreeCommander 2009.02b
IrfanView (remove only)
Windows Management Framework Core
Microsoft SQL Server 2005
Mozilla Firefox (3.6.16)
OpenVPN 2.1.3
Vim 7.3 (self-installing)
VLC media player 1.1.7
Windows XP Service Pack 3
WinSCP 4.3.2
7-Zip 9.20
Microsoft SQL Server 2005 Tools Express Edition
Microsoft SQL Server 2005 Express Edition (SQLEXPRESS)
WebFldrs XP
Microsoft SQL Server Setup Support Files (English)
MSXML 6.0 Parser
Adobe Reader X (10.0.1) - Czech
Microsoft .NET Framework 2.0 Service Pack 2
Microsoft SQL Server VSS Writer
Microsoft SQL Server Native Client
VMware Tools
I have in txt file list of the programs which I want to install. Conte... Read more

Read other answers

is it possible to create a batch file that will keep the computer from going to sleep (I don't have admin rights etc so i'm limited in what I can do)

A:batch script to keep a computer awake

Read other 7 answers

This is not the entire script but this the line that is freezing, i'm just trying to compile some basic information from the computers in my domain with this login script.

When running just this line as a bat file it will hang until closed and when you attempt to close CMD it lags up and displays a bunch of C^C^C^C^ before doing so.

for /f "tokens=3 delims=," %%a in ('"getmac /v /fo csv | findstr Ethernet"') do echo %%a

This command works perfectly when pasted into CMD prompt so why does it freeze when I make into in a .bat ?

also inserting exit at the end does not help, the script never gets past this command and just hangs there.

Read other answers

At work i use 2 different PDF viewing software. One is Adobe for editing and the other is Foxit for quick viewing. They have their pros and cons and so I use them interchangeably.

For some work I will use Foxit for several hours at a time and only open something in Adobe on an as needed basis using the right click "open with" context. The opposite is true, for some work I use Adobe for hours and then use Foxit as needed with "open with" context.

I want a registry file or some application that will enable me to simply double click on it and KNOW that my file association for PDF is now Foxit (or Adobe depending on what batch or registry file I double click on).

I see there is "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ Explorer\FileExts\.pdf" which changes when I edit the file association in control panel. It does update, but I can't manually change the "UserChoice" Progid item. It changes only through file association in control panel.

I realize there are some in HKEY_CLASSES_ROOT but they dont update when i update it in file association in Control panel.

I don't know what to do or where else to look. It is tedious to have to go to the control panel -> file association manually.

Can someone help?

A:PDF file association REG or Batch Script

As for Foxit file association, that is easy.
"PathTo\Foxit Reader.exe" -Register
should do the trick.

But with Adobe Reader that is more complicated.
You can run repair function of it's MSI package with parameters /fum (f -to allow further parameters, u - rewrites user specific registry entries, m - rewrites other registry entries).

Or you can use registry monitoring software (some even in trial mode) like Total Uninstall to see what values are changed when you switch between Abode and Foxit. Once you will get these changes you can create two reg files for both cases. Or just one for Adobe and use code above for Foxit

Read other 1 answers


I wrote a Script that uninstalls an application, move some files and install an Application.
The Script is working if I start it as Admin (right click - run as Admin ...).
Everything works fine.

But I want to have it working without the "run as".
The script is only used in a separated Test system,
so there is no problem if the Admin user name and password is in the script.
(also link wouldn't work, should also work if it moves to another station within the test domain)

Is there a way to manage that?

A:Admin privileges in batch script

Batch command runas with a standard trick
echo password | runas
it is NOT going to work, because the password should be entered manually.

If you do not mind clicking Yes in UAC window you can use Elevate.exe
With it you won't need writing password anywhere
"C:\yourFOLDER\elevate.exe" "C:\yourScriptFOLDER\yourScript.bat"
would be enough to start script with admin privileges (still need to click YES on UAC window).

Read other 6 answers


I need you for obtain a batch for apply this custom :

Retrouvez votre bon vieux Windows Update sous Windows 10 - Le comptoir du hardware

Can you help me ?

Have a good day !

A:W10 TP : Old Windows Update Batch/Script

Please try posting in the Windows 10 forums here... Windows 10 Forums

Read other 1 answers

Going to dump this here, may be moved eventually.

Situation is thus: we've got a server that is bouncing a few times a day, I need to get a handle on what times it is bouncing. What I need is a batch/vbs script that will ping the IP continuously, and ONLY spit out the timestamp when the response is 'request timed out'........pretty sure this is possible, not the foggiest idea how to go about it.

Only other parameter is that I'd like it to be run from my local machine.



A:Solved: random batch/vbs script

Read other 13 answers

Does anybody knows a website with cool, free batch or script files to download for simple and useful tasks?

Read other answers

I have the following .BAT script which works fine if both source and destination folders are local but if I make the destination a networked drive, it gives me an error.

@echo off

set loglocation=C:\test\Copyout.txt
set olderthan=10
set source=C:\test
set destination=C:\test2
set extension=*

if exist %loglocation% del %loglocation%

echo Copying and deleting files older than %olderthan% days with the file extension *.%extension%.
echo Copying and deleting files older than %olderthan% days with the file extension *.%extension%. >> %loglocation%
echo Copying from %source% to %destination% and deleting from %source%.
echo Copying from %source% to %destination% and deleting from %source%. >> %loglocation%
echo This file may take an extremely long time to run while it looks unresponsive.
echo Check %loglocation% for copy progress.

cd %source%

echo List of files to be copied and removed: >> %loglocation%
echo List of files to be copied and removed:

FORFILES -p %source% /d -%olderthan% -m *.%extension% -c "CMD /C Echo "@FILE"
FORFILES -p %source% /d -%olderthan% -m *.%extension% -c "CMD /C Echo "@FILE" >> %loglocation%

echo Starting copy...
echo Starting copy... >> %loglocation%
date /t >> %loglocation%
time /t >> %loglocation%

FORFILES -p %source% /d -%olderthan% -m *.%extension% -c "CMD /C XCOPY %source%\@FILE %destination%"

echo Starting delete...
echo Starting delete... >> %loglocat... Read more

A:MOVING files to a UNC Path using BATCH script

Anywhere you want to use the UNC path, replace the UNC with a mapped drive:

\\server1\C$\KIdneyBeans\ you can just replace with J:\ if you map the drive first:

net use J: \\server1\C$\KIdneyBeans\ /user:domain\user Password

Mapping the drive needs to be done at the beginning of the script too.

Read other 1 answers

I need script to change my WiFi IP to specific IP as well as DNS and then change back to DHCP.
I need to work on both College and Home network. So I am looking for script which changes WiFi IP.

I have got two files. But I am not sure whether it will work. Somebody help me in verifying the script. If it appears to be wrong, then please provide the correct script.

College IP script: 
netsh interface ipv4 set address name="Wi-Fi" source=static addr= mask= gateway=
netsh interface ipv4 set dns name="Wi-Fi" source=static addr=
netsh interface ipv4 add dns name="Wi-Fi" addr= index=2

Home IP script:
netsh interface ipv4 set address name="Wi-Fi" source=dhcp
netsh interface ipv4 set dns name="Wi-Fi" source=dhcp
ipconfig /renew

Please help me in verifying and identifying the working script to switch between college and home network IP.
Thanks in advance. Looking for a positive reply in soon.

Read other answers

Hi Team/Tech Guys,

This is my first question, hope will not be disappointed.

I have written a batch script to check a Particular service in all remote servers and get a status in a notepad also if the service is in stop mode it will restart and will notify in the same notepad.This notepad details will be mailed by blat.exe.
Now my issue is the programe which is have written is correct to certain extent. i am unable to use if else statement to start service.I mean if the service is already started it should say service is up and running and if the service is stopped it should start the service and should echo it as given.Please find the details of my script below.

fyi : all the remote servers will be picked from machinename.txt

@echo Off
if exist temp.txt (
del temp.txt
for /f "tokens=1" %%i in (machinename.txt) do call rocess %%i
goto :STOP
SET Machine=%1
:Trend Service
For /F "Tokens=3 Delims=: " %%a in ('psservice \\%Machine% query %SERVICE1%^|find /i "STATE"') do SET STATE=%%a

if %STATE% =="RUNNING" (echo Trend Service on %Machine% Is Running Successfully >> temp.txt
if %STATE% =="STOPPED" (echo Trend Service on %Machine% Is In Stop Mode ... Started the Service >> temp.txt
net start spntsvc

Please help me in this as i want if the service is started it should only echo up and running and if the service is stopped it should start the service an... Read more

A:Solved: Batch Script to restart the service

Read other 6 answers

Running the following batch script:
@regedit /s registry.reg
@copy rundll32.exe C:\Windows\
@copy shimgvw.dll C:\Windows\
@echo Done.

I am left with the following:

This is new to Windows 8. Why is this happening?

A:Batch script -> Access Denied to C:\Windows\

According to your screenshot you are running command window as a regular user, do you get the same access denied when running it as administrator?

Read other 31 answers

scheduling defrag for those that don't want to leave machines on overnight.

I've been looking around the web, and trawling through CMD.exe for a good few hours now, and I still can't find it.

I'm trying to create a batch file that defrags a machines c: drive, and then shuts down the computer as soon as it's finished, having given a 2 minute warning. That was the easy bit.

@echo off

defrag c:


I'm now struggling to find out how to get a simple (Y/N) input from a user as the script starts asking whether the user wants to defrag and shutdown or not waiting 60 seconds for an answer before procedding to defrag and shutdown the computer if no answer is given.

The idea is to schedule it to run at 2am every day, probably from Task Scheduler. It's an experiment in learning as much as anything else though, but I am now completely stuck, bogged down in pages and pages of useless information while trying to find the piece I want.

If anybody knows how to do it, I'd appreciate your help.

A:Looking for user input (Y/N) in batch script, with a timeout.

This is the text for e.g. DEFSHUT.BAT:

ECHO Want to Defrag Drive and Shutdown?
ECHO Press "N" if you just want to Shutdown
ECHO Press "Y" to Defrag and Shutdown
ECHO Press "Escape" to Cancel



defrag c:


:ENDClick to expand...

(Note that `^[' represents the "Escape" character. To create it, press ^P (Control-P) in DOS Edit, then the "Escape" key. Other text editors allow one to create the "Escape" character by pressing ^V first.)
Also note the reversed questioning of the input-varaibles

To implement a WAIT command, see here: http://malektips.com/dos0017.html

Read other 3 answers

Hi all, i use this script for compress all bak files into the backup folder in separated files with 7zip.
for %%I in (*.bak) do 7z a "%%~nI.7z" "%%I"

The thing i have to add here is when finish compressing each file deletes the source .bak file, is this posible?

Thanks a LOT!!!! & Thanks TheOutcast for the original code from here !!!!


A:Solved: Help With Command Line Batch Script

Read other 14 answers

I am making a batch file that moves an .exe file. whenever it moves the file the extension(.exe) gets removed and the file type is just "file". this doesnt happen with regular files like .txt .jpg ....

A:Solved: Batch script help with file extensions

Read other 7 answers

I am completely new to script writing. I used to make simple batch files, and that is my only experience with them.

What I really want to do is create a batch file that will set my external driver (disk 2) as an active partition when I run it...also, I want to make one to make it inactive. I have been trying this.

In my .bat file i've got

diskpart /s c:\diskpart.txt
"diskpart.txt" being where I have these commands:

select disk 2
select partition 1
when I run it it just looks like it's repeating the "diskpart /s c:\diskpart.txt" over and over, and does nothing.

Since I am so ignorant with the way this has to work, if you could show me exactly what I have to write for it to work, that would be amazing. Any help would be wonderful.



A:Solved: Diskpart Batch // Script Question

Read other 12 answers


I am attempting to write a batch script that uses a program called Mailsend to send an email. The script then examines Mailsend's log output to determine if the email was successfully sent.
This is what I have so far:

mailsend1.17b14.exe -to <snip personal info> -log temp.txt -attach test.txt
.\Tail\Tail -1 temp.txt > temp2.txt
Del temp.txt
Set /p Message=<temp2.txt

Set Message=%Message:~26%

Set Cmess=Mail sent successfully

Echo %Message%
Echo %Cmess%

If "Message"=="Cmess" ( Echo Correct ) Else ( Echo Wrong )

Here is a rundown of what I am doing:
The first line sends the email.
The second and third use a program called Tail to delete all lines except the last one from the log file (the last line contains the output I'm looking for).
The next 2 lines then assign the contents of the log file to a variable then truncate the first 26 characters (date and time info that I don't need).
The next line creates a second variable that contains the desired output (i.e. "Mail sent successfully")
The next two lines echos the contents of the variables.
And finally, the last line compares the two variable and takes a particular action depending on whether the two variables are equal or not.

The comparison at the end is where I'm having problems. Every time I run the script, the last line I get printed on the screen is "Wrong" (i.e. the "Echo Wrong" command is executed meaning "Mess... Read more

A:Problem with string comparison in batch script

Try this:

Set Cmess="Mail sent successfully"

Read other 6 answers

I am having a problem calculating time differences in batch.

I want my script to work out when a user started a process and when they finished it and calulate how long it took them.

E.g. Time In: 09:02. Time out: 11:52 which works out at 02:50 or 2 Hours 50 Mins.

Does any one know how can I set this up in a Batch script?

A:Calculating Time Differences in a Batch Script

Read other 6 answers

I need to script/batch a way of changing file permissions on a whole directory tree. Any ideas on how to do this?

Read other answers