I'm building a image, which was made by microsoft/aspnet and builder OS:
C:\> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft
OS Version: 10.0.17763 N/A Build 17763
, I got error after running RUN icacls 'C:\inetpub\wwwroot\' /grant 'IIS_IUSRS:(F)'
Invalid parameter "'IIS_IUSRS:(F)'"
The command 'cmd /S /C icacls 'C:\inetpub\wwwroot\' /grant 'IIS_IUSRS:(F)'' returned a non-zero code: 87
But under the base image which was made by microsoft/aspnet and builder OS
PS C:\> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft
OS Version: 10.0.18362 N/A Build 18362
Was totally OK, anyone knows why?
Your codes are okay but a very lil mistake
Try this
icacls '\inetpub\wwwroot\' /grant "IIS_IUSRS":f
Hope your problem will solve.
Related
Use findstr to filter a string OS Version:
C:\Windows\system32>systeminfo | findstr "OS Version"
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.19044 N/A Build 19044
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
BIOS Version: American Megatrends Inc. 4.6.5, 2020/11/2
Notice: systeminfo | findstr "OS Version:" has the same result.
Why the output can't be as below:
OS Version: 10.0.19044 N/A Build 19044
Why the output contains many other lines unrelated to the matching string OS Version?
Because "OS Version" matches both "OS" and "Version". If you want to match the entire string "OS Version" instead of either word, this is what you want:
systeminfo | findstr "OS\ Version"
And that will match "OS Version" and "BIOS Version" lines. So filter out the BIO version thing like this:
systeminfo | findstr "OS\ Version" | findstr /v BIOS
I am writing a shell script which runs on cygwin console for windows, my scritp looks like this
#!/usr/bin/bash
cmd /c start /d "C:\cygwin\bin" ipconfig | findstr /R /C:"IPv4 Address"
ipconfig #to print
route add 10.2.139.1 192.168.104.1
But when i execute this script on cygwin console it shows below error and even i changed to ipconfig \all it doesn't work
Error: unrecognized or incomplete command line.
USAGE:
ipconfig [/allcompartments] [/? | /all |
i am trying to get ip address dynamically by executing the script and adding to the route table
Thanks,
Rohith
I don't know why you did this with cygwin instead of cmd.exe, what you use it for and why use start, but, all you missing is one option /b:
cmd /c start /d "C:\cygwin\bin" /b ipconfig | findstr /R /C:"IPv4 Address"
And start is redudant as follows:
cmd /c ipconfig | findstr /R /C:"IPv4 Address"
/b just suppresses the newly created cmd.exe background window.
In the help of printui.dll,PrintUIEntry /?, we have the following examples for remotely installing printer driver with the help of /c switch.
Add printer driver using inf:
rundll32 printui.dll,PrintUIEntry /ia /c\\machine /m "Brother DCP-128C" /h "x86" /v "Type 3 - User Mode" /f c:\infpath\infFile.inf
Add printer driver using inf:
rundll32 printui.dll,PrintUIEntry /ia /K /c\\machine /m "Brother DCP-128C" /h "x86" /v 3
I am failing in getting this to work with an error code of 0x32 (This function is not supported). I am doing the following :
Using "net use" to create a connection to the remote server using the remote server's admin credentials.
Disabling the UAC in the remote machine.
Running the above command with and without /K.
I can see that it is copying the driver files into the remote machines "print$" folder but the remote installation finally fails with an error prompt with error code of 0x32.
Is there a way or a specific condition to make this thing work ? Because it is mentioned as an example in the help documentation, I think that I might be missing something.
Are there any other ways to achieve the desired task?
I am working on a Virtual Printer and I'm stuck at printer installation. Installation is made by InnoSetup
[run] Filename : rundll32.exe; Parameters: "printui.dll, PrintUIEntry /if /f ""{app}\ghostscript\ghostpdf.inf"" /r ""TitusVirtualPrinter:"" /m ""Ghostscript PDF"" /b ""Virtual Printer"" /u /Y "; StatusMsg: Installing PS Printer for Ghostscript; Description: Ghostscript PS Printer; Flags: waituntilterminated shellexec;
That line works perfectly and the program installs on Windows 7 systems (Pro 32&64bits) but not in Windows 8. I don't have any error message.
could it be the same as this:
http://www.jenovarain.com/2012/12/ghostscript-printer-on-windows-8-64-bit/
perhaps they key information in that article relating to your problem is
you will want to select option #7 “Disable Driver Signature
Enforcement”
I need a way to find out what version of windows I'm running in using simple command line tools (no powershell). I need it to work from a non-privileged user, and I need to be able to parse out the difference between Windows XP, Vista, server 2008, and 7. I'm currently using:
wmic os get Caption but that fails when the user doesn't have permissions to run wmic.
Update:
To clarify, I need this command to not break with different service pack levels, etc. which probably rules out parsing a specific version number. Also if you look at this list of windows versions, you'll see that the numbers reported on Windows 7 and server 2008 r2 are the same.
I solved this problem by parsing the output of:
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName"
systeminfo command shows everything about the os version including service pack number and the edition you are using.
C:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows 7 Enterprise
OS Version: 6.1.7601 Service Pack 1 Build 7601
Reference: Find Windows version from command prompt
You can use ver. I'm on a school computer with a non-privileged command prompt, and it gives me Microsft Windows [Version 6.1.7601]. I'm sure you'd be able to sort out Vista and XP from the number you get.
cmd displays the Windows version when started:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Joey>_
This is also a similar line as the one ver spits out, indeed.
One option then might be
echo exit|cmd|findstr Windows
another
cmd /c ver
depending on whether you have a pipeline or not.
if not CMDEXTVERSION 2 (
echo Error: This batch requires Command Extensions version 2 or higher
exit /b 1
)
FOR /F "usebackq tokens=4 delims=] " %%I IN (`ver`) DO for /F "tokens=1,2 delims=." %%J IN ("%%I") do set WindowsVersion=%%J.%%K
if "%WindowsVersion%" LSS "6.1" (
echo Error: This batch requires Windows 7 SP1 or higher
exit /b 1
)
You can get the SysInternals and install onto your C:\ directory. After that you can then go to a command prompt and use the command PSINFO.
It is great because it lets me query any PC on the network (that I have access to). At the command prompt you type: PSINFO \exactnameofcomputer
(PSINFO whack whack exactnameofcomputer)
Then hit enter. It will take a moment or two to report back, depending on where that computer is located at.