Over 1 million tech questions and answers.

Help me with Batch script!

Q: Help me with Batch script!

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.

RELEVANCY SCORE 200
Preferred Solution: Help me with Batch script!

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

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

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

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

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

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

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

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

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,

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.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.4

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:

C:\WINDOWS\SYSTEM32\TSSHUTDN.EXE 0 /DELAY:120 /POWERDOWNClick to expand...

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.
ECHO Press "N" if you just want to Shutdown
ECHO.
ECHO Press "Y" to Defrag and Shutdown
ECHO.
ECHO Press "Escape" to Cancel
ECHO.

C:\DOS\CHOICE /C:NY^[ /N > NUL

IF ERRORLEVEL 3 GOTO END
IF ERRORLEVEL 2 GOTO FRAG
IF ERRORLEVEL 1 GOTO SHUT

:FRAG
defrag c:

:SHUT
shutdown........

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

Hi All,
got another interesting one.

Windows 10 laptop
2gb memory
500gb hdd

I need to be able to automate uploading a csv file which name changes on a daily basis - e.g. 20170629.csv, 20170630.csv, basically one file each day.

This csv file will have the following columns
ID
DATE
NAME
LOC
Type
REG
MAKE
MODEL
RSN
Op
Unote
Anote
Viewable

I will have data in the following columns - (example in brackets)
DATE (2017-6-30)
NAME (David)
REG (EI-EKO)
VIEWABLE (NO)

the remaining will be "NULL"

Can this uploading of the CSV file be automated by a batch file from windows?

Read other answers
RELEVANCY SCORE 52.4

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

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

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

Regards,
 

A:Solved: Help With Command Line Batch Script

Read other 14 answers
RELEVANCY SCORE 52.4

Hey guys,
I'm creating a batch script to find the time between an action. I'll be mainly using this script as a custom batch compiler for the language PAWN. I'm not that great of an expert when it comes to DOS Batch Programming, but I manage my ways. This batch file was working before and suddenly started printing out "Missing Operator." just today.
Code:

@echo on

FOR /f "tokens=1-4 delims=:.," %%T IN ( "%TIME%" ) DO (
set /a StartTime=100%%T %% 100*360000+100%%U %% 100*6000+100%%V %% 100*100+100%%W %% 100
)

"C:\Users\James\Desktop\PAWN Compiler\pawncc.exe" "%1" -; -(


FOR /f "tokens=1-4 delims=:.," %%T IN ( "%TIME%" ) DO (
SET /a FinishTime=100%%T %% 100*360000+100%%U %% 100*6000+100%%V %% 100*100+100%%W %% 100
)

SET /a FinishTime=%FinishTime%-%StartTime%
SET /a FinishTime=%FinishTime%*10

echo Compile time: %FinishTime% ms

The line that prints out "Missing Operator." are:

Code:

set /a StartTime=100%%T %% 100*360000+100%%U %% 100*6000+100%%V %% 100*100+100%%W %% 100
--
SET /a FinishTime=100%%T %% 100*360000+100%%U %% 100*6000+100%%V %% 100*100+100%%W %% 100

Any helpful tips would be greatly appreciated. Thanks!
James

Edit: Hmm, it seems to be working today. What a weird feat.
 

A:Solved: Missing Operator in Batch Script

Save yourself a line of code.

Code:
set /a FinishTime=(%FinishTime%-%StartTime%)*10

 

Read other 1 answers
RELEVANCY SCORE 52.4

I have been trying to get a .bat script to start a programme after a certain delay after boot. That's no problem, but the programme itself opens in a normal window. I would like the programme that starts to open only in the system tray/notification area, or whatever it is called nowadays. As it is, I have to click on the upper-right red cross to get the programme to do this - a minor inconvenience I know, but still..

Is this possible? I tried a /min switch in my .bat file, to no effect.
Code:
Start /min "" "C:\Program Files (x86)\Internet Download Manager\IDMan.exe"
Thanks!
 

Read other answers
RELEVANCY SCORE 52.4

So I have folders full of tv shows and a program that gives them all matching thumbnails but it saves them as .tbn files and my media server wants .jpg. So i wrote this script to run from my vidoes folder which contains all my tv shows.

Code:
@for /r %%i in (*.tbn) do ren "%%~fi" "%%~ni.jpg"
But now I am using xbmc as well and it looks for many thumbnails as .tbn so I want to change the script to rename any .tbn that is not named season00.tbn (00 being any two digits). If anyone could help me code this it would be much appreciated I tried for hours cause I know it should be a very simple if statement added in there but everything I try either stops renaming anything or still renames everything.
 

A:Solved: Help with a File rename Batch script!

Read other 8 answers
RELEVANCY SCORE 52.4

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: 
@ECHO OFF
netsh interface ipv4 set address name="Wi-Fi" source=static addr=172.16.20.131 mask=255.255.240.0 gateway=172.16.16.2
netsh interface ipv4 set dns name="Wi-Fi" source=static addr=172.16.16.2
netsh interface ipv4 add dns name="Wi-Fi" addr=8.8.8.8 index=2
:EOF

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

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

For starters i would like to apologize about my bad English, i don't use it that frequently so might have a hard time to express myself good enough for you to understand what im trying to do.

I have a .csv file where A1 and B1 will be having constant values, the values are A1 = Name B1 = Order number.

Im trying to figure out if a script could help me to populate the cells beneath A1 and B1?

If it could ask me for name: and then i would have to type in a name that would populate A2, A3, etc. Perhaps it could also ask me for the amount? so if i put in the name "Adapter" and then it asks me for amount where i type in 10 it would put the word "Adapter" in A2-A11

I would also like it to ask me for an order number that would be put into A2-A11 in this case.

The amount that i would like to put in will vary from time to time.

IThis is what i would like the CSV file to look like after inserting the name "Adapter TKS-B" and the amount: 29 along with the order number: 123456. Hopefully you will understand how i want to populate the .csv file.

Is this possible? Again im terribly sorry for my bad English.

Thanks in advance
 

Read other answers
RELEVANCY SCORE 52.4

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