How to avoid interepretation of string as command in CMD? - windows

I have code which get PNPDeviceID of Videocard currently installed in system
FOR /F %i IN ('wmic path win32_VideoController get PNPdeviceid ^| findstr _') DO (SET fd="%i")
echo %fd%
C:\Users\user>echo %fd:~1,-1%
PCI\VEN_10DE
"DEV_0641" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
"SUBSYS_00000000" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
Системе не удается найти указанный путь.
"1A8B4BFC" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
"0" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
"0008" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
When I try to display value of fd variable CMD interpret value of variable as chan of commands and try to execute it. Can I somehow avoid it? Because I need to store only part of this variable, but when i try to do it I recieve error message.
I understand that CMD see & sign and try to interpret it as command operator

Use echo "%fd%" instead of echo %fd%. Doublequotes preserve cmd.exe from interpreting & as a command chaining character.

Related

How to check if an attribute is present in an xml node using xmllint

I'm using bash and xmllint to check nodes in the following xml:
<?xml version="1.0" encoding="utf-8"?>
<output>
<document>
<sentence id="13">
<text>This is a test sentence.</text>
<entities>
<annotation id="3">
<grammar-form id="0" normal-form="THIS"/>
</annotation>
<annotation id="4">
<grammar-form id="0" normal-form="IS"/>
</annotation>
<annotation id="5">
<grammar-form id="0" normal-form="A"/>
</annotation>
<annotation id="6">
<grammar-form id="0" normal-form="TEST"/>
</annotation>
<annotation id="7">
<grammar-form id="0" normal-form="SENTENCE"/>
</annotation>
<annotation id="12">
<grammar-form id="0" normal-form="."/>
</annotation>
</entities>
</sentence>
</document>
</output>
How can I simply check that each grammar-form node has a normal-form attribute present? It doesn't matter what the attribute value is, I just need to check that it is present.
It's easier to select grammar-forms that don't have the attribute and see if you get any matches or not:
if xmllint --xpath '//grammar-form[not(#normal-form)]' input.xml 1>/dev/null 2>&1; then
echo "There are missing normal forms."
else
echo "There are no missing normal forms."
fi
In xpath mode, xmllint will print the matching paths, or if nothing matches, exit with a error code of 10 and print a message to that effect to standard error (the --noout option mentioned in the manpage to suppress output doesn't do anything in the version I'm testing with, unfortunately), hence the redirections.

How to hardcode Zebra label substitution in this script?

I am familiar with some label formatting but having an issue with this task. In the image, there is a table that should populate in the middle area when there are locations (up to 10), with columns for location, size description, TOT To SER, Description, and UN Number. I need to hardcode some values so I can see them in a ZPL viewer and mess with the formatting. How can I hardcode those values so I see atleast the row for location_1 with table borders? Thanks in advance for any help! I know the code is long but I think I just need to hardcode the location_1 body the middle of the code to anything. Like LOCATIONXYZ
#parse("version.vm")
#if ($PrintMode == "Bartender" || $PrintMode == "MarkMagic")
^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR2,2~SD15^JUS^LRN^CI0^XZ
^XA
^MMT
## crtncnts.vm - Carton Content Label (6x8 inches 203 dpi)
## in:
## /appli/manh/wms/profile-root/runtime/data/labels/ZE1
## /appli/manh/wms/distribution/data/labels/ZE1
## version:
^FX crtncnts.vm - 2017/09/07 - v4.1 ^FS
## change:
## 2017/08/29 - v3.1 - add comments and versionning
## 2017/09/06 - v3.2 - change of date format
## 2017/09/07 - v4.0 - suppression of "origin" column + set "UN Number" column to cust_sku_n
## 2017/09/07 - v4.1 - use of $vendor_item_nbr_n instead of $cust_sku_n in "UN Number" column
## Label size for 203 dpi (with 6+6 margin space)
^PW1224
^LL1632
## Framework (origin is 33x33)
^FO33,33^GB1167,1567,7^FS ^FX Global frame ^FS
^FO160,33^GB220,527,7^FS ^FX Bloc 4 (right) ^FS
^FO160,553^GB220,527,7^FS ^FX Bloc 3 (middle) ^FS
^FO160,1073^GB220,527,7^FS ^FX Bloc 2 (left) ^FS
^FO953,33^GB247,1567,7^FS ^FX Bloc 6 (footer) ^FS
## Blocs in read direction
## Bloc 1 (header)
^FT120,547^A0B,67,60^FB487,1,0,R^FD$!{carton_nbr}^FS
^FT120,1073^A0B,67,60^FB520,1,0,C^FDPicking List^FS
^FT107,1573^A0B,33,31^FC%,#,*^FD%m/%d/%Y %H:%M:%S^FS
## Bloc 2 (left)
^FT200,1573^A0B,33,31^FDCustomer:^FS
^FT247,1553^A0B,33,31^FD$!{d_facility_name}^FS
#set ($Max_NbChar=31) #if ($!{ship_to_name.length()} > $Max_NbChar) #set ($ship_to_name=$ship_to_name.substring(0,$Max_NbChar)) #end
^FT287,1553^A0B,33,31^FD$!{ship_to_name}^FS
## Bloc 3 (middle)
^FT200,1053^A0B,33,31^FDConstituting a Parcel: $!{carton_type}^FS
#set ($Max_NbChar=14) #if ($!{orders_ref_field3.length()} > $Max_NbChar) #set ($orders_ref_field3=$orders_ref_field3.substring(0,$Max_NbChar))
#end
^FT247,1053^A0B,33,31^FDType of Shipment: $!{orders_ref_field3}^FS
## Bloc 4 (right)
#set ($Max_NbChar=18) #if ($!{po_nbr.length()} > $Max_NbChar) #set ($po_nbr=$po_nbr.substring(0,$Max_NbChar)) #end
^FT200,540^A0B,33,31^FDOrder Number: $!{po_nbr}^FS
^FT247,540^A0B,33,31^FDDelivery Number: $!{distro_number}^FS
^FT333,520^BY3,3,73^BCB,,Y,N^FD>:$!{distro_number}^FS
## Bloc 5 (list): columns are ordered A to E in reading direction
## Bloc 5 (list): header framework (FWK)
#set($FWK_Offset_x=387)
#set($FWK_Offset_y_E=53)
#set($FWK_Offset_y_D=253)
#set($FWK_Offset_y_C=1013)
#set($FWK_Offset_y_B=1160)
#set($FWK_Offset_y_A=1373)
#set($FWK_Size_x=53)
#set($FWK_Size_y_E=203)
#set($FWK_Size_y_D=762)
#set($FWK_Size_y_C=149)
#set($FWK_Size_y_B=216)
#set($FWK_Size_y_A=209)
#set($FWK_Thickness=3)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
## Bloc 5 (list): header content (CNT)
#set($CNT_size_x=23)
#set($CNT_Size_y=21)
#set($CNT_Offset_y_E=240)
#set($CNT_Offset_y_D=999)
#set($CNT_Offset_y_C=1146)
#set($CNT_Offset_y_B=1360)
#set($CNT_Offset_y_A=1567)
#set($CNT_offset_x=420)
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FDUN_Number^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FDDescription^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FDTOT TO SER^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FDSize Description^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FDLocation^FS
## Max number of character for each column (ordered A to E in reading direction)
#set($Max_NbChar_E=16)
#set($Max_NbChar_D=64)
#set($Max_NbChar_C=11)
#set($Max_NbChar_B=17)
#set($Max_NbChar_A=17)
## Shift between each line (Step)
#set($Step=51)
## Bloc 5 (list): line 1
#if ($location_1)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_1.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_1=$vendor_item_nbr_1.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_1.length()} > $Max_NbChar_D) #set ($sku_desc_1=$sku_desc_1.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_1.length()} > $Max_NbChar_C) #set ($qty_1=$qty_1.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_1.length()} > $Max_NbChar_B) #set ($dsp_sku_1=$dsp_sku_1.substring(0,$Max_NbChar_B)) #end
#if ($!{location_1.length()} > $Max_NbChar_A) #set ($location_1=$location_1.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_1}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_1}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_1}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_1}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_1}^FS
#end
## Bloc 5 (list): line 2
#if ($location_2)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_2.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_2=$vendor_item_nbr_2.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_2.length()} > $Max_NbChar_D) #set ($sku_desc_2=$sku_desc_2.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_2.length()} > $Max_NbChar_C) #set ($qty_2=$qty_2.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_2.length()} > $Max_NbChar_B) #set ($dsp_sku_2=$dsp_sku_2.substring(0,$Max_NbChar_B)) #end
#if ($!{location_2.length()} > $Max_NbChar_A) #set ($location_2=$location_2.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_2}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_2}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_2}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_2}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_2}^FS
#end
## Bloc 5 (list): line 3
#if ($location_3)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_3.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_3=$vendor_item_nbr_3.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_3.length()} > $Max_NbChar_D) #set ($sku_desc_3=$sku_desc_3.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_3.length()} > $Max_NbChar_C) #set ($qty_3=$qty_3.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_3.length()} > $Max_NbChar_B) #set ($dsp_sku_3=$dsp_sku_3.substring(0,$Max_NbChar_B)) #end
#if ($!{location_3.length()} > $Max_NbChar_A) #set ($location_3=$location_3.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_3}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_3}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_3}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_3}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_3}^FS
#end
## Bloc 5 (list): line 4
#if ($location_4)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_4.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_4=$vendor_item_nbr_4.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_4.length()} > $Max_NbChar_D) #set ($sku_desc_4=$sku_desc_4.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_4.length()} > $Max_NbChar_C) #set ($qty_4=$qty_4.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_4.length()} > $Max_NbChar_B) #set ($dsp_sku_4=$dsp_sku_4.substring(0,$Max_NbChar_B)) #end
#if ($!{location_4.length()} > $Max_NbChar_A) #set ($location_4=$location_4.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_4}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_4}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_4}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_4}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_4}^FS
#end
## Bloc 5 (list): line 5
#if ($location_5)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_5.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_5=$vendor_item_nbr_5.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_5.length()} > $Max_NbChar_D) #set ($sku_desc_5=$sku_desc_5.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_5.length()} > $Max_NbChar_C) #set ($qty_5=$qty_5.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_5.length()} > $Max_NbChar_B) #set ($dsp_sku_5=$dsp_sku_5.substring(0,$Max_NbChar_B)) #end
#if ($!{location_5.length()} > $Max_NbChar_A) #set ($location_5=$location_5.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_5}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_5}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_5}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_5}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_5}^FS
#end
## Bloc 5 (list): line 6
#if ($location_6)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_6.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_6=$vendor_item_nbr_6.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_6.length()} > $Max_NbChar_D) #set ($sku_desc_6=$sku_desc_6.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_6.length()} > $Max_NbChar_C) #set ($qty_6=$qty_6.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_6.length()} > $Max_NbChar_B) #set ($dsp_sku_6=$dsp_sku_6.substring(0,$Max_NbChar_B)) #end
#if ($!{location_6.length()} > $Max_NbChar_A) #set ($location_6=$location_6.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_6}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_6}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_6}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_6}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_6}^FS
#end
## Bloc 5 (list): line 7
#if ($location_7)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_7.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_7=$vendor_item_nbr_7.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_7.length()} > $Max_NbChar_D) #set ($sku_desc_7=$sku_desc_7.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_7.length()} > $Max_NbChar_C) #set ($qty_7=$qty_7.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_7.length()} > $Max_NbChar_B) #set ($dsp_sku_7=$dsp_sku_7.substring(0,$Max_NbChar_B)) #end
#if ($!{location_7.length()} > $Max_NbChar_A) #set ($location_7=$location_7.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_7}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_7}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_7}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_7}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_7}^FS
#end
## Bloc 5 (list): line 8
#if ($location_8)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_8.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_8=$vendor_item_nbr_8.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_8.length()} > $Max_NbChar_D) #set ($sku_desc_8=$sku_desc_8.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_8.length()} > $Max_NbChar_C) #set ($qty_8=$qty_8.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_8.length()} > $Max_NbChar_B) #set ($dsp_sku_8=$dsp_sku_8.substring(0,$Max_NbChar_B)) #end
#if ($!{location_8.length()} > $Max_NbChar_A) #set ($location_8=$location_8.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_8}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_8}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_8}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_8}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_8}^FS
#end
## Bloc 5 (list): line 9
#if ($location_9)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_9.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_9=$vendor_item_nbr_9.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_9.length()} > $Max_NbChar_D) #set ($sku_desc_9=$sku_desc_9.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_9.length()} > $Max_NbChar_C) #set ($qty_9=$qty_9.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_9.length()} > $Max_NbChar_B) #set ($dsp_sku_9=$dsp_sku_9.substring(0,$Max_NbChar_B)) #end
#if ($!{location_9.length()} > $Max_NbChar_A) #set ($location_9=$location_9.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_9}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_9}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_9}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_9}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_9}^FS
#end
## Bloc 5 (list): line 10
#if ($location_10)
#set($FWK_Offset_x=$FWK_Offset_x+$Step)
^FO$FWK_Offset_x,$FWK_Offset_y_E ^GB$FWK_Size_x,$FWK_Size_y_E,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_D ^GB$FWK_Size_x,$FWK_Size_y_D,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_C ^GB$FWK_Size_x,$FWK_Size_y_C,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_B ^GB$FWK_Size_x,$FWK_Size_y_B,$FWK_Thickness ^FS
^FO$FWK_Offset_x,$FWK_Offset_y_A ^GB$FWK_Size_x,$FWK_Size_y_A,$FWK_Thickness ^FS
#set($CNT_offset_x=$CNT_offset_x+$Step)
#if ($!{vendor_item_nbr_10.length()} > $Max_NbChar_E) #set ($vendor_item_nbr_10=$vendor_item_nbr_10.substring(0,$Max_NbChar_E)) #end
#if ($!{sku_desc_10.length()} > $Max_NbChar_D) #set ($sku_desc_10=$sku_desc_10.substring(0,$Max_NbChar_D)) #end
#if ($!{qty_10.length()} > $Max_NbChar_C) #set ($qty_10=$qty_10.substring(0,$Max_NbChar_C)) #end
#if ($!{dsp_sku_10.length()} > $Max_NbChar_B) #set ($dsp_sku_10=$dsp_sku_10.substring(0,$Max_NbChar_B)) #end
#if ($!{location_10.length()} > $Max_NbChar_A) #set ($location_10=$location_10.substring(0,$Max_NbChar_A)) #end
^FT$CNT_offset_x,$CNT_Offset_y_E ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{vendor_item_nbr_10}^FS
^FT$CNT_offset_x,$CNT_Offset_y_D ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{sku_desc_10}^FS
^FT$CNT_offset_x,$CNT_Offset_y_C ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{qty_10}^FS
^FT$CNT_offset_x,$CNT_Offset_y_B ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{dsp_sku_10}^FS
^FT$CNT_offset_x,$CNT_Offset_y_A ^A0B,$CNT_size_x,$CNT_Size_y ^FD$!{location_10}^FS
#end
## Bloc 6 (footer)
^FT993,1573^A0B,33,31^FDParcel #:^FS
^FT993,1453^A0B,33,31^FD$!{carton_nbr}^FS
^FT1087,1453^BY4,3,87^BCB,,Y,N^FD>:$!{carton_nbr}^FS
^FT1087,540^A0B,33,31^FDTheoretical weight: $!{Est_Wt} KgG^FS
^FT1167,1573^A0B,33,31^FDYour parcel was thoughtfully prepared by:^FS
^PQ1,0,1,Y
^XZ
#end
#*
__START_FIELD_LIST_BARTENDER__
carton_nbr
carton_type
current_date
current_time
d_facility_name
distro_nbr
distro_number
dsp_sku_1
dsp_sku_2
dsp_sku_3
dsp_sku_4
dsp_sku_5
dsp_sku_6
dsp_sku_7
dsp_sku_8
dsp_sku_9
dsp_sku_10
location_1
location_2
location_3
location_4
location_5
location_6
location_7
location_8
location_9
location_10
orders_ref_field3
po_nbr
qty_1
qty_2
qty_3
qty_4
qty_5
qty_6
qty_7
qty_8
qty_9
qty_10
ship_to_name
sku_desc_1
sku_desc_2
sku_desc_3
sku_desc_4
sku_desc_5
sku_desc_6
sku_desc_7
sku_desc_8
sku_desc_9
sku_desc_10
vendor_item_nbr_1
vendor_item_nbr_2
vendor_item_nbr_3
vendor_item_nbr_4
vendor_item_nbr_5
vendor_item_nbr_6
vendor_item_nbr_7
vendor_item_nbr_8
vendor_item_nbr_9
vendor_item_nbr_10
__END_FIELD_LIST_BARTENDER__
*#
Label Image
Just take the code you have, replace all the variables with actual values, and then it should work. Mess with it till you get what you want. Then replace all the hard coded values with the variables again.
All if the ZPL commands the printer reads start with ^XYa,b,c, where ^ is the command prefix, XY would be the command, and abc would be different variables. You can look up the ^XY commands in the ZPL guide from Zebra. Things like "$CNT_offset_x" need to be replace with numbers. And "$!{vendor_item_nbr_1}" with text.
You'd do yourself a HUGE favor if you made one "line" section, and put that in a loop, rather than 10 distinct line sections. Then in the loop, you could take the line height, and multiply that by the line number, and add the starting position. Use that for all the vertical positioning pixel counts. So much easier than positioning every variable. Then if you need to change something, you can change it once, rather than 10 times.

The subscript is outside the error range 800A0009

I changed a computer with XP to w10 and a script that works with win WP gives me error of "the subscript is out of range" with W10. It gives me this error in the line "Set f = fso.GetFolder (objArgs (0))".
Then I copy the script:
enter code here
'****************************************************************
'* Script Comprueba si hay archivos, ejecuta proceso y renombra *
'****************************************************************
'*** Declaro variables y creo objetos necesarios ***
Dim Ejecuta, return
Set objArgs = WScript.Arguments
Set WshShell = CreateObject("WScript.Shell")
Set WshNetwork = CreateObject("WScript.Network")
Set fso = CreateObject("Scripting.FileSystemObject")
'*** Bucle de Cambio de nombre
Set f = fso.GetFolder(objArgs(0))
Set fc = f.Files
For Each f1 in fc
'*** Tratar los ficheros del directorio
nounom = "VACIO"
'*** JCT SI QUIERES TRATAR TODOS LOS FICHEROS DEL DIRECTORIO ELIMINA ESTA
If Left(UCase(f1.Name),3)= "ORD" Then
'*** PROCESAR FICHERO LEIDO
'WScript.Echo "procesar archivo leido"
command = "%COMSPEC% /k "
dos_command = "startrfc -3 -d DAP -u edi -p dav543 -c 100 -l ES -h 10.10.20.2 -s 00 -E PATHNAME=\\10.10.53.2\EDI\VOXEL\IN\"+f1.Name+ " -E PORT=DVG -F EDI_DATA_INCOMING -t"
'MsgBox dos_command
' Execute command.
WshShell.Run(command + dos_command)
'MsgBox "Fichero Procesado " + f1.Name
'*** nounom es el nombre del nuevo fichero
nounom = f1.name+".bak"
'*** ubinounom es la ubicacion y el nombre del nuevo fichero
ubinounom = "\\10.10.53.2\EDI\VOXEL\IN\"&nounom
'*** JCT SI QUIERES TRATAT TODOS LOS FICHEROS DEL DIRECTORIO ELIMINA ESTA INSTRUCCION Y LA 'SIGUIENTE
End If
'*** Comprobar si existe el fichero de destino, si no existe cambiar de nombre el de origen y 'moverlo a carpeta destino
If nounom <> "VACIO" and not(fso.FileExists(ubinounom)) Then
fso.CopyFile "\\daesvpfs01\EDI\voxel\IN\"&f1.Name, "\\daesvpfs01\EDI\voxel\HISTORICO\"&nounom
End if
Next
If you have a "the subscript is out of range" error when using objArgs(0), it is simply because objArgs does not contains anything. It has nothing to do with the OS. It is probably because you did not pass the required argument to your script. It is a good practice to check for missing arguments and report an error. You could add something like that to your code:
If objArgs.Count = 0 then
WScript.echo "Missing argument."
WScript.Quit
End if
To fix your problem, take a look at how you call your script. It should be something like:
cscript scriptfilename.vbs foldername
You are probably currently missing the foldername argument.

Check vim version and python support from a bash script

I have a bash script that is dependent on vim being at least version 7.4 and is installed with python. I need to check if the above condition matches, if not exit and ask user to update their vim.
So far all I can think of is something like below
has_vim = command -v vim >/dev/null
if ! $has_vim; then
echo "must have vim installed."
exit 1
fi
// Here I want do as the following pseudo code
vim_info = $(vim --version | grep python)
// suggest me if there is another way
vim_version = // find version info from $vim_info
has_python_support = // find python support from $vim_info
if ! $vim_version >= 7.4 && ! has_python_support; then
echo "vim version must be at least 7.4 and must be installed with python support"
fi
// everything is ok. carry on
At the moment all I can think of is checking $vim_info for expected vim version and python support.
To boil down the question into meaningful sentence:
How do I check if vim version is greater or equal to 7.4 and has python support from bash script?
When I ask my vim for vim --version, it spits out something like this:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 16 2015 08:44:57)
Included patches: 1-872
Compiled by <alexpux#gmail.com>
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand +perl/dyn +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent +python3/dyn +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu +ruby/dyn +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra -mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
So, parsing the output would be a good bet here.
Find the version number and store it in VIMVERSION:
VIMVERSION=$(vim --version | head -1 | cut -d ' ' -f 5)
From here, check In bash shell script how do I convert a string to an number for how to compare the string result against your minimum needed 7.4.
Check for Python support (HAS_PYTHON will be 0 if Python is not available):
HAS_PYTHON=$(vim --version | grep -c '+python')
Check explicitly for Python 3 (again, HAS_PYTHON3 will be 0 if Python 3 is not available):
HAS_PYTHON3=$(vim --version | grep -c '+python3')
This might be a bit rough but I think you get the idea.
#!/bin/bash
has_vim=$(command -v vim >/dev/null)
if ! $has_vim; then
echo "must have vim installed."
exit 1
fi
# Checking the python support based on the line output received
has_python_support=$(vim --version | grep -c python)
# Matching the decimal pattern from the first line
vim_version=$(vim --version | head -1 | grep -o '[0-9]\.[0-9]')
if [ ! $(echo "$vim_version >= 7.4" | bc -l) ] && [ ! $has_python_support ]; then
echo "vim version must be at least 7.4 and must be installed with python support"
else
echo "vim version is > 7.4"
fi
Should solve your problem
If you have a running Vim instance already, or if you can create one, you can always just ask Vim itself:
$ vim --servername SOME_NAME --remote-expr "has('python')"
1
$ vim --servername SOME_NAME --remote-expr "v:version"
704
But if Vim isn't already running it's probably more straightforward to parse the --version output as suggested in other answers.

Correct BCP syntax

I am a first time BCP user. I have an XML file that I need to import into a new table in SQL Server. This is using SQL Server 2008 and BCP version 10.50.16. I read through the documentation but I get 370,000 errors! (This is a very large file). When I open the error log, I just see a bunch of question marks.
About this XML file: it does use a new line to delineate rows, however, it uses the space character to separate fields. So I'm not sure if that is what causes it to fail. The failure message is:
BCP copy in failedI wish it were more descriptive. Is there a way to get a more detailed error message?
Otherwise, here is my command:
d:\SQL Tables\data>bcp Development.dbo.wbl_zSkywardEnrollment2 in zSkywardEnroll
ment.xml -fSE_format.fmt -m50 -eseErrorLog -b100 -t0x20 -T -F107
All of these files are in this same directory. I know it says to specify full file path, but since they're all in this same directory and also I saw another example where they didn't specify directories I thought this would suffice.
I have tried this without the format file also, doing it interactively but get same errors.
This is my format file:
10.0
32
1 SQLINT 0 4 " " 1 SCHOOL_YEAR ""
2 SQLNCHAR 2 20 " " 2 ENTITY_ID SQL_Latin1_General_CP1_CI_AS
3 SQLINT 0 4 " " 3 TERM_NBR ""
4 SQLINT 1 4 " " 4 SCHD_HST_GRAD_YEAR ""
5 SQLNCHAR 2 60 " " 5 OTHER_ID SQL_Latin1_General_CP1_CI_AS
6 SQLNUMERIC 1 19 " " 6 GRAD_YR ""
7 SQLNCHAR 2 120 " " 7 LAST_NAME SQL_Latin1_General_CP1_CI_AS
8 SQLNCHAR 2 60 " " 8 FIRST_NAME SQL_Latin1_General_CP1_CI_AS
9 SQLNCHAR 2 60 " " 9 MIDDLE_NAME SQL_Latin1_General_CP1_CI_AS
10 SQLDATETIME 1 8 " " 10 BIRTHDATE ""
11 SQLNCHAR 2 4 " " 11 GENDER SQL_Latin1_General_CP1_CI_AS
12 SQLNCHAR 2 20 " " 12 RACE_CODE SQL_Latin1_General_CP1_CI_AS
13 SQLNCHAR 2 40 " " 13 DISTRICT_CODE SQL_Latin1_General_CP1_CI_AS
14 SQLBIT 1 1 " " 14 X_SPECIAL_EDUCATION ""
15 SQLBIT 1 1 " " 15 X_GIFTED_TALENTED ""
16 SQLBIT 1 1 " " 16 X_SECTION_504 ""
17 SQLBIT 1 1 " " 17 X_MIGRANT ""
18 SQLBIT 1 1 " " 18 X_IEP ""
19 SQLBIT 1 1 " " 19 X_IEP_ACCOM ""
20 SQLBIT 1 1 " " 20 X_ESL ""
21 SQLNCHAR 2 4 " " 21 STUDENT_STATUS SQL_Latin1_General_CP1_CI_AS
22 SQLINT 0 4 " " 22 STUDENT_ID ""
23 SQLINT 1 4 " " 23 ENG_PROF ""
24 SQLNCHAR 2 60 " " 24 ALPHAKEY SQL_Latin1_General_CP1_CI_AS
25 SQLNCHAR 2 20 " " 25 SCHOOL_ID SQL_Latin1_General_CP1_CI_AS
26 SQLNUMERIC 1 19 " " 26 MN_EDE_NBR ""
27 SQLNCHAR 2 20 " " 27 LANGUAGE_CODE SQL_Latin1_General_CP1_CI_AS
28 SQLINT 1 4 " " 28 ADVISOR ""
29 SQLBIT 1 1 " " 29 MN_LIMITED_ENGLISH ""
30 SQLNCHAR 2 20 " " 30 TYPE_STUDENT_ID SQL_Latin1_General_CP1_CI_AS
31 SQLNCHAR 2 20 " " 31 CY_TEAM_SCHD_ID SQL_Latin1_General_CP1_CI_AS
32 SQLNCHAR 2 20 " " 32 HOMEROOM_NUMBER SQL_Latin1_General_CP1_CI_AS
This is my SQL table:
CREATE TABLE [dbo].[wbl_zSkywardEnrollment2](
[SCHOOL_YEAR] [int] NOT NULL,
[ENTITY_ID] [nvarchar](10) NOT NULL,
[TERM_NBR] [int] NOT NULL,
[SCHD_HST_GRAD_YEAR] [int] NULL,
[OTHER_ID] [nvarchar](30) NULL,
[GRAD_YR] numeric(19,0) NULL,
[LAST_NAME] [nvarchar](60) NOT NULL,
[FIRST_NAME] [nvarchar](30) NULL,
[MIDDLE_NAME] [nvarchar](30) NULL,
[BIRTHDATE] datetime NULL,
[GENDER] [nvarchar](2) NULL,
[RACE_CODE] [nvarchar](10) NULL,
[DISTRICT_CODE] [nvarchar](20) NULL,
[X_SPECIAL_EDUCATION] bit NULL,
[X_GIFTED_TALENTED] bit NULL,
[X_SECTION_504] bit NULL,
[X_MIGRANT] bit NULL,
[X_IEP] bit NULL,
[X_IEP_ACCOM] bit NULL,
[X_ESL] bit NULL,
[STUDENT_STATUS] [nvarchar](2) NULL,
[STUDENT_ID] [int] NOT NULL,
[ENG_PROF] [int] NULL,
[ALPHAKEY] [nvarchar](30) NOT NULL,
[SCHOOL_ID] [nvarchar](10) NULL,
[MN_EDE_NBR] [numeric](19, 0) NULL,
[LANGUAGE_CODE] [nvarchar](10) NULL,
[ADVISOR] [int] NULL,
[MN_LIMITED_ENGLISH] bit NULL,
[TYPE_STUDENT_ID] [nvarchar](10) NULL,
[CY_TEAM_SCHD_ID] [nvarchar](10) NULL,
[HOMEROOM_NUMBER] [nvarchar](10) NOT NULL
) ON [PRIMARY]
And I have tried this starting with row 1. I am curious which line should BCP start on? Line 1 of this XML starts with Schema and ElementType info. But on line 107 is where rs:data section starts.
The first part of this XML file:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly'>
<s:AttributeType name='c0' rs:name='SCHOOL_YEAR' rs:number='1'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='c1' rs:name='ENTITY_ID' rs:number='2'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='10' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='c2' rs:name='TERM_NBR' rs:number='3'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='c3' rs:name='SCHD_HST_GRAD_YEAR' rs:number='4' rs:nullable='true'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c4' rs:name='OTHER_ID' rs:number='5' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='24'/>
</s:AttributeType>
<s:AttributeType name='c5' rs:name='GRAD_YR' rs:number='6' rs:nullable='true'>
<s:datatype dt:type='number' rs:dbtype='numeric' dt:maxLength='19' rs:scale='0' rs:precision='15' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c6' rs:name='LAST_NAME' rs:number='7'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='60' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='c7' rs:name='FIRST_NAME' rs:number='8' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='30'/>
</s:AttributeType>
<s:AttributeType name='c8' rs:name='MIDDLE_NAME' rs:number='9' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='30'/>
</s:AttributeType>
<s:AttributeType name='BIRTHDATE' rs:name='BIRTHDATE' rs:number='10' rs:nullable='true' rs:write='true'>
<s:datatype dt:type='date' dt:maxLength='6' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='GENDER' rs:name='GENDER' rs:number='11' rs:nullable='true' rs:write='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='2'/>
</s:AttributeType>
<s:AttributeType name='c11' rs:name='RACE_CODE' rs:number='12' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='6'/>
</s:AttributeType>
<s:AttributeType name='c12' rs:name='DISTRICT_CODE' rs:number='13' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='14'/>
</s:AttributeType>
<s:AttributeType name='c13' rs:name='X_SPECIAL_EDUCATION' rs:number='14' rs:nullable='true'>
<s:datatype dt:type='boolean' dt:maxLength='2' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c14' rs:name='X_GIFTED_TALENTED' rs:number='15' rs:nullable='true'>
<s:datatype dt:type='boolean' dt:maxLength='2' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c15' rs:name='X_SECTION_504' rs:number='16' rs:nullable='true'>
<s:datatype dt:type='boolean' dt:maxLength='2' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c16' rs:name='X_MIGRANT' rs:number='17' rs:nullable='true'>
<s:datatype dt:type='boolean' dt:maxLength='2' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c17' rs:name='X_IEP' rs:number='18' rs:nullable='true'>
<s:datatype dt:type='boolean' dt:maxLength='2' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c18' rs:name='X_IEP_ACCOM' rs:number='19' rs:nullable='true'>
<s:datatype dt:type='boolean' dt:maxLength='2' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c19' rs:name='X_ESL' rs:number='20' rs:nullable='true'>
<s:datatype dt:type='boolean' dt:maxLength='2' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c20' rs:name='STUDENT_STATUS' rs:number='21' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='2'/>
</s:AttributeType>
<s:AttributeType name='c21' rs:name='STUDENT_ID' rs:number='22'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='c22' rs:name='ENGL_PROF' rs:number='23' rs:nullable='true'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='ALPHAKEY' rs:name='ALPHAKEY' rs:number='24' rs:write='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='22' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='c24' rs:name='SCHOOL_ID' rs:number='25'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='10' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='c25' rs:name='MN_EDE_NBR' rs:number='26' rs:nullable='true'>
<s:datatype dt:type='number' rs:dbtype='numeric' dt:maxLength='19' rs:scale='0' rs:precision='15' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c26' rs:name='LANGUAGE_CODE' rs:number='27' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='6'/>
</s:AttributeType>
<s:AttributeType name='c27' rs:name='ADVISOR' rs:number='28' rs:nullable='true' rs:write='true'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c28' rs:name='MN_LIMITED_ENGLISH' rs:number='29' rs:nullable='true'>
<s:datatype dt:type='boolean' dt:maxLength='2' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='c29' rs:name='TYPE_STUDENT_ID' rs:number='30' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='6'/>
</s:AttributeType>
<s:AttributeType name='c30' rs:name='CY_TEAM_SCHD_ID' rs:number='31' rs:nullable='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='6'/>
</s:AttributeType>
<s:AttributeType name='c31' rs:name='HOMEROOM_NUMBER' rs:number='32'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='10' rs:maybenull='false'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row c0='2004' c1='057' c2='0' c3='2010' c4='671590' c5='2010' c6='AANENSON' c7='SHELLI' c8='A' BIRTHDATE='1992-07-01'
GENDER='F' c11='5' c12='' c13='False' c14='True' c15='False' c16='False' c17='False' c18='False' c19='False'
c20='I' c21='12' c22='7' ALPHAKEY='AANENSHE000' c24='057' c25='624000671590' c26='011' ADVISOR='0' c28='False'
c29='R' c30='' c31=''/>
<z:row c0='2004' c1='057' c2='0' c3='2010' c4='671590' c5='2010' c6='AANENSON' c7='SHELLI' c8='A' BIRTHDATE='1992-07-01'
GENDER='F' c11='5' c12='' c13='False' c14='True' c15='False' c16='False' c17='False' c18='False' c19='False'
c20='I' c21='12' c22='7' ALPHAKEY='AANENSHE000' c24='057' c25='624000671590' c26='011' ADVISOR='0' c28='False'
c29='R' c30='' c31=''/>
<z:row c0='2004' c1='057' c2='0' c3='2010' c4='671590' c5='2010' c6='AANENSON' c7='SHELLI' c8='A' BIRTHDATE='1992-07-01'
GENDER='F' c11='5' c12='' c13='False' c14='True' c15='False' c16='False' c17='False' c18='False' c19='False'
c20='I' c21='12' c22='7' ALPHAKEY='AANENSHE000' c24='057' c25='624000671590' c26='011' ADVISOR='0' c28='False'
c29='R' c30='' c31=''/>
<z:row c0='2004' c1='057' c2='0' c3='2010' c4='671590' c5='2010' c6='AANENSON' c7='SHELLI' c8='A' BIRTHDATE='1992-07-01'
GENDER='F' c11='5' c12='' c13='False' c14='True' c15='False' c16='False' c17='False' c18='False' c19='False'
c20='I' c21='12' c22='7' ALPHAKEY='AANENSHE000' c24='057' c25='624000671590' c26='011' ADVISOR='0' c28='False'
c29='R' c30='' c31=''/>
<z:row c0='2004' c1='057' c2='0' c3='2010' c4='671590' c5='2010' c6='AANENSON' c7='SHELLI' c8='A' BIRTHDATE='1992-07-01'
GENDER='F' c11='5' c12='' c13='False' c14='True' c15='False' c16='False' c17='False' c18='False' c19='False'
c20='I' c21='12' c22='7' ALPHAKEY='AANENSHE000' c24='057' c25='624000671590' c26='011' ADVISOR='0' c28='False'
c29='R' c30='' c31=''/>
<z:row c0='2004' c1='057' c2='0' c3='2010' c4='671590' c5='2010' c6='AANENSON' c7='SHELLI' c8='A' BIRTHDATE='1992-07-01'
GENDER='F' c11='5' c12='' c13='False' c14='True' c15='False' c16='False' c17='False' c18='False' c19='False'
c20='I' c21='12' c22='7' ALPHAKEY='AANENSHE000' c24='057' c25='624000671590' c26='011' ADVISOR='0' c28='False'
c29='R' c30='' c31=''/>
You can't use bcp for this. The best that bcp can give you is an import from a file with comma/tab/etc. separated values. All references that you see to xml in the bcp documentation refer to the format file, not to the actual data to import.
There are actually two ways of doing this. The easiest is to use SQL Server Integration Services for this. This can help you further.
You could also do this by reading the xml file into SQL server. Then use sp_xml_preparedocument to parse the file. Finally, use OPENXML in combination with INSERT to import the data.

Resources