Over 1 million tech questions and answers.

Script/batch files

Q: Script/batch files

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???

RELEVANCY SCORE 200
Preferred Solution: Script/batch files

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/batch files

gtbwill,

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/

Regards,
Roger

Read other 1 answers
RELEVANCY SCORE 68

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

Read other answers
RELEVANCY SCORE 68

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
RELEVANCY SCORE 68

Hi ,

I am very new to windows.

I wanted to know how to copy the files from Linux to Windows using script ? Not all the files but only selected file pattern.

Like I want to copy all the files with today's date ( abc02152013abcd , xyz02152013mno ..) from Linux Machine A under the path /usr/tmp to windows machine path Z:test/

Any help in this regards ?
 

Read other answers
RELEVANCY SCORE 67.2

Hi guys,
I found out recently that the "Hibernate" feature on windows could potentially compromise truecrypt keys, and certain content from an encrypted drive or encrypted virtual partition.

When I found out, I sought to remove the "hibernate" feature from my computer, and remove the "Hiberfil.sys" file that could be potentially holding sensitive information.

Now, you're probably thinking "why would you want a batch script to do that? Its located on C: (windows partition drive), just go there, and delete it!"...
The problem with that, is the fact that I have had windows on multiple drives, of which I have not re-formatted yet, and also have windows XP installed on the same partition as my windows 7 OS.

So basically, I just want to make a batch file, that will work with windows 7, to search for "hiberfil.sys" through a hard drive (I'll just copy the batch file to each partition's root and run it on each partition separately), then delete the file or files if there are multiples of them.

The search will need to include "hidden" attributes, and perhaps include "system" files, and "read only" files in the search too, but not limit the search to those attributes (also include files with no special attributes attached).
I just want to do a good, clean purge of any hiberfil files on any partition.
Anyone able to help me out with this?
 

A:Search for, and Delete hiberfil.sys files using batch script.

If you have several Windows installs, you need to go inside each and disable sleep before you can delete that hiperfil. Maybe it won't let you delete that file when the feature is enabled.
 

Read other 2 answers
RELEVANCY SCORE 67.2

Hello,

I have the following batch file that works great, until I happen to execute it on a file with a + in it.

@echo off
cls
for /r %%f in (*txt) do copy %%f m:\text files

I searched around for a bit, but I couldn't get any of the information I found about escape characters to work. How can I make the batch file treat the file name in %%f as a literal?

Thanks!
 

A:Batch script to create files with special characters

Read other 10 answers
RELEVANCY SCORE 67.2

I need a script to zip files on my local computer and move them to an SFTP folder.

Currently, I have WinZip for zipping and WinSCP for SFTP file access.

I have tried the following for SFTP file access:
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:[email protected]
# Connect
open username:[email protected]
# Change remote directory
cd /home/username
# Force binary mode transfer
option transfer binary
# Upload file from local directory C:\BACKUP\*.zip
get C:\BACKUP\*.zip home\username
# Disconnect
close
# Exit WinSCP
exit


During the code WinSCP states, "No Session".

Please let me know if you can help.
Thanks in advance.

Read other answers
RELEVANCY SCORE 66.4

Hello there,

One of my job functions is to take full resolution videos from our in-house editors and convert them to FLVs for web viewing. I'm trying to create a script to do this for me. Here are the steps that it does:

1. Check if Sorenson Squeeze is running. If it is, quit this script.
2. Check if files exist on the server share (where editors put videos).
3. Copy files from the server to the local encoding machine in a "to process" folder.
4. On the server-side, move the files just copied to an archive folder.
5. Look for movie files to be processed and run them through the squeeze command (encode the files!).
6. Move processed files on the local machine to a "processed" folder

Here is the code that I'm using, with the problems I'm having in red italics.



Code:
@echo off

:SQUEEZECHECK
tasklist /FI "IMAGENAME eq Squeeze.exe" 2>NUL | find /I /N "Squeeze.exe">NUL
if "%ERRORLEVEL%"=="0" goto ALREADYRUNNING
if "%ERRORLEVEL%"=="1" goto FILECHECK

:FILECHECK
if exist Z:\fileCheck\*.mov (goto COPYNEWFILES) else (goto NOVIDEOS)

:COPYNEWFILES
rem copies files from server to local machine
robocopy Z:\fileCheck C:\EncodeStack\processing *.mov /DCOPY:T /MIN:10240 /R:0 /NJH /NJS /MON:1
goto ARCHIVEFILES

Since the script runs every 10 seconds, RoboCopy often
copies files that have not finished being copied to the server. For Example,
an editor might begin m... Read more

Read other answers
RELEVANCY SCORE 66

Hi Everyone,

I have 500 files coming in and I need to first check if any file(s) exist then rename all of them regardless of what their filename is (the files are named in a different language).

No need to process them in any order.

Rename:

1. ??X?d?f-20110703-?+?d?H?-?-?=??.xls?
2. ??X?d?f-20110707-?+??-+?8.xls?
3. ??X?d?f-20110707-?+???j??.xls?
4. ??X?d?f-20110708-?+???M?n.xls?
5. ??X?d?f-20110713-?d?O?n?h?P.xls?
.
.
.
500


To:

?TWN_CH_INV_VISIT_FORM_01.xls?
?TWN_CH_INV_VISIT_FORM_02.xls?
?TWN_CH_INV_VISIT_FORM_03.xls?
?TWN_CH_INV_VISIT_FORM_04.xls?
?TWN_CH_INV_VISIT_FORM_05.xls?
.
.
.
?TWN_CH_INV_VISIT_FORM_500.xls?


Hope you could help me on this one. I?ve been trying to do this for weeks.


Thanks!

A:How to rename and add incrementing number suffix on multiple files in Batch Script?

You can do this with Windows Explorer for the most part.

If you select a bunch of files and then right click and chose rename, you can type in what you want the base file name to be and then windows will take care of adding the number to the end of the file.

HOW TO: Rename Multiple Files in Windows XP with Windows Explorer

Read other 1 answers
RELEVANCY SCORE 62

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:

BEGIN.BAT

:START
@ECHO OFF
CLS
ECHO.
ECHO Please enter the full filename reference (e.g. 1-210208)
ECHO.
SET REFERENCE=
SET /P REFERENCE=
CLS
ECHO.
ECHO Please enter the full description (e.g. 12:15 on Thursday 21 FEBRUARY 2008)
ECHO.
SET Description=
SET /P Description=
CLS
ECHO.
ECHO Please enter the date reference (e.g. 210208)
ECHO.
SET DTE=
SET /P DTE=
CLS
ECHO.
ECHO Please enter the reservation slot time (e.g. 1215)
ECHO.
SET TME=
SET /P TME=
CLS
ECHO.
ECHO Please enter the script file you are replacing (e.g. 001)
ECHO.
SET Replace=
SET /P Replace=
CLS
ECHO.
ECHO Please enter the continuing script file (e.g. 002)
ECHO.
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"
CLS
ECHO.
ECHO REPLACEMENT OF %Reference% completed!
PAUSE
GOTO START

TEMPLATE.BAT

ECHO @ECHO OFF
ECHO CLS
ECHO IF EXIST "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT" (
ECHO GOTO NEXT
ECHO ) ELSE (
ECHO GOTO EXIST
ECHO )
ECHO :EXIST
ECHO ECHO.
ECHO ECHO %DESCRIPTION% IS AVAILABLE
E... Read more

A:Help with Batch script that creates a Batch script

Try This

Template.Bat
Code:

@ECHO OFF
CLS
IF EXIST "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT " (
GOTO NEXT
) ELSE (
GOTO EXIST
)
:EXIST
ECHO.
ECHO %DESCRIPTION% IS AVAILABLE
ECHO.
ECHO Would you like to reserve this time?
ECHO.
ECHO Yes (Y) or No (N) or Cancel (C)
ECHO.
:ERROR
SET CHOICE=
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.
GOTO ERROR
:YES
ECHO %DESCRIPTION%>>"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\ %REFERENCE%.TXT"
ECHO RESERVED BY %FullName%>>"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT"
ECHO LOCATED ON %Team%>>"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT"
ECHO STAFF ID IS %USERNAME%>>"\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\%REFERENCE%.TXT"
ECHO "%DATE%","%TIME%","%USERNAME%","%FullName%","%Team%","%DTE%","%TME%">>"\\hb eu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\LOG\AUDIT.CSV"
ECHO.
ECHO Thank you %FullName% - Your reservation has been successful.
ECHO.
PAUSE
:NEXT
CALL "\\hbeu\DfsRoot\GB002\Retail\405447\SYSTEMS\SHARED\INET\ONE\DATES\002.BAT&quo... Read more

Read other 3 answers
RELEVANCY SCORE 59.6

Given two text files:
C:\INFO.TXT
XXX.XXX
XXXX_XXXX_XXXX_XXXX_XXXX

C:\HISTORY.TXT
TIMESTAMP
XXX.XXX
XXXX_XXXX_XXXX_XXXX_XXXX

TIMESTAMP
XXX.XXX
XXXX_XXXX_XXXX_XXXX_XXXX
I need a batch file / script that is able to do the following:
- Append a “.F53FLIN” to the end of the second line in the INFO.TXT so it looks like “XXXX_XXXX_XXXX_XXXX_XXXX.F53FLIN”
- Add 4 lines in the HISTORY.TXT file, a timestamp (when the script is run, now()), and a copy of INFO.TXT with an empty/blank line following it
So, in essence I am trying to write a script that adds the .F53FLIN to the INFO.TXT (second line) and a TimeStamp+INFO.TXT+BLANK LINE in the HISTORY.TXT (append to the end).

I have tried a few attempts but nothing is coming out even close to right, was hoping someone could help solve the problem.
Any hints, ideas, or help would be greatly appreciated,
 

A:Adding Text to Text Files [Batch Script]

Which language are you trying to develop this script in?
 

Read other 1 answers
RELEVANCY SCORE 59.6

Hi,

how can I merge two csv files (A and B) side by side with batch script ?:


Code:
A:

a b c
d e f

Code:
B:

h i j k
l m n o
p q r s
and the desired output should be C:


Code:
C:

a b c h i j k
d e f l m n o
(blank)p q r s

A:How do I merge two csv files side by side with batch script

Broke a sweat writing this one.

Here's your batch script, Electr0n2. Simply pass both CSV files as parameters.


Merge_two_csv_files_side_by_side.bat

Code:
:: Takes two CSV files and combines them "side-by-side".

@echo off
if "%~2"=="" exit /b 1& if not "%~3"=="" exit /b 1

::
set outfile=".\%~n1_%~n2.csv"
set outfile_csv_delimiter=","
::

goto :main

:file_line_counter FileName VariableName
setlocal
for /f "delims=" %%I in (' find /v /c "" ^< "%~1" ') do (
set VAR=%%I
)
endlocal & set %2=%VAR%
goto :eof

:SUB Counter CsvFileName
setlocal
if "%~1" GTR "0" ( set skip="skip=%1") else ( set skip="")
for /f "tokens=1,* %SKIP:"=% delims=]" %%I in (' find /v /n "" ^< "%~2" ') do (
for %%K in (%%J) do (
set/p=%%K <NUL >>%TEMPFILE%
)
goto :break
)
:break
endlocal
goto :eof

:r_trim_once Char
setlocal EnableDelayedExpansion
call :get_string_length "%~1"
for /f "delims=" %%I in ('type "%OUTFILE:"=%"') do (
set line=%%I
if "!LINE:~-%STRING_LENGTH%!"=="%~1" set line=!LINE:~0,-%STRING_LENGTH%!
echo.!LINE!>>%TEMPFILE%
)
copy %TEMPFILE% "%OUTFILE:"=%" >NUL
del %TEMPFILE%
endlocal
goto :eof

:get_string_length String
setlocal
set... Read more

Read other 6 answers
RELEVANCY SCORE 54

Hi,

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.

Thanks

Read other answers
RELEVANCY SCORE 54

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
RELEVANCY SCORE 54

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


Code:
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
RELEVANCY SCORE 54

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

I started with code that looked like

:loop1
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

:loop2
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

:loop3
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 (000.000.000.000) from 0-255.

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

Thanks

Read other answers
RELEVANCY SCORE 54

Hi,

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 10.10.10.0 to 10.10.10.200 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 10.10.10.0 to 10.10.10.200 range.
Code:

@echo off
Title "Back up My Documents"

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

: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:
exit
Thanks for all the help
Jat421
 

A:Batch script

Read other 9 answers
RELEVANCY SCORE 54

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

Code:

[General]
Name= Entered Text
Model= Entered Text

[Support Information]
Line1= Entered Text

Any Help Or Just Point Me In the Rite Direction Please

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
RELEVANCY SCORE 54

Hello All,

Greetings!

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
RELEVANCY SCORE 54

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.

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.

Code:
@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 - ::
:: ::
::===================================::
:JDate
:: Convert date to Julian
:: Arguments : YYYY MM DD
::... Read more

Read other 3 answers
RELEVANCY SCORE 54

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
example
pc server = 192.168.3.200
pc -01 = 192.1683.1
D\gameonline\dota2\
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=\\192.168.3.77\D\GameOnline\DOTA 2\"
set "pc-24=\\192.168.3.24\D\DOTA 2\"
robocopy /"%pc_server%/" /"%pc-24%/" /mir

Read other 6 answers
RELEVANCY SCORE 54

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:

Code:
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
RELEVANCY SCORE 53.6

Hi,

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.

Thanks

A:Help Needed in Batch Script

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


Code:
www.pic.com/pic01.jpg
www.pic.com/pic02.jpg
right?

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
RELEVANCY SCORE 53.6

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:

Script.bat
Code:
FTP.EXE -s:SCRIPT.TXT

Script.txt:
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 :
Code:
[SIZE=2]
open **.***.**.*** (IP)
******** (USERNAME)
******** (PASSWORD)
lcd c:\logs
quote PASV
cd /demott
quote PASV
get qconsole.log
cd /demott/logs
quote PASV
put qconsole.log
[COLOR=Red]close
open **.***.**.*** (NEW IP)
******** (USERNAME)
******** (PASSWORD)
lcd c:\logs
quote PASV
cd /logs
quote PASV
put qconsole.log
quit[/COLOR][/SIZE]

 

Read other 2 answers
RELEVANCY SCORE 53.6

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. 192.168.1.10) 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
RELEVANCY SCORE 53.6

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

thank you,

[email protected]
 

Read other answers
RELEVANCY SCORE 53.6

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
RELEVANCY SCORE 53.6

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
RELEVANCY SCORE 52.8

Hi,

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 ?

Thanks
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
RELEVANCY SCORE 52.8

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.
http://answers.microsoft.com/en-us/...tcut-for/4e57f536-50a8-4942-a84a-290b3dea1ffb
 

Read other 2 answers
RELEVANCY SCORE 52.8

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.
Code:
"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
RELEVANCY SCORE 52.8

Hello,

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:


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%
pause
The content of C:\app\temp\installed_app.txt is the following:


Code:
CCleaner
DjVuLibre+DjView
FreeCommander 2009.02b
IrfanView (remove only)
Windows Management Framework Core
Microsoft SQL Server 2005
Mozilla Firefox (3.6.16)
OpenVPN 2.1.3
SyncBack
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)
CDBurnerXP
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
RELEVANCY SCORE 52.8

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
RELEVANCY SCORE 52.8

Hallo,

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
RELEVANCY SCORE 52.8

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
RELEVANCY SCORE 52.8

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

Code:
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:

Code:
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
RELEVANCY SCORE 52.8

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
RELEVANCY SCORE 52.8

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.

thanks,

v
 

A:Solved: random batch/vbs script

Read other 13 answers
RELEVANCY SCORE 52.8

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

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
:check3264
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
)
:uacok
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
RELEVANCY SCORE 52.8

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
RELEVANCY SCORE 52.8

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
RELEVANCY SCORE 52.8

Hi,

A file contains path as
var=C:\....\....\\...\\....
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
RELEVANCY SCORE 52.8

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
setlocal
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"
pause
 

A:Command Line Batch Script

Read other 6 answers
RELEVANCY SCORE 52.8

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
RELEVANCY SCORE 52.4

Hey, guys. I'm hoping someone here has some experience with this. I've installed Prey and LogMeIn onto my laptop and both use automatic services that must be started to function properly. I hate to burden my already resource-starved laptop, so I'd like to set the services to manual and write a batch script to turn on the services when triggered. That way if the laptop is ever lost or stolen (knock on wood), I can start the services again. And until then, both apps would be dormant and not using up any resources.

Now writing the script is simple by using Net Start to start the services. The tough part is figuring out how to remotely trigger it. While googling, I discovered that Outlook 2003 has an email rule that can launch applications. Pretty cool. So I can send an email with a keyword or phrase that will launch pretty much anything I want. While I'm pretty sure this would do the trick, I feel like there has to be another way. A way that doesn't involve Outlook always running in the background!

Thanks for reading.

A:Remotely trigger batch script? By email?

Came across this. Not as elegant as an email trigger, but it'll do the trick. At least now I don't have to install Outlook! LOL!!!

Launch Applications Remotely with Dropbox and AutoHotkey

Read other 1 answers
RELEVANCY SCORE 52.4

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