newpersn Posted April 27, 2015 Posted April 27, 2015 Hey all Over the weekend i had a thought, Would it be possible to create a program that will ask for a computer name for it to start delprof2 off. I have a bat file that i change the the name of the computer and start the Remote Registry Service and query and then start the delprof2 off ?(deleting +30 day old profiles) (showing me what user profile its deleting before it happens) Any ideas on where to start?
Steve21 Posted April 27, 2015 Posted April 27, 2015 If you already have a working BAT file can you just use that and ask for an input at stage one for computer name? Or did you want a "program" as such. Steve
newpersn Posted April 27, 2015 Author Posted April 27, 2015 If you already have a working BAT file can you just use that and ask for an input at stage one for computer name? Or did you want a "program" as such. Steve Would be nice for it to ask for computer name at stage one. In the bat file i retype the computers name about 3 times
tmcd35 Posted April 27, 2015 Posted April 27, 2015 how about... SET /P computer="Please enter computer name> " delprof2 /c:%computer% 1
Steve21 Posted April 27, 2015 Posted April 27, 2015 ^ Keep it simple unless you really want to redesign to program Steve 1
newpersn Posted April 27, 2015 Author Posted April 27, 2015 Thank you both ps: How hard is it to change it for a pop up box?
tmcd35 Posted April 27, 2015 Posted April 27, 2015 Not something I've touched in a long time but I think a simple Visual Basic window can be made to take the user input and then pass the result as a variable to the command line for delprof to pick up in the same way...
newpersn Posted April 27, 2015 Author Posted April 27, 2015 Not something I've touched in a long time but I think a simple Visual Basic window can be made to take the user input and then pass the result as a variable to the command line for delprof to pick up in the same way... I installed VB on friday and my mind just went blank, I havent messed with VB since college days. (that was 5 1/2 years ago)
Steve21 Posted April 27, 2015 Posted April 27, 2015 You could throw the parse of the inputbox to a temp vbs file which loads and returns the value. Steve
Steve21 Posted April 27, 2015 Posted April 27, 2015 @echo off call :ComputerName "Enter ze computer fool!:" "PC Name" echo You choose %CompName% REM DoYourDelProfCommandHere exit /b :ComputerName set CompName= set heading=%~2 set message=%~1 echo wscript.echo inputbox(WScript.Arguments(0),WScript.Arguments(1)) >"%temp%\CompNameTemp.vbs" for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\CompNameTemp.vbs" "%message%" "%heading%"') do set CompName=%%a exit /b Steve
Arthur Posted April 27, 2015 Posted April 27, 2015 PowerShell can popup a VB inputbox very easily. Add-Type -AssemblyName Microsoft.VisualBasic $ComputerName = [Microsoft.VisualBasic.Interaction]::InputBox("Enter a computer name:", "Window Title", "")
themightymrp Posted April 27, 2015 Posted April 27, 2015 Not sure if this would work but ripping bits out of a long VBscript I have and tweaking: strComputer = InputBox("Enter Computer name") Set objShell = CreateObject("WScript.Shell") strString = "delprof2 /c:" intshort = 100 objShell.Run "cmd" Wscript.Sleep intshort objShell.SendKeys strString & strComputer objShell.SendKeys "{ENTER}" Save it as a .vbs file
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now