This question already has answers here:
Batch script: how to check for admin rights
(26 answers)
Closed 6 years ago.
I had a question about Windows 10 - is it possible to make cmd.exe, as well as running any .bat, .cmd files admin-only?
Optimally I would like to do this without any additional software.
Yes it is possible to restrict.bat .cmd and cmd.exe. Here are a couple links on how to do so...
How to disable the Windows Command Prompt & .cmd Via Group Policy
Microsoft Forum On Securing Batch Files
Related
This question already has answers here:
How do I open an Explorer window in a given directory from cmd.exe?
(5 answers)
Closed 6 months ago.
I know that I can open a GUI(Graphical User Interface) folder in MacOS with the command "open .",
but how can I do this in windows?
Thank you!
Okay, I got it!
The answer is to write "start xxx"
PS. xxx is the name of the folder.
This question already has answers here:
How to run 'sudo' command in windows [duplicate]
(17 answers)
Running a command as Administrator using PowerShell?
(28 answers)
How to open an elevated cmd using command line for Windows?
(30 answers)
Closed 7 months ago.
I need to run a file as administrator. When opening a file in cmd you write "start applicationhere" and it starts, but it starts without administrator. Is it possible that I run a file through cmd with administrator? Example "withadminpower start applicationhere".
cmd.exe itself cannot UAC elevate, you need to call Powershell:
powershell -Command "&{Start-Process -Verb RunAs winver.exe}"
This question already has answers here:
How to turn screensaver on (windows 7) by a code (in cmd)? [closed]
(5 answers)
Closed 1 year ago.
I want to start "Bubbles.scr" from CMD which is located in C:\Windows\System32\
But it tells me it has no options that I can set.
How do I launch it?
Use
bubbles.scr /s
It can also be called directly from powershell without any options
This question already has answers here:
Windows batch file file download from a URL
(20 answers)
Closed 7 years ago.
I have a batch file, and I'd like to make a part of it save/download a file from a website...
eg.
example.com/file.jpg
This would then be saved to a location on my computer. Is there a way to do this? I've tried using the copy/xcopy/ROBOCOPY commands, but to no avail.
My operating system is Windows 8.1
You can use bitsadmin /? it's native in windows but not sure in windows8
bitsadmin.exe /transfer "JobName" http://download.url/here.exe C:\destination\here.exe
It is operating system specific. On POSIX systems, you might use curl or wget to download files; perhaps they exist on your OS (even if it not POSIX compliant, e.g. Windows, to which both utilities have been ported)
Both curl & wget are free software. You can download their source code, perhaps adapt it to your additional needs (I guess you won't have to do that, but who knows?), compile them into some executable, and run that executable on the command line.
This question already has an answer here:
Script doesnt run from another script
(1 answer)
Closed 4 years ago.
I am using autoit scripting language for automation. I have created an executable of autoit script so that I can run it anywhere. I have uploaded the executable to a different server. I then wrote a windows powershell script which downloads the autoit exe from that server and runs it on windows server 2012. When I run the powershell script manually on windows server 2012, it runs without issues and completes the autoit script. But when I put a powershell script in an application which automatically executes that, the autoit exe gets downloaded successfully but it does not run completely. It gets stuck at the last 2 windows of that third party application.
Following is the sample of a script that I have used for automation on each window:
_FileWriteLog($hFile, "Reboot Window")
$hWnd = WinWait("Install","This system must be ")
_FileWriteLog($hFile, $hWnd)
ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:3]")
Any help would be appreciated .. !! Thanks..
When manipulating external application windows, always use #RequireAdmin in order to get the permission elevation. Also use Opt("WinSearchChildren", 1) in order to search child windows too. Play with "WinTitleMatchMode"
#RequireAdmin ;Will give your script a permission elevation (sometimes its needed)
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Opt("WinSearchChildren", 1) ;0=no, 1=search children also