[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Calling a program from a bat script

Posted on 2011-03-07
4
Medium Priority
?
535 Views
Last Modified: 2012-05-11
Dear all,

I have a program under the following directory:

C:\Program Files\Windows Resource Kits\Tools\delprof.exe

Normally I have to navigate my command prompt to that folder to call the program.

Does anyone know how I can put this into a script?

I also have to put the following after the script delprof.exe /Q /I /D:30

Thanks,

Lyon
0
Comment
Question by:LyonJay
[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 Comments
 
LVL 3

Expert Comment

by:RussPitcher
ID: 35058638
If it's a batch file or a PowerShell script simply call it as if you were typing it:

"C:\Program Files\Windows Resource Kits\Tools\delprof.exe" /Q /I /D:30

Open in new window


Don't forget to enclose any paths with spaces in quotes
0
 
LVL 1

Expert Comment

by:dooet
ID: 35059667
add ";C:\Program Files\Windows Resource Kits\Tools" to the path (without quotes)
in System Proerties >> environment variables >> system variables
0
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 35075777
or --- cmd.bat --->
set path = %path%;"c:\program files\windows resource kits\tools\";
delprof /q /i /d:30
<---

use in between the --> and <-- in your batch file
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 2000 total points
ID: 35082615
If you want to run multiple entries from a path in a batch script then use the cd or pushd commands to change  to that dir, i.e.

@echo off
cls
echo %date% %time% Running delprof
pushd
 "C:\Program Files\Windows Resource Kits\Tools"
delprof.exe /Q /I /D:30
rem some other resource kit commands here
popd
echo %date% %time% Finished running delprof
pause


Save it as whatever.cmd (rather than .bat) and off you go.

Or if ou just want to run this one script just create a new shortcut on your desktop etc. with the full path in it.

Steve
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

656 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