Solved

Windows 7 batch file

Posted on 2011-02-16
7
559 Views
Last Modified: 2012-08-14
I need to create a batch file for windows 7 but I'm not sure of the allusersprofile... He's the script.

MKDIR programdata\usb
xcopy /y RD.exe "programdata/USB"
xcopy /y garde.exe "allusersprofile%\programdata\microsoft\windows\startmenu\programs\startup
xcopy /y edrag.ini "Users\Public\"

cd\ "ALLUSERSPROFILE%\programdata\microsoft\windows\startmenu\programs\startup

START garde.exe

I'm not sure is this is the proper script.  Can someone advise???
0
Comment
Question by:WellingtonIS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 6

Expert Comment

by:CrowaX
ID: 34909213
Your allusersprofile and programdata (if you are refering to the system one) should have the % on both sides.

example cd\ "%ALLUSERSPROFILE%\programdata\microsoft\windows\startmenu\programs\startup

and if you want the C:\programdata folder, the way you have the first and second line may work, but if it doesnt, change that one to MKDIR %programdata%\usb

Other than that it looks good at a glance.
0
 

Author Comment

by:WellingtonIS
ID: 34909228
I will try thanks
0
 

Author Comment

by:WellingtonIS
ID: 34909700
I get Does programdata\usb specify a file name or Directory f=file D-directory.  How do I put this in the script?
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 6

Expert Comment

by:CrowaX
ID: 34909803
try changing it to C:\programdata\usb, or %programdata%\usb
If that doesnt work, then try adding echo d | in front of that part of the script. We did that on ours to specify directory.

echo d | xcopy /y RD.exe C:\programdata/USB

Also I just saw, you dont need the quotes around directory names that do not have a space in them, although I dont think it hurts to have them. But if you start the directory name with a quote, you have to finish it with one.
0
 
LVL 6

Accepted Solution

by:
CrowaX earned 500 total points
ID: 34909882
Found a few more flaws with your \ being the wrong way in the second line, and some others. Here is your working code, I just tested it on my machine. The only issue I get with it is that you need permissions to copy to the startup folder, so the batch file may need to be ran with admin rights.

MKDIR C:\programdata\usb
xcopy /y RD.exe "C:\programdata\USB"
xcopy /y garde.exe "%allusersprofile%\microsoft\windows\start menu\programs\startup\"
xcopy /y edrag.ini "C:\Users\Public\"
cd\ "%ALLUSERSPROFILE%\microsoft\windows\startmenu\programs\startup
0
 

Author Comment

by:WellingtonIS
ID: 34910013
thanks I'm trying it now.
0
 

Author Closing Comment

by:WellingtonIS
ID: 34910048
Just make sure you have a space between start and menu
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question